Closed normano closed 1 year ago
Thanks for raising an issue! This seems to be related to pi/4
sending it into a loop.
For this number:
x = 8.639379797371931405772269304
cos(x)
= cos(x - 2pi)
// = 8.639379797371931405772269304 - 6.2831853071795864769252867666 = 2.3561944901923449288469825374
= sin(pi/2 - (x - 2pi))
// = 1.5707963267948966192313216916 - 2.3561944901923449288469825374 = -0.7853981633974483096156608458
Currently in Rust Decimal QUARTER_PI
is set to 0.7853981633974483096156608458
which is the same figure.
Further information on the issue in the linked PR.
I've replicated this stack overflow with this value: 8.639379797371931405772269304. Sin() also overflows, but I'm not sure which value it will overflow for since I haven't printed it out.
println!"{}", rust_decimal_macros::dec!(8.639379797371931405772269304).checked_cos());