
On 1/31/2013 5:00 PM, Chris Angelico wrote:
I've never actually been in the situation of doing it, but wouldn't it be reasonable to switch out math.pi to be (say) a decimal.Decimal rather than a float?
Mixed float-decimal arithmetic does not work. If the float functions in math used 'math.pi', that would not work, but they do not. On the other hand, the stdlib and test suite do have a few expressions like 2.0 * math.pi and math.pi / 180.0 that would have to be changed to 2 * math.pi and math.pi / 180. (This might be a reasonable change anyway.) Non-float inputs to math functions like sin are apparently converted to float when possible (I tested int, Decimal, and Fraction with sin). So if you can otherwise avoid float +-*/ decimal, the answer might be yes. -- Terry Jan Reedy