Hi!

A few days ago, I asked on sage-support about rounding in Sage. But
since there was no answer and since it is relevant to my teaching in the
upcoming semester, let me repost here (with modifications).

According to IEEE 754, the default rounding mode for floating-point
operations is "round half to even". However, in examples it seems that
the rounding roule in RR is: "round half away from zero if the total
number of decimal digits in the result is odd and towards zero if the
total number of decimal digits of the result is even". Does that conform
to an established standard?

For teaching, it would be nice to have a customisable rounding function
that in particular allows rounding for different bases (binary, decimal,
etc), and allows to chose different rules (always round to 0, always
round away from 0, always round to +infty, always round to -infty,
round half to 0, round half away from 0, round half to +infty, round
half to -infty, round half to even, round half to odd, round half
alternatingly to 0 and away from 0, do the rounding in RR, ...).

Is there such function in Sage? Otherwise I would just write a custom
function for my course.

Best regards,
Simon

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/r6i1kk%24371d%241%40ciao.gmane.io.

Reply via email to