Re: on floating-point numbers

2021-09-05 Thread Richard Damon
> On Sep 5, 2021, at 6:22 PM, Peter J. Holzer wrote: > > On 2021-09-04 10:01:23 -0400, Richard Damon wrote: >>> On 9/4/21 9:40 AM, Hope Rouselle wrote: >>> Hm, I think I see what you're saying. You're saying multiplication and >>> division in IEEE 754 is perfectly safe --- so long as the numb

Re: on floating-point numbers

2021-09-05 Thread Peter J. Holzer
On 2021-09-04 10:01:23 -0400, Richard Damon wrote: > On 9/4/21 9:40 AM, Hope Rouselle wrote: > > Hm, I think I see what you're saying. You're saying multiplication and > > division in IEEE 754 is perfectly safe --- so long as the numbers you > > start with are accurately representable in IEEE 754

Re: on floating-point numbers

2021-09-05 Thread Peter J. Holzer
On 2021-09-05 03:38:55 +1200, Greg Ewing wrote: > If 7.23 were exactly representable, you would have got > 723/1000. > > Contrast this with something that *is* exactly representable: > > >>> 7.875.as_integer_ratio() > (63, 8) > > and observe that 7875/1000 == 63/8: > > >>> from fractions import

Re: on floating-point numbers

2021-09-05 Thread Peter J. Holzer
On 2021-09-04 09:48:40 -0300, Hope Rouselle wrote: > Christian Gollwitzer writes: > > Am 02.09.21 um 15:51 schrieb Hope Rouselle: > > ls = [7.23, 8.41, 6.15, 2.31, 7.73, 7.77] > > sum(ls) > >> 39.594 > >> > > ls = [8.41, 6.15, 2.31, 7.73, 7.77, 7.23] > > sum(ls) > >> 3