On Sunday, March 23, 2014 3:35:21 PM UTC-7, Aaron Meurer wrote:
>
> On Sun, Mar 23, 2014 at 5:23 PM, Joachim Durchholz 
> <[email protected]<javascript:>> 
> wrote: 
> > Am 23.03.2014 22:12, schrieb Christophe Bal: 
> > 
> >>>> You can prove that any  valid IEEE float is a rational 
> >> 
> >> 
> >> No ! Why ? Because of the arithmetic rules. You can have approximation 
> to 
> >> do. With decimals, you have to do exact calculations. 
> > 
> > 
> > You two are both right; you just mean different things when you say 
> "Float" 
> > and "Rational". 
> > 
> > Richard refers to the domain, i.e. the list of valid values. 
> > You to the abstract data structure, i.e. the domain plus operations. 
>
> And when SymPy says "rational" it means the field. The assumptions 
> system wouldn't very useful if rational only meant integer/integer. 


Now we must address what is meant by integer.   In common lisp, integer 
means
arbitrary precision integer.   Consequently, every rational number IS an 
integer/integer.

So is every double-precision IEEE float  (except inf and NaN) convertible 
to the
exact rational number which it represents in the form  integer/integer.

It seems to me the meanings of words in sympy should correspond to their
meanings in mathematics not some hack mockery of the word that appears in
one or even several programming languages.  The data structure for IEEE 
double-float
is used to represent a subset of the rational numbers.   If you want to 
make a test to
see if you are looking at a structure which is known to be an IEEE 
double-float, sure
you can do it sometimes.   (Not by looking at the 64 bits themselves, but 
presumably in
some compile-time or run-time symbol table kind of thing associated with 
those bits.)
You could also have a data structure for "rational as the ratio of two 
arbitrary precision
integers,."    That's been found fairly useful for symbolic programming.



We 
> want to be able to say things like rational + rational = rational and 
> rational1*rational2 = rational2*rational1 and so on. 
>

I'm not sure which you are saying, actually.

1.  we have a program to add any two rational numbers.  The result is a 
rational number.
2. we  can deduce from the fact that a,b are rational numbers that a+b is a 
rational number.

By the way, you may want to consider whether you are willing to compute 
with 1/0 and -1/0
and perhaps 0/0.   These are not rational numbers, but you might find them 
useful computational
objects.   (compare with IEEE +-inf and NaN).

RJF


> Aaron Meurer 
>
> > 
> > 
> > -- 
> > 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] <javascript:>. 
> > To post to this group, send email to [email protected]<javascript:>. 
>
> > 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/532F5EF2.2010405%40durchholz.org. 
>
> > 
> > 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/ab79eb72-cb3c-42ae-8f2c-21a8506430e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to