OLD | NEW |
1 // The following is adapted from fdlibm (http://www.netlib.org/fdlibm), | 1 // The following is adapted from fdlibm (http://www.netlib.org/fdlibm), |
2 // | 2 // |
3 // ==================================================== | 3 // ==================================================== |
4 // Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved. | 4 // Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved. |
5 // | 5 // |
6 // Developed at SunSoft, a Sun Microsystems, Inc. business. | 6 // Developed at SunSoft, a Sun Microsystems, Inc. business. |
7 // Permission to use, copy, modify, and distribute this | 7 // Permission to use, copy, modify, and distribute this |
8 // software is freely granted, provided that this notice | 8 // software is freely granted, provided that this notice |
9 // is preserved. | 9 // is preserved. |
10 // ==================================================== | 10 // ==================================================== |
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 // |x| in [log(maxdouble), overflowthreshold] | 805 // |x| in [log(maxdouble), overflowthreshold] |
806 if (MathAbs(x) <= KCOSH_OVERFLOW) { | 806 if (MathAbs(x) <= KCOSH_OVERFLOW) { |
807 var w = MathExp(0.5 * MathAbs(x)); | 807 var w = MathExp(0.5 * MathAbs(x)); |
808 var t = 0.5 * w; | 808 var t = 0.5 * w; |
809 return t * w; | 809 return t * w; |
810 } | 810 } |
811 if (NUMBER_IS_NAN(x)) return x; | 811 if (NUMBER_IS_NAN(x)) return x; |
812 // |x| > overflowthreshold. | 812 // |x| > overflowthreshold. |
813 return INFINITY; | 813 return INFINITY; |
814 } | 814 } |
OLD | NEW |