On Saturday, 13 January 2018 at 18:37:10 UTC, kdevel wrote:
I get large numerical dicrepancies and an exception:
That's because you are mixing floating point and decimal.
Just to take one example: double 1.1 cannot be represented
exactly as floating point and it's in fact
sin is calculated using a Taylor series: sin(x) = x - x^3/3! +
x^5/5! - x^7/7! ... and so on. Raising to power all that junk
after 1.1 will lead finally to error. If you really want to find
out sin(1.1) using decimal, try sin(decimal128("1.1")) or
For exact values like sin(1.0), I let you decide which one is
Wolfram Alpha: 0.8414709848078965066525023216302989
Anyway, I wouldn't call a difference at the 18th digit a "large
discrepancy" when we are talking about irrational numbers.
Regarding the exception, I cannot reproduce it, but I'll look
Thank you for your exhaustive testing :)