Here is a collection of various tests for special functions. There is also a set of tests using the builtin Math implementations for comparing between the fdlibm port and the builtin version.
It's likely that no browser passes all of the Javascript tests. Many of the expected results use an expected value that is produced by fdlibm, which might differ from the true correctly rounded result by (less than) 1 ulp.
Function | fdlibm | Javascript |
---|---|---|
sin, cos, tan | fdlibm trig | Math.trig |
log1p | fdlibm log1p | Math.log1p |
expm1 | fdlibm expm1 | Math.expm1 |
asinh | fdlibm asinh | Math.asinh |
acosh | fdlibm acosh | Math.acosh |
atanh | fdlibm atanh | Math.atanh |
exp | fdlibm exp | Math.exp |
sinh |
fdlibm sinh (with fdlibm exp)
fdlibm sinh (with Math.exp) |
Math.sinh |
cosh |
fdlibm cosh (with fdlibm exp)
fdlibm cosh (with Math.exp) |
Math.cosh |
tanh | fdlibm tanh (with fdlibm expm1) | Math.tanh |
log10 |
fdlibm log10 (with Math.log)
fdlibm log10 (with fdlibm log) |
Math.log10 |
log2 | fdlibm log2 | Math.log2 |
log | fdlibm log | Math.log |
scalbn | fdlibm scalbn |