[Haskell-cafe] rounding errors with real numbers.
Matthias Fischmann
fis at wiwi.hu-berlin.de
Mon Feb 27 13:51:13 EST 2006
On Mon, Feb 27, 2006 at 03:11:35PM +0100, Henning Thielemann wrote:
> To: Matthias Fischmann <fis at wiwi.hu-berlin.de>
> cc: haskell-cafe at haskell.org
> From: Henning Thielemann <lemming at henning-thielemann.de>
> Date: Mon, 27 Feb 2006 15:11:35 +0100 (MET)
> Subject: Re: [Haskell-cafe] rounding errors with real numbers.
>
>
> On Sun, 26 Feb 2006, Matthias Fischmann wrote:
>
> >I think this is the well-known issue of using real numbers in decimal
> >representation on a machine that thinks binary, but I don't know what
> >to do with it, and some of you maybe do.
> >
> >I want to shift+stretch a list of doubles into a given interval.
> >example:
> >
> >| x1 = [2, 3, 4, 5, 10]
> >| y1 = normInterval x1 0 1
> >| => y1 = [0.0,0.125,0.25,0.375,1.0]
> >
> >The function that does this looks something like this:
> >
> >| normInterval :: [Double] -> Double -> Double -> [Double]
> >| normInterval ps lower upper = map (\ x -> (x - oldLower) * stretch +
> >lower) ps
>
> Is there --------------------------------------------------------------^
> a cancellation problem?
what's a cancellation problem?
> Maybe you should use a kind of convex combination, that is
>
> (x-oldLower)*a + (oldUpper-x)*b
i don't quite understand this either. is 'x' an old element in my
input list and your expression is the corresponding new element? then
how does the resulting curve relate to the original one? does this
keep the ratios between distances between elements in the list intact?
(this is the property that i am interested in.)
but it sounds intriguing. perhaps i should play with this a little
and find out myself.
thanks,
matthias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20060227/623ea73c/attachment.bin
More information about the Haskell-Cafe
mailing list