Mathematically, all floats are rational numbers.  they can be written as
<integer1>  * 2 ^<integer2>.

They are in no way approximate except in the fuzzy minds of people who
took poorly constructed courses in "computing".  Some of those people
wrote crappy textbooks, too.




On Thursday, March 20, 2014 2:57:24 PM UTC-7, Sergey Kirpichev wrote:
>
> On Thu, Mar 20, 2014 at 04:35:43PM -0500, Aaron Meurer wrote: 
> > Can you think of a fact in the assumptions system (implemented or not) 
> > that would break if floats are rational? 
>
> Any, that uses algebraic properties of the rational numbers field. 
>

The properties that you expect fail because the operations + and * are
incorrect.  They could be made correct in the following way:
Any time two numbers are added or multiplied, see if the inexact flag in
IEEE floating-point unit is raised.

If the number result is inexact, re-do the computation using extended 
precision.
It no longer fits in the floating-point format, but is (a) rational  and 
(b) obeys
the expected field axioms.

if you ask is    sin(float)  which is a float,  how can that be rational, 
 you are mistaking the
mathematical function sin(x)  with a numerical  (in fact, rational) 
computation which
computes a rational number that is close to, but except for sin(0),  not 
equal to
the transcendental number sin(x) .

So there is no issue that the floats are not rational.  Each number is 
rational.
Your arithmetic is defective unless you work at it.  Alternatively you 
could say
that the subset of the rationals that can be represented in floating format 
does
not constitute a field.  Nor is it closed under sin(), log(), exp(). 

It is, in my opinion, a really bad mistake for sympy to accept the 
viewpoint that
the mathematically accurate answer is subsidiary to the misuses of 
ill-informed
(mathematically speaking) coders, or for that matter, programming language
designers.


 

>
> An example, associativity: 
> "((x + y) + z) - (x + (y + z)) is zero" 
>

-- 
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/635e4ef2-3c52-4c70-ac36-5f9bb39a743e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to