Re: sys.float_info.epsilon

2009-02-05 Thread Mark Dickinson
On Feb 4, 9:44 pm, Tim Rowe wrote: > That just leaves me puzzled as to why Mark Summerfield used it instead > of a check against zero on user input. No idea: you'd have to ask Mark Summerfield. If there's an email address published in his book, I'm sure he wouldn't object to the question. > So

Re: sys.float_info.epsilon

2009-02-04 Thread Tim Rowe
2009/2/5 Scott David Daniels : > And, of course he is right (and didn't even whomp on my typo of "makes" > as "mes in the first line quoted above). A typo for "makes" didn't bother me. Non-associativity of the real numbers under addition risked making my whole world fall apart :-) -- Tim Rowe

Re: sys.float_info.epsilon

2009-02-04 Thread Scott David Daniels
I wrote: > You are missing the whole thing that mes floating point tricky > The reason it is tough is that addition is not associative in real > numbers, and associativity is at the core > of a lot of proofs in > arithmetic (and group theory). In response to which Tim Rowe wrote: ... Thanks

Re: sys.float_info.epsilon

2009-02-04 Thread Tim Rowe
2009/2/4 Scott David Daniels : Thanks for that. It makes me feel guilty to point out that: > addition is not associative in real numbers should presumably be "addition is not associative in floating point numbers". -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.float_info.epsilon

2009-02-04 Thread Tim Rowe
2009/2/4 Mark Dickinson : > There are many positive floating-point values smaller than > sys.float_info.epsilon. > > sys.float_info.epsilon is defined as the difference between 1.0 and > the next largest representable floating-point number. On your system, > the next large

Re: sys.float_info.epsilon

2009-02-04 Thread Steve Holden
Tim Rowe wrote: > I'm reading Mark Summerfield's "Programming Python 3.0" at the moment, > and I'm puzzled by some of his uses of sys.float_info.epsilon. I > appreciate the issues of comparing floating point numbers, but I'm > puzzled by code like: >

Re: sys.float_info.epsilon

2009-02-04 Thread Mark Dickinson
On Feb 4, 7:52 pm, Scott David Daniels wrote: > You are missing the whole thing that mes floating point tricky. > I _believe_ that the epsilon is the smallest positive x such that >     1.0 != 1.0 + x Nitpick alert: this isn't quite the same thing, since that definition is affected by rounding.

Re: sys.float_info.epsilon

2009-02-04 Thread Mark Dickinson
g-point values smaller than sys.float_info.epsilon. sys.float_info.epsilon is defined as the difference between 1.0 and the next largest representable floating-point number. On your system, the next largest float is almost certainly 1 + 2**-52, so sys.float_info.epsilon will be exactly 2**-52, w

Re: sys.float_info.epsilon

2009-02-04 Thread Scott David Daniels
Tim Rowe wrote: I'm reading Mark Summerfield's "Programming Python 3.0" at the moment, and I'm puzzled by some of his uses of sys.float_info.epsilon. I appreciate the issues of comparing floating point numbers, but I'm puzzled by code like: ... x =

sys.float_info.epsilon

2009-02-04 Thread Tim Rowe
I'm reading Mark Summerfield's "Programming Python 3.0" at the moment, and I'm puzzled by some of his uses of sys.float_info.epsilon. I appreciate the issues of comparing floating point numbers, but I'm puzzled by code like: ... x = float(input(msg)) if a