This gives nan if the input is e.g. 1.00000001 due to rounding errors, better is to use saacos (safe acos) that checks for the range first.
This gives nan if the input is e.g. 1.00000001 due to rounding errors, better is to use saacos (safe acos) that checks for the range first.