> cancellation happens for instance here: 1 + 1e-50 - 1 == 0 the function again (in the wasteful original form, for clarity). where do you think cancellation may take place? isn't what you call canellation a generic rounding error?
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
normInterval :: [Double] -> Double -> Double -> [Double]
normInterval ps lower upper = repair (map (\ x -> (x - oldLower) * stretch +
lower) ps)
where
oldLower = head ps
oldUpper = last ps
stretch = (upper - lower) / (oldUpper - oldLower)
-- fix rounding error:
repair [i] = [upper]
repair (h:t) = h : repair t
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >>(x-oldLower)*a + (oldUpper-x)*b
i got this into my head though. neat. thanks! i will rewrite the
function right now.
cheers,
matthias
signature.asc
Description: Digital signature
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
