1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  24  */
  25 
  26 /*
  27  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  28  * Use is subject to license terms.
  29  */
  30 
  31 #include "libm_protos.h"
  32 
  33 /*
  34  * Let y[j] = _TBL_atan[2j], atan_y[j] = _TBL_atan[2j+1], j = 0, 1, ..., 95.
  35  * {y[j], 0 <= j < 96} is a set of break points in (-1/8, 8) chosen so that
  36  * the high part of y[j] is very close to 0x3fc08000 + (j << 16),
  37  * and atan_y[j] = atan(y[j]) rounded has relative error bounded by 2^-60.
  38  *
  39  * -- K.C. Ng, 10/17/2004
  40  */
  41 
  42 const double _TBL_atan[] = {
  43         1.28906287871928065814e-01, 1.28199318484201185697e-01,
  44         1.36718905591866640714e-01, 1.35876480966603985223e-01,
  45         1.44531257606217988787e-01, 1.43537301152401930437e-01,
  46         1.52343679482641575218e-01, 1.51181262880709432750e-01,
  47         1.60156177403962790562e-01, 1.58807537535115006477e-01,
  48         1.67968772982362929413e-01, 1.66415323534856884891e-01,
  49         1.75781211596017922227e-01, 1.74003563682464612583e-01,
  50         1.83593807762862160082e-01, 1.81571767039387044207e-01,
  51         1.91406205589629646591e-01, 1.89118806085245338977e-01,
  52         1.99218440148815872925e-01, 1.96643947167121080355e-01,
  53         2.07031180070658488157e-01, 2.04147078126891479144e-01,
  54         2.14843557086546094181e-01, 2.11626624363759674452e-01,
  55         2.22656308649619494311e-01, 2.19082566659412503185e-01,
  56         2.30468759807905931858e-01, 2.26513550670145669130e-01,
  57         2.38281413377399470255e-01, 2.33919360814280885563e-01,
  58         2.46093763828156536499e-01, 2.41298839969374956382e-01,
  59         2.57812599322508773092e-01, 2.52318074018685223336e-01,
  60         2.73437443946477509726e-01, 2.66912935433335718471e-01,
  61         2.89062532292519769328e-01, 2.81392462451501401688e-01,
  62         3.04687577351389293767e-01, 2.95751756530947318424e-01,
  63         3.20312405527377053183e-01, 3.09986305565206343715e-01,
  64         3.35937715576634265968e-01, 3.24092664204967739749e-01,
  65         3.51562621385942464247e-01, 3.38066230870244233131e-01,
  66         3.67187719833070636000e-01, 3.51904019130060419229e-01,
  67         3.82812538440931826589e-01, 3.65602365234580339859e-01,
  68         3.98437724467857745658e-01, 3.79158862748537828224e-01,
  69         4.14062683287296784407e-01, 3.92570291474021892952e-01,
  70         4.29687654458357937148e-01, 4.05834423459965343284e-01,
  71         4.45312642848883721847e-01, 4.18949086342842669239e-01,
  72         4.60937644536906665493e-01, 4.31912354681638355203e-01,
  73         4.76563149131543906112e-01, 4.44722952952162131623e-01,
  74         4.92187842452541601812e-01, 4.57378374341803173309e-01,
  75         5.15624825518001039804e-01, 4.76069192487019954285e-01,
  76         5.46874516057966109095e-01, 5.00440440618262982753e-01,
  77         5.78125566624434150675e-01, 5.24180053466007933594e-01,
  78         6.09375102172641347487e-01, 5.47284455493244337276e-01,
  79         6.40624936950189516338e-01, 5.69756408779493739303e-01,
  80         6.71875248719545625775e-01, 5.91599881698465779323e-01,
  81         7.03124988865964306584e-01, 6.12820194714659649549e-01,
  82         7.34376295967088421612e-01, 6.33426724884753156175e-01,
  83         7.65624929092156736310e-01, 6.53426296477277901431e-01,
  84         7.96874196003358736817e-01, 6.72832055855442590087e-01,
  85         8.28125565205639735389e-01, 6.91656957129326954714e-01,
  86         8.59375453355927021448e-01, 7.09911879233846576653e-01,
  87         8.90625694745052709500e-01, 7.27611720056701827275e-01,
  88         9.21875110259870345075e-01, 7.44770185320721367361e-01,
  89         9.53125042657123722201e-01, 7.61402792157321428590e-01,
  90         9.84374765277631902372e-01, 7.77524191164056688308e-01,
  91         1.03126494373528343473e+00, 8.00788807142382097481e-01,
  92         1.09374968909110092952e+00, 8.30144253291031475328e-01,
  93         1.15625019152505204012e+00, 8.57735575892430546219e-01,
  94         1.21874985186151341132e+00, 8.83672057048812575886e-01,
  95         1.28124876006842702836e+00, 9.08066349515326720621e-01,
  96         1.34375006271148444981e+00, 9.31026566320014126177e-01,
  97         1.40627222899692072566e+00, 9.52659566341466756967e-01,
  98         1.46874957658300542285e+00, 9.73037801091363618866e-01,
  99         1.53124999999999555911e+00, 9.92272112377190040888e-01,
 100         1.59375089676214143353e+00, 1.01043670320979472876e+00,
 101         1.65624949800269094524e+00, 1.02760661639661776690e+00,
 102         1.71874946971376685312e+00, 1.04385296549501305208e+00,
 103         1.78125111924655166185e+00, 1.05924046784549474864e+00,
 104         1.84374921332370989013e+00, 1.07382754310190620117e+00,
 105         1.90625055239083862624e+00, 1.08767078118685489585e+00,
 106         1.96874992734227549640e+00, 1.10081967347672460278e+00,
 107         2.06250046973591683042e+00, 1.11934332464931074469e+00,
 108         2.18749905173933534286e+00, 1.14201813543610697366e+00,
 109         2.31249933788800232648e+00, 1.16264711873167669864e+00,
 110         2.43749855191054187742e+00, 1.18147939634549814514e+00,
 111         2.56251104936881235474e+00, 1.19873002825057639598e+00,
 112         2.68750036758144528193e+00, 1.21457671610223272296e+00,
 113         2.81249907059852954916e+00, 1.22918073183895870670e+00,
 114         2.93749583903062294610e+00, 1.24267599964591468620e+00,
 115         3.06250108260464948273e+00, 1.25518076906426045980e+00,
 116         3.18750016629930410517e+00, 1.26679540235591403530e+00,
 117         3.31250071362610132297e+00, 1.27760948984166233799e+00,
 118         3.43749999999999333866e+00, 1.28770054149540058575e+00,
 119         3.56249877589327157423e+00, 1.29713691630583838332e+00,
 120         3.68750696071718842006e+00, 1.30597947372626776996e+00,
 121         3.81250023149192607264e+00, 1.31427972905173717777e+00,
 122         3.93749827850909683846e+00, 1.32208623339324304879e+00,
 123         4.12500187917697846984e+00, 1.33296050364557672196e+00,
 124         4.37499759905160701123e+00, 1.34608503917096200553e+00,
 125         4.62500066729278191957e+00, 1.35785800701782477518e+00,
 126         4.87499852385410648026e+00, 1.36847463881194641999e+00,
 127         5.12499918742110072145e+00, 1.37809553833018583191e+00,
 128         5.37500000000004529710e+00, 1.38685287025772296943e+00,
 129         5.62499999999991828759e+00, 1.39485670134236627860e+00,
 130         5.87499417854096694924e+00, 1.40219922327269230777e+00,
 131         6.12500000000013233858e+00, 1.40895889555647713109e+00,
 132         6.37499999999991828759e+00, 1.41520149881786494461e+00,
 133         6.62499933107761584949e+00, 1.42098385532083781868e+00,
 134         6.87500431528593747288e+00, 1.42635483782722261026e+00,
 135         7.12499228632883863099e+00, 1.43135612069194451124e+00,
 136         7.37499257154547205317e+00, 1.43602490820671135907e+00,
 137         7.62499911873607416624e+00, 1.44039300400460135165e+00,
 138         7.87500000000018918200e+00, 1.44448820973165936721e+00,
 139 };