>>> Mathematically, all floats are rational numbers. >>> They can be written as <integer1> * 2 ^<integer2>.
That is not true. Why ? Because of the arithmetic operations. See the preceding mail for an example. Mathematically, there is not set of floats. The floats are a lot more complex, that is not a bad play on words, than the decimals. 2014-03-22 11:07 GMT+01:00 Sergey B Kirpichev <[email protected]>: > On Fri, Mar 21, 2014 at 02:57:50PM -0700, Richard Fateman wrote: > > The properties that you expect fail because the operations + and * are > > incorrect. [...] So there is no issue that the floats are not > > rational. Each number is rational. > > Your arithmetic is defective unless you work at it. > > In [8]: (0.001 + 1.1) - 1.0 > Out[8]: 0.10099999999999998 > > In [9]: 0.001 + (1.1 - 1.0) > Out[9]: 0.10100000000000009 > > [1]> (+ (+ 0.001 (+ 1.1 -1.0))) > 0.101000026 > [2]> (+ (+ 0.001 1.1) -1.0) > 0.10100007 > > (That's for builtin float's in Python and CL). > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/20140322100746.GA21938%40darkstar.order.hcn-strela.ru > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAAb4jG%3DNKS7OwKfwVg6nb2nvFSvZLxyHy1McshVSznPCPHFH2w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
