| 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 by Sun Microsystems, Inc. All rights reserved. | 4 // Copyright (C) 1993 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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 z = one - z; | 602 z = one - z; |
| 603 if (carry != 0) z -= scalbn(one, q0); | 603 if (carry != 0) z -= scalbn(one, q0); |
| 604 } | 604 } |
| 605 } | 605 } |
| 606 | 606 |
| 607 /* check if recomputation is needed */ | 607 /* check if recomputation is needed */ |
| 608 if (z == zero) { | 608 if (z == zero) { |
| 609 j = 0; | 609 j = 0; |
| 610 for (i = jz - 1; i >= jk; i--) j |= iq[i]; | 610 for (i = jz - 1; i >= jk; i--) j |= iq[i]; |
| 611 if (j == 0) { /* need recomputation */ | 611 if (j == 0) { /* need recomputation */ |
| 612 for (k = 1; iq[jk - k] == 0; k++) { | 612 for (k = 1; jk >= k && iq[jk - k] == 0; k++) { |
| 613 /* k = no. of terms needed */ | 613 /* k = no. of terms needed */ |
| 614 } | 614 } |
| 615 | 615 |
| 616 for (i = jz + 1; i <= jz + k; i++) { /* add q[jz+1] to q[jz+k] */ | 616 for (i = jz + 1; i <= jz + k; i++) { /* add q[jz+1] to q[jz+k] */ |
| 617 f[jx + i] = ipio2[jv + i]; | 617 f[jx + i] = ipio2[jv + i]; |
| 618 for (j = 0, fw = 0.0; j <= jx; j++) fw += x[j] * f[jx + i - j]; | 618 for (j = 0, fw = 0.0; j <= jx; j++) fw += x[j] * f[jx + i - j]; |
| 619 q[i] = fw; | 619 q[i] = fw; |
| 620 } | 620 } |
| 621 jz += k; | 621 jz += k; |
| 622 goto recompute; | 622 goto recompute; |
| (...skipping 2114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2737 /* |x| >= 22, return +-1 */ | 2737 /* |x| >= 22, return +-1 */ |
| 2738 } else { | 2738 } else { |
| 2739 z = one - tiny; /* raise inexact flag */ | 2739 z = one - tiny; /* raise inexact flag */ |
| 2740 } | 2740 } |
| 2741 return (jx >= 0) ? z : -z; | 2741 return (jx >= 0) ? z : -z; |
| 2742 } | 2742 } |
| 2743 | 2743 |
| 2744 } // namespace ieee754 | 2744 } // namespace ieee754 |
| 2745 } // namespace base | 2745 } // namespace base |
| 2746 } // namespace v8 | 2746 } // namespace v8 |
| OLD | NEW |