Hi Simon,

On 04/02/2018 23:59, Simon King wrote:
On 2018-02-04, Simon King <simon.k...@uni-jena.de> wrote:
On 2018-02-04, Thierry <sage-googlesu...@lma.metelu.net> wrote:
On Sun, Feb 04, 2018 at 10:24:55PM +0000, Simon King wrote:
What is wrong ?

val is a NEGATIVE real number converted into SR. val evaluates POSITIVE,
even though the conversion of val into RR still evaluates negative.

Ouch, sorry, when I posted I was apparently editing stuff in a wrong
way.

So, here is the example:
  sage: val = pi - 2286635172367940241408/1029347477390786609545*sqrt(2)
  sage: bool(val<0)
  False
  sage: bool(val>0)
  True
>
> [SNIP]
>
So, is that a bug, after all? val being positive, RR(val) being
negative?

This is example is definitely a bug. In order to test
positivity/negativity of a real number you would better use interval
field to get provent result such as the following. With the default
precision of 53 bits it fails

sage: r = 2286635172367940241408/1029347477390786609545

sage: R = RIF
sage: (R.pi() - r * R(2).sqrt()) > 0
False
sage: (R.pi() - r * R(2).sqrt()) < 0
False

Note that in the above example R here is consistent with comparison: it
does not know and answers False everywhere.

But 182 bits is enough

sage: R = RealIntervalField(128)
sage: (R.pi() - r * R(2).sqrt()) > 0
False
sage: (R.pi() - r * R(2).sqrt()) < 0
True

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 sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
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