Hi Vincent,

On Wed, Mar 09, 2016 at 10:44:10AM -0500, David Roe wrote:
> The behavior for floating point is governed by IEEE standards, which
> dictate +infinity in this case. So I think this is not a bug.

I strongly agree with this point of view! Elements belong to some parent,
which has some rules and expected bahaviour.

In your zeroth case, 1 and 0 belong to the integer ring ZZ, where 1/0 is
not defined.

This is consistent with AA(1)/AA(0), QQ(1)/QQ(0), etc...

In your first case, 1. and 0. belong to RR, which is the set of MPFR
elements, for which 1./0. is specified by IEEE standards. Willing to
change the behaviour will be similar to requesting that 'NaN in RR' should
return False.

Though many people are not convinced, i think such confusion shows again
the need for a genuine mathematical Real Field abstraction which i
somtimes advocate, over the existing representations, containing
QQbar(2).sqrt() as well as pi, 1/3 and 0.1, in which 1./0. raises an
error, because this is what makes sense in this parent.

In your second case, well, SR behaviour is not specified, so i have no
particular expectation ;)

In your third case, you say "I guess that the behavior of Sage floating
point should be modified. What do you think?". It depends on which level
you are asking. Somehow, it is already the case, Sage floats are Python
floats:

sage: float(1.)/float(0.)
ZeroDivisionError: float division by zero

For RDF or RR, it is not a good option as explained before. But perhaps (i
am not sure about your actual query), you are asking for the default
*preparsing* of "0.1", which could be left unparsed by default (hence
being a Python float with the behaviour you want). This is very tempting.
Indeed, during a tutorial i gave one year ago at Paris 13, a few
numericians were there, and while trying to work with numpy/sympy
following some tutorial, they surrended because of the preparsing of
floating-point that was not compatible with standard Python and did not
allow to work with numpy/sympy examples, and they all finally went to
install anaconda instead. Not being comparible with the Python ecosystem
is an issue. Said otherwise: newcomers-friendlyness should not be part of
the code but located on a specific "interface" layer (and made visible and
explicit).

Ciao,
Thierry




> On Mar 9, 2016 10:13, "Vincent Delecroix" <[email protected]> wrote:
> 
> > Hello,
> >
> > Compare
> >
> >
> >   sage: 1 / 0
> >   Traceback (most recent call last):
> >   ...
> >   ZeroDivisionError: rational division by zero
> >
> >
> >   sage: 1. / 0.
> >   +infinity
> >
> >
> >   sage: SR(1.) / SR(0.)
> >   Traceback (most recent call last):
> >   ...
> >   ZeroDivisionError: Symbolic division by zero
> >
> >
> > Since in Python (2 and 3) we have
> >
> >   sage: 1.r / 0.r
> >   Traceback (most recent call last):
> >   ...
> >   ZeroDivisionError: float division by zero
> >
> > I guess that the behavior of Sage floating point should be modified. What
> > do you think?
> >
> > Vincent
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "sage-devel" 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 https://groups.google.com/group/sage-devel.
> > For more options, visit https://groups.google.com/d/optout.
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" 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 https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" 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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to