[issue35880] math.sin has no backward error; this isn't documented

2019-03-08 Thread Tim Peters
Tim Peters added the comment: Jurjen, the errors you see in Python's sin() are _entirely_ due to your platform C's libm. Python just calls the platform C's sin. So nothing can be said about it in general. The better libm trig functions today do indeed perform trig argument reduction "as

[issue35880] math.sin has no backward error; this isn't documented

2019-03-08 Thread Jurjen N.E. Bos
Jurjen N.E. Bos added the comment: I stand corrected; more on that later. "backward error" is the mathematical term used for the accuracy of a function. (Forward error is in the result proper; backward error means that you calculate the correct result for a number that is very close to the

[issue35880] math.sin has no backward error; this isn't documented

2019-02-15 Thread Mark Dickinson
Mark Dickinson added the comment: @jneb: Please could you clarify what sort of addition to the documentation you're proposing? Again, it's not clear what you mean by "backward error" here, or what sort of addition would be useful given the divergence of math function behaviours across

[issue35880] math.sin has no backward error; this isn't documented

2019-02-01 Thread Terry J. Reedy
Change by Terry J. Reedy : -- stage: -> needs patch versions: -Python 3.4, Python 3.5, Python 3.6 ___ Python tracker ___ ___

[issue35880] math.sin has no backward error; this isn't documented

2019-02-01 Thread Tim Peters
Tim Peters added the comment: As Mark said, the behavior of Python's floating-point math functions (not just trig, but also log, pow, exp, ...) is inherited almost entirely from the platform C's math libraries. Python itself guarantees nothing about what `math.sin(x)` returns for any `x` -

[issue35880] math.sin has no backward error; this isn't documented

2019-02-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: > sin(1<<500) is correctly computed as 0.42925739234242827 py> math.sin(1<<500) 0.9996230490249484 Wolfram Alpha says it is 0.429257392342428277735329299112473759079115476327819897...

[issue35880] math.sin has no backward error; this isn't documented

2019-02-01 Thread Mark Dickinson
Mark Dickinson added the comment: There's not a whole lot that we can usefully say about the accuracy of `math.sin`, since CPython just wraps C's sin function. So we just inherit the behaviour of the platform libm. I don't think I understand what you mean by "backward error" in this

[issue35880] math.sin has no backward error; this isn't documented

2019-02-01 Thread Jurjen N.E. Bos
New submission from Jurjen N.E. Bos : The documentation of math.sin (and related trig functions) doesn't speak about backward error. In cPython, as far as I can see, there is no backward error at all, which is quite uncommon. This may vary between implementations; many math libraries of other