s_tanl.c (a5615c90442b10b0d286b8fcf2cfdcc1c2958d58) | s_tanl.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 --- 20 unchanged lines hidden (view full) --- 29 30/* 31 * Limited testing on pseudorandom numbers drawn within [0:4e8] shows 32 * an accuracy of <= 1.5 ULP where 247024 values of x out of 40 million 33 * possibles resulted in tan(x) that exceeded 0.5 ULP (ie., 0.6%). 34 */ 35 36#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 --- 20 unchanged lines hidden (view full) --- 29 30/* 31 * Limited testing on pseudorandom numbers drawn within [0:4e8] shows 32 * an accuracy of <= 1.5 ULP where 247024 values of x out of 40 million 33 * possibles resulted in tan(x) that exceeded 0.5 ULP (ie., 0.6%). 34 */ 35 36#include <float.h> |
37#ifdef __i386__ 38#include <ieeefp.h> 39#endif |
|
37 38#include "math.h" 39#include "math_private.h" 40#if LDBL_MANT_DIG == 64 41#include "../ld80/e_rem_pio2l.h" 42#elif LDBL_MANT_DIG == 113 43#include "../ld128/e_rem_pio2l.h" 44#else --- 15 unchanged lines hidden (view full) --- 60 /* If x = +-0 or x is subnormal, then tan(x) = x. */ 61 if (z.bits.exp == 0) 62 return (x); 63 64 /* If x = NaN or Inf, then tan(x) = NaN. */ 65 if (z.bits.exp == 32767) 66 return ((x - x) / (x - x)); 67 | 40 41#include "math.h" 42#include "math_private.h" 43#if LDBL_MANT_DIG == 64 44#include "../ld80/e_rem_pio2l.h" 45#elif LDBL_MANT_DIG == 113 46#include "../ld128/e_rem_pio2l.h" 47#else --- 15 unchanged lines hidden (view full) --- 63 /* If x = +-0 or x is subnormal, then tan(x) = x. */ 64 if (z.bits.exp == 0) 65 return (x); 66 67 /* If x = NaN or Inf, then tan(x) = NaN. */ 68 if (z.bits.exp == 32767) 69 return ((x - x) / (x - x)); 70 |
71 ENTERI(); 72 |
|
68 /* Optimize the case where x is already within range. */ 69 if (z.e < M_PI_4) { 70 hi = __kernel_tanl(z.e, 0, 0); | 73 /* Optimize the case where x is already within range. */ 74 if (z.e < M_PI_4) { 75 hi = __kernel_tanl(z.e, 0, 0); |
71 return (s ? -hi : hi); | 76 RETURNI(s ? -hi : hi); |
72 } 73 74 e0 = __ieee754_rem_pio2l(x, y); 75 hi = y[0]; 76 lo = y[1]; 77 78 switch (e0 & 3) { 79 case 0: 80 case 2: 81 hi = __kernel_tanl(hi, lo, 0); 82 break; 83 case 1: 84 case 3: 85 hi = __kernel_tanl(hi, lo, 1); 86 break; 87 } 88 | 77 } 78 79 e0 = __ieee754_rem_pio2l(x, y); 80 hi = y[0]; 81 lo = y[1]; 82 83 switch (e0 & 3) { 84 case 0: 85 case 2: 86 hi = __kernel_tanl(hi, lo, 0); 87 break; 88 case 1: 89 case 3: 90 hi = __kernel_tanl(hi, lo, 1); 91 break; 92 } 93 |
89 return (hi); | 94 RETURNI(hi); |
90} | 95} |