#8074: corner cases in RealField and real numbers
-------------------------+--------------------------------------------------
Reporter: jason | Owner: jkantor
Type: defect | Status: needs_info
Priority: major | Milestone: sage-4.3.3
Component: numerical | Keywords:
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-------------------------+--------------------------------------------------
Comment(by zimmerma):
> You are one of the best experts around on floating point issues...
thanks, you are putting pressure on me! I'll try to do my best...
One first problem is that {{{is_real}}} is not documented, thus I don't
know what the intended
semantics is or was. In MPFR there is no such function:
{{{
-- Function: int mpfr_nan_p (mpfr_t OP)
-- Function: int mpfr_inf_p (mpfr_t OP)
-- Function: int mpfr_number_p (mpfr_t OP)
-- Function: int mpfr_zero_p (mpfr_t OP)
Return non-zero if OP is respectively NaN, an infinity, an ordinary
number (i.e. neither NaN nor an infinity) or zero. Return zero
otherwise.
}}}
About {{{RR('inf').is_unit()}}}, if one considers that x is a unit if 1/x
is in RR, then since
1/inf = 0 is in RR, it should return true.
{{{RR('nan')==RR('nan')}}} should return False according to IEEE 754.
{{{RR('nan').__pow(0.5)}}} should return NaN (here NaN means "can be any
real number").
{{{RR('-inf').__pow(0.5)}}} is ok according to the MPFR rules (here I
assume that we try to stay
in RR):
{{{
* `pow(-Inf, Y)' returns plus infinity for Y positive and not
an odd integer.
}}}
For {{{sqrt(RR('-inf'))}}} it depends on the semantics of the sqrt
function. Apparently it
extends to the complex plane (try {{{sqrt(RR(-1))}}}) thus the answer
seems ok to me.
{{{RR('nan').__nonzero__()}}} is more difficult, since "NaN" means "can be
any real", thus in
particular it can be zero, thus the answer should be "maybe". If no
ternary answer is possible,
false seems the best one.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8074#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.