davjam / HaskellNumericsTestsFixes

Tests, fixes and illustrations for Haskell floating point (real & complex) functions. The intention is to integrate the fixes back into core Haskell.
0 stars 0 forks source link

sin etc of huge numbers #4

Open davjam opened 3 years ago

davjam commented 3 years ago

sin 1e100 is clearly nonsense. Should it return NaN? Some experiments with smaller numbers:

sin 1e14 -0.2094084333834997 sin 1e14 :: Float 0.9671488

In https://www.python.org/:

import math math.sin(1e14) -0.2094083074964523

In https://www.tutorialspoint.com/execute_lisp_online.php:

(format t "~d" (sin 1e14)) 0.96697646

(iPhone & Window calculators give ~-0.209, as does sinLarge with piRat to 1000 fracs)

davjam commented 3 years ago

ISO 10967-2 requires big angle r(F) - the max angle that sin, etc, is required to be valid for, and absolute_precision_underflow error (giving a qNaN) for angles outside of this.