s_cosl.c (a5615c90442b10b0d286b8fcf2cfdcc1c2958d58) | s_cosl.c (340076f0f6f6de72daa67a321649f76963da6b85) |
---|---|
1/*- 2 * Copyright (c) 2007 Steven G. Kargl 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28__FBSDID("$FreeBSD$"); 29 30/* 31 * Limited testing on pseudorandom numbers drawn within [-2e8:4e8] shows 32 * an accuracy of <= 0.7412 ULP. 33 */ 34 35#include <float.h> | 1/*- 2 * Copyright (c) 2007 Steven G. Kargl 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28__FBSDID("$FreeBSD$"); 29 30/* 31 * Limited testing on pseudorandom numbers drawn within [-2e8:4e8] shows 32 * an accuracy of <= 0.7412 ULP. 33 */ 34 35#include <float.h> |
36#ifdef __i386__ 37#include <ieeefp.h> 38#endif |
|
36 37#include "math.h" 38#include "math_private.h" 39#if LDBL_MANT_DIG == 64 40#include "../ld80/e_rem_pio2l.h" 41#elif LDBL_MANT_DIG == 113 42#include "../ld128/e_rem_pio2l.h" 43#else --- 14 unchanged lines hidden (view full) --- 58 /* If x = +-0 or x is a subnormal number, then cos(x) = 1 */ 59 if (z.bits.exp == 0) 60 return (1.0); 61 62 /* If x = NaN or Inf, then cos(x) = NaN. */ 63 if (z.bits.exp == 32767) 64 return ((x - x) / (x - x)); 65 | 39 40#include "math.h" 41#include "math_private.h" 42#if LDBL_MANT_DIG == 64 43#include "../ld80/e_rem_pio2l.h" 44#elif LDBL_MANT_DIG == 113 45#include "../ld128/e_rem_pio2l.h" 46#else --- 14 unchanged lines hidden (view full) --- 61 /* If x = +-0 or x is a subnormal number, then cos(x) = 1 */ 62 if (z.bits.exp == 0) 63 return (1.0); 64 65 /* If x = NaN or Inf, then cos(x) = NaN. */ 66 if (z.bits.exp == 32767) 67 return ((x - x) / (x - x)); 68 |
69 ENTERI(); 70 |
|
66 /* Optimize the case where x is already within range. */ 67 if (z.e < M_PI_4) | 71 /* Optimize the case where x is already within range. */ 72 if (z.e < M_PI_4) |
68 return (__kernel_cosl(z.e, 0)); | 73 RETURNI(__kernel_cosl(z.e, 0)); |
69 70 e0 = __ieee754_rem_pio2l(x, y); 71 hi = y[0]; 72 lo = y[1]; 73 74 switch (e0 & 3) { 75 case 0: 76 hi = __kernel_cosl(hi, lo); --- 4 unchanged lines hidden (view full) --- 81 case 2: 82 hi = - __kernel_cosl(hi, lo); 83 break; 84 case 3: 85 hi = __kernel_sinl(hi, lo, 1); 86 break; 87 } 88 | 74 75 e0 = __ieee754_rem_pio2l(x, y); 76 hi = y[0]; 77 lo = y[1]; 78 79 switch (e0 & 3) { 80 case 0: 81 hi = __kernel_cosl(hi, lo); --- 4 unchanged lines hidden (view full) --- 86 case 2: 87 hi = - __kernel_cosl(hi, lo); 88 break; 89 case 3: 90 hi = __kernel_sinl(hi, lo, 1); 91 break; 92 } 93 |
89 return (hi); | 94 RETURNI(hi); |
90} | 95} |