https://docs.python.org/3/reference/datamodel.html?highlight=__round__#object.__round__
We should define these special methods so that the built-in round and math.trunc, math.floor, math.ceil can operate on Sage numbers.
This can help to eliminate imports of floor and ceil from sage.functions throughout the Sage library, which pulls in all of sage.symbolic.
Related: In the global namespace, we have:
round = sage.misc.functional.round,
floor = sage.functions.other.floor,
ceil = sage.functions.other.ceil,
trunc - undefined
CC: @jdemeyer @tscrim
Component: python3
Author: Frédéric Chapoton
Branch/Commit: public/ticket/25827 @ 53280c5
Issue created by migration from https://trac.sagemath.org/ticket/25827
https://docs.python.org/3/reference/datamodel.html?highlight=__round__#object.__round__
We should define these special methods so that the built-in
roundandmath.trunc,math.floor,math.ceilcan operate on Sage numbers.This can help to eliminate imports of
floorandceilfromsage.functionsthroughout the Sage library, which pulls in all ofsage.symbolic.Related: In the global namespace, we have:
round=sage.misc.functional.round,floor=sage.functions.other.floor,ceil=sage.functions.other.ceil,trunc- undefinedCC: @jdemeyer @tscrim
Component: python3
Author: Frédéric Chapoton
Branch/Commit: public/ticket/25827 @
53280c5Issue created by migration from https://trac.sagemath.org/ticket/25827