On 30/03/2017 11:33, Thierry wrote:
Hi,

On Thu, Mar 30, 2017 at 10:20:21AM +0200, Marc Mezzarobba wrote:
Thierry wrote:
I do not remember where i read that (correct me if i am wrong, or
provide a reference if you know where it is), but RDF is supposed to
round towards the nearest floating-point number.

RR is, but I think RDF may or may not provide correct rounding depending
what the underlying libm does.

I found the reference i was looking for :
http://doc.sagemath.org/html/en/reference/rings_numerical/sage/rings/real_double.html#sage.rings.real_double.RealDoubleElement.ulp

So, if this depends on libm, i guess this should be updated and we should
provide a way to know/modify the current rounding mode ?

You can obtain and modify the CPU rounding mode using the C functions declared in fenv.h

    int FE_TONEAREST
    int FE_UPWARD
    int FE_DOWNWARD
    int FE_TOWARDZERO
    int fegetround ()
    int fesetround (int)

(there is an example in src/sage/graphs/base/static_sparse_graph.pyx)

However, this go beyond libm and will affect any library using floating point numbers.

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