#include "Atan.h"

#include <stdint.h>
#include <fenv.h>
#include <limits>

static const double atan_eighth_coeffs_low[128][8] = {
	{2.3158656769252482684e-13, 2.1534361111052781935e-17, -2.5296996938534819769e-08, 3.1404097582121295763e-18, 4.9735919716217286829e-03, -1.6384368483746724039e-37, 4.0056120047108912695e-21},
	{2.3148056901789530986e-13, 1.1579974231474541370e-12, -2.5294681048550810265e-08, -7.5888674811302815290e-08, 4.9735160817889374762e-03, -4.2686482301848676369e-19, 4.9735666748564021089e-03},
	{2.3126866222303496850e-13, 2.3154432633903996904e-12, -2.5287734376775937391e-08, -1.5176345516045608817e-07, 4.9732884261855592536e-03, -5.7038965588626565253e-19, 9.9469815746789577715e-03},
	{2.3095102829242877575e-13, 3.4718294777927776914e-12, -2.5276160102380014250e-08, -2.2761045293832463277e-07, 4.9729090464902207108e-03, -4.3240058951572183359e-19, 1.4920092952221691504e-02},
	{2.3052793839227276869e-13, 4.6266273941058899723e-12, -2.5259963520979585819e-08, -3.0341579275207704180e-07, 4.9723780121461048226e-03, 6.9712615851193319229e-19, 1.9892749115801650756e-02},
	{2.2999975349853675919e-13, 5.7793096960881309779e-12, -2.5239152040116146127e-08, -3.7916561826505329767e-07, 4.9716954203291811171e-03, -3.6084281033800221048e-19, 2.4864798457048638974e-02},
	{2.2936692390221207976e-13, 6.9293508726035631061e-12, -2.5213735172934304548e-08, -4.5484609852350559637e-07, 4.9708613959037603255e-03, 8.4170782414171452993e-19, 2.9836089478616822923e-02},
	{2.2862998859273926312e-13, 8.0762276642462857840e-12, -2.5183724530068556817e-08, -5.3044343426168378142e-07, 4.9698760913654245822e-03, 1.1385294940247436004e-18, 3.4806470821845604535e-02},
	{2.2778957452085233718e-13, 9.2194195068813809703e-12, -2.5149133809749827704e-08, -6.0594386417990775896e-07, 4.9687396867713617965e-03, -3.2504349420665137918e-18, 3.9775791294357099037e-02},
	{2.2684639574231751783e-13, 1.0358408971499438189e-11, -2.5109978786145265098e-08, -6.8133367119030522416e-07, 4.9674523896581874657e-03, 1.0508846224639702350e-18, 4.4743899897577675551e-02},
	{2.2580125244427978127e-13, 1.1492682199789031296e-11, -2.5066277295947246762e-08, -7.5659918862493911309e-07, 4.9660144349473033659e-03, 1.4029498401656991053e-18, 4.9710645854171141289e-02},
	{2.2465502985616076622e-13, 1.2621729334840085427e-11, -2.5018049223229933394e-08, -8.3172680640109705143e-07, 4.9644260848378876649e-03, -9.4759163437472045505e-19, 5.4675878635371009950e-02},
	{2.2340869704727897639e-13, 1.3745044946400809720e-11, -2.4965316482593921781e-08, -9.0670297713857854620e-07, 4.9626876286875936523e-03, -2.5057418042279750664e-18, 5.9639447988199659201e-02},
	{2.2206330561358183767e-13, 1.4862128450121721685e-11, -2.4908103000621980437e-08, -9.8151422222387543502e-07, 4.9607993828810759140e-03, 1.2917748011760968052e-18, 6.4601203962562081529e-02},
	{2.2061998825609292665e-13, 1.5972484520232221019e-11, -2.4846434695671013995e-08, -1.0561471378162180291e-06, 4.9587616906864402308e-03, -7.3846088809925218541e-19, 6.9560996938202127038e-02},
	{2.1907995725388377561e-13, 1.7075623495108226217e-11, -2.4780339456027576504e-08, -1.1305884007905346658e-06, 4.9565749220997403629e-03, 1.3713512439334065645e-18, 7.4518677651509157567e-02},
	{2.1744450283457817419e-13, 1.8171061775203409020e-11, -2.4709847116456467260e-08, -1.2048247746124606899e-06, 4.9542394736776657060e-03, 5.6674475463062163132e-18, 7.9474097222163350707e-02},
	{2.1571499144558775471e-13, 1.9258322212831601218e-11, -2.4634989433173924773e-08, -1.2788431151406199155e-06, 4.9517557683585412473e-03, -2.3590842991904814042e-18, 8.4427107179607802090e-02},
	{2.1389286392945861871e-13, 2.0336934493303987919e-11, -2.4555800057279071874e-08, -1.3526303763515072881e-06, 4.9491242552718028858e-03, 8.9449236023045309715e-19, 8.9377559489335803300e-02},
	{2.1197963360688241310e-13, 2.1406435506941545454e-11, -2.4472314506679084775e-08, -1.4261736159823942146e-06, 4.9463454095361077123e-03, -1.1264040336393123850e-18, 9.4325306578982026640e-02},
	{2.0997688427108790811e-13, 2.2466369711501002058e-11, -2.4384570136545530906e-08, -1.4994600010877986295e-06, 4.9434197320462397104e-03, 2.7893458118189217744e-18, 9.9270201364206056560e-02},
	{2.0788626809748286275e-13, 2.3516289484571130220e-11, -2.4292606108341146742e-08, -1.5724768135051679510e-06, 4.9403477492489930242e-03, 5.9497178644377929950e-18, 1.0421209727435741532e-01},
	{2.0570950347255884164e-13, 2.4555755465515628059e-11, -2.4196463357457924965e-08, -1.6452114552255514108e-06, 4.9371300129082218780e-03, -3.9339811552248329073e-18, 1.0915084827791098065e-01},
	{2.0344837274620488300e-13, 2.5584336886558789869e-11, -2.4096184559509233189e-08, -1.7176514536651530118e-06, 4.9337670998592410287e-03, -1.4706564682135449446e-18, 1.1408630890766208177e-01},
	{2.0110471991169688409e-13, 2.6601611892630981205e-11, -2.3991814095320089365e-08, -1.7897844668338005760e-06, 4.9302596117527944589e-03, 2.6720467902321030104e-18, 1.1901833428567087925e-01},
	{1.9868044821774124843e-13, 2.7607167849612298427e-11, -2.3883398014661290635e-08, -1.8615982883964872590e-06, 4.9266081747887831288e-03, -4.2842873553472224746e-18, 1.2394678014794546783e-01},
	{1.9617751771705041953e-13, 2.8600601640634557779e-11, -2.3770983998774491988e-08, -1.9330808526242901384e-06, 4.9228134394399903143e-03, 1.7002653674207939722e-18, 1.2887150286885368233e-01},
	{1.9359794275601615255e-13, 2.9581519950124332076e-11, -2.3654621321736618166e-08, -2.0042202392311125720e-06, 4.9188760801660100924e-03, -5.8888331159386452302e-18, 1.3379235948525383670e-01},
	{1.9094378941012291338e-13, 3.0549539535292439159e-11, -2.3534360810713262827e-08, -2.0750046780928380546e-06, 4.9147967951176209714e-03, 1.2978739099614535511e-18, 1.3870920772033440427e-01},
	{1.8821717286980887264e-13, 3.1504287484798557176e-11, -2.3410254805151757959e-08, -2.1454225538456423308e-06, 4.9105763058318483913e-03, 1.3560754872222811115e-18, 1.4362190600715360467e-01},
	{1.8542025478153530178e-13, 3.2445401464343248705e-11, -2.3282357114965807560e-08, -2.2154624103603600240e-06, 4.9062153569179442134e-03, 1.3796190558230810639e-17, 1.4853031351186929410e-01},
	{1.8255524054886640113e-13, 3.3372529948963295652e-11, -2.3150722977764314125e-08, -2.2851129550899553534e-06, 4.9017147157345520789e-03, -1.1524295069041734015e-17, 1.5343429015665061010e-01},
	{1.7962437659839183134e-13, 3.4285332441830561393e-11, -2.3015409015178072023e-08, -2.3543630632873150718e-06, 4.8970751720583006322e-03, 1.2166445532214648423e-17, 1.5833369664226215612e-01},
	{1.7662994761534219348e-13, 3.5183479679378410425e-11, -2.2876473188338604061e-08, -2.4232017820907348564e-06, 4.8922975377440969594e-03, 2.6379809287036182236e-18, 1.6322839447031312066e-01},
	{1.7357427375375477074e-13, 3.6066653822604279154e-11, -2.2733974752564161970e-08, -2.4916183344746389467e-06, 4.8873826463773830525e-03, -9.9436318091606231079e-18, 1.6811824596516206087e-01},
	{1.7045970782604184694e-13, 3.6934548634421076639e-11, -2.2587974211308414493e-08, -2.5596021230632396871e-06, 4.8823313529186267851e-03, -4.2209237339308054966e-18, 1.7300311429547043929e-01},
	{1.6728863247679798797e-13, 3.7786869642954521769e-11, -2.2438533269427849663e-08, -2.6271427338050032975e-06, 4.8771445333403223507e-03, -1.3787362596358920578e-17, 1.7788286349539680908e-01},
	{1.6406345734565631833e-13, 3.8623334290707479284e-11, -2.2285714785824258679e-08, -2.6942299395059711565e-06, 4.8718230842567872632e-03, -8.3824990890890976656e-18, 1.8275735848542420947e-01},
	{1.6078661622396489917e-13, 3.9443672069536745973e-11, -2.2129582725518946695e-08, -2.7608537032201379222e-06, 4.8663679225470343401e-03, 1.2614390082637134856e-17, 1.8762646509281408203e-01},
	{1.5746056421000738663e-13, 4.0247624641411235440e-11, -2.1970202111215441589e-08, -2.8270041814952728915e-06, 4.8607799849709996953e-03, 1.1574491730619903250e-17, 1.9249005007167963033e-01},
	{1.5408777486743239767e-13, 4.1034945944944420564e-11, -2.1807638974407637211e-08, -2.8926717274727332095e-06, 4.8550602277794372569e-03, -7.7020523772156529484e-18, 1.9734798112267212811e-01},
	{1.5067073739148795400e-13, 4.1805402287717066725e-11, -2.1641960306090224878e-08, -2.9578468938399903301e-06, 4.8492096263177512927e-03, -8.4722693022497282456e-18, 2.0220012691227415291e-01},
	{1.4721195378757934710e-13, 4.2558772424429327167e-11, -2.1473234007128147789e-08, -3.0225204356347618109e-06, 4.8432291746240757266e-03, -1.0632006052920365867e-17, 2.0704635709169383340e-01},
	{1.4371393606658089412e-13, 4.3294847620943806055e-11, -2.1301528838341654204e-08, -3.0866833128998120461e-06, 4.8371198850218934118e-03, -1.3074834734093199481e-17, 2.1188654231535425376e-01},
	{1.4017920346123617998e-13, 4.4013431704303483443e-11, -2.1126914370363217511e-08, -3.1503266931876502908e-06, 4.8308827877074972043e-03, -6.7852100435297557872e-18, 2.1672055425897296388e-01},
	{1.3661027966787634198e-13, 4.4714341098829948294e-11, -2.0949460933322217445e-08, -3.2134419539145283950e-06, 4.8245189303325920760e-03, -8.6932638167343771562e-18, 2.2154826563722651578e-01},
	{1.3300969011757324142e-13, 4.5397404848428536953e-11, -2.0769239566412757230e-08, -3.2760206845633041429e-06, 4.8180293775823366392e-03, 5.2563932548808394154e-18, 2.2636955022099519708e-01},
	{1.2937995928072405545e-13, 4.6062464625247654004e-11, -2.0586321967399577822e-08, -3.3380546887348991473e-06, 4.8114152107491354668e-03, -2.2774770695330071091e-18, 2.3118428285418382573e-01},
	{1.2572360800893634270e-13, 4.6709374724859501697e-11, -2.0400780442116229758e-08, -3.3995359860482509246e-06, 4.8046775273024788441e-03, -8.2263427705633583796e-18, 2.3599233947011410972e-01},
	{1.2204315091794796193e-13, 4.7338002048148701944e-11, -2.0212687854009093957e-08, -3.4604568138888167499e-06, 4.7978174404551300614e-03, 3.1496247385196498852e-18, 2.4079359710748518553e-01},
	{1.1834109381517690362e-13, 4.7948226070114100303e-11, -2.0022117573779992534e-08, -3.5208096290058402032e-06, 4.7908360787259707606e-03, 5.1850128410598930124e-18, 2.4558793392589861604e-01},
	{1.1461993117534862186e-13, 4.8539938795806974398e-11, -1.9829143429179290230e-08, -3.5805871089587628406e-06, 4.7837345854998044453e-03, 6.9522012847481338429e-18, 2.5037522922094457289e-01},
	{1.1088214366749877191e-13, 4.9113044703646046140e-11, -1.9633839655000450724e-08, -3.6397821534133023417e-06, 4.7765141185844104538e-03, 1.6251732377579494033e-17, 2.5515536343884653858e-01},
	{1.0713019573649162596e-13, 4.9667460676366234260e-11, -1.9436280843326029375e-08, -3.6983878852878789929e-06, 4.7691758497651641144e-03, 1.5225871180269482085e-17, 2.5992821819066180833e-01},
	{1.0336653324203612414e-13, 5.0203115919873916428e-11, -1.9236541894074041719e-08, -3.7563976517512197524e-06, 4.7617209643575075795e-03, -1.2928615670349938058e-17, 2.6469367626603546029e-01},
	{9.9593581158016084700e-14, 5.0719951870296029897e-11, -1.9034697965892455886e-08, -3.8138050250721110200e-06, 4.7541506607575757803e-03, 2.4639080181965870792e-17, 2.6945162164650576786e-01},
	{9.5813741334785360540e-14, 5.1217922089524912211e-11, -1.8830824427448488403e-08, -3.8706038033224173490e-06, 4.7464661499912646006e-03, 1.4717695302509477959e-17, 2.7420193951835986068e-01},
	{9.2029390326908297385e-14, 5.1696992149573533722e-11, -1.8624996809158026248e-08, -3.9267880109346150490e-06, 4.7386686552620500487e-03, -1.0239709138237778439e-17, 2.7894451628503713625e-01},
	{8.8242877288654735721e-14, 5.2157139506068607891e-11, -1.8417290755399346618e-08, -3.9823518991152298145e-06, 4.7307594114978247096e-03, -2.3757913165347803703e-17, 2.8367923957908047772e-01},
	{8.4456521939384882984e-14, 5.2598353361220296921e-11, -1.8207781977253850007e-08, -4.0372899461156962621e-06, 4.7227396648970559195e-03, 1.1321348049890709517e-17, 2.8840599827363377905e-01},
	{8.0672612600785075879e-14, 5.3020634516618125756e-11, -1.7996546205815205323e-08, -4.0915968573622826202e-06, 4.7146106724745449543e-03, 7.8550238953329020538e-18, 2.9312468249348555549e-01},
	{7.6893404307740199354e-14, 5.3423995216212320570e-11, -1.7783659146106935992e-08, -4.1452675654468470586e-06, 4.7063737016070595828e-03, -1.5217453609296245167e-17, 2.9783518362565786219e-01},
	{7.3121116994452909368e-14, 5.3808458979848938535e-11, -1.7569196431646877828e-08, -4.1982972299803026825e-06, 4.6980300295791314197e-03, 1.4920967192658588647e-17, 3.0253739432954118715e-01},
	{6.9357933757244856185e-14, 5.4174060427735065561e-11, -1.7353233579695629254e-08, -4.2506812373107978126e-06, 4.6895809431292730801e-03, 1.6368711022622260305e-17, 3.0723120854657548495e-01},
	{6.5605999195300305991e-14, 5.4520845096217473776e-11, -1.7135845947224453437e-08, -4.3024152001087096514e-06, 4.6810277379968996334e-03, 6.3209346853261319236e-18, 3.1191652150947729583e-01},
	{6.1867417830439551921e-14, 5.4848869245264657456e-11, -1.6917108687636616229e-08, -4.3534949568206663271e-06, 4.6723717184702067556e-03, -1.8395361268814438143e-17, 3.1659322975101461539e-01},
	{5.8144252606837496095e-14, 5.5158199658047348946e-11, -1.6697096708274535768e-08, -4.4039165709949003980e-06, 4.6636141969352735981e-03, 1.7908006108409984051e-17, 3.2126123111233001461e-01},
	{5.4438523471432869885e-14, 5.5448913433017398221e-11, -1.6475884628743584331e-08, -4.4536763304803410842e-06, 4.6547564934266349654e-03, -6.2971179809582735001e-18, 3.2592042475081395292e-01},
	{5.0752206035606586225e-14, 5.5721097768888479906e-11, -1.6253546740081725379e-08, -4.5027707465019473624e-06, 4.6457999351795916873e-03, -1.4854923151332813236e-17, 3.3057071114752883956e-01},
	{4.7087230318542334620e-14, 5.5974849742925044848e-11, -1.6030156964802540837e-08, -4.5511965526148391169e-06, 4.6367458561844768911e-03, 1.6732651971230405222e-17, 3.3521199211418700736e-01},
	{4.3445479572521444158e-14, 5.6210276082948040070e-11, -1.5805788817837641917e-08, -4.5989507035399173690e-06, 4.6275955967431444543e-03, -1.7756662329604295209e-17, 3.3984417079968387565e-01},
	{3.9828789190245491369e-14, 5.6427492933467038911e-11, -1.5580515368402756148e-08, -4.6460303738836747746e-06, 4.6183505030279008163e-03, 1.0359635746052492860e-17, 3.4446715169618835617e-01},
	{3.6238945694125746569e-14, 5.6626625616349108178e-11, -1.5354409202810145412e-08, -4.6924329567450331015e-06, 4.6090119266431021916e-03, 4.6077227854699910437e-18, 3.4908084064479433239e-01},
	{3.2677685807328094450e-14, 5.6807808386434189828e-11, -1.5127542388248424949e-08, -4.7381560622120520249e-06, 4.5995812241896591802e-03, -2.2264148159377139842e-17, 3.5368514484073437787e-01},
	{2.9146695606215809866e-14, 5.6971184182505908751e-11, -1.4899986437549165813e-08, -4.7831975157514628434e-06, 4.5900597568326508696e-03, 2.3278903544210397537e-17, 3.5827997283815987695e-01},
	{2.5647609753691070218e-14, 5.7116904374024798893e-11, -1.4671812274958027123e-08, -4.8275553564939968144e-06, 4.5804488898722644022e-03, -1.9382913529632845642e-17, 3.6286523455449071207e-01},
	{2.2182010812799142720e-14, 5.7245128504028535982e-11, -1.4443090202926587829e-08, -4.8712278354185591198e-06, 4.5707499923182664386e-03, 1.9130078176438598699e-18, 3.6744084127433673803e-01},
	{1.8751428639827378825e-14, 5.7356024028600546860e-11, -1.4213889869939388398e-08, -4.9142134134383257352e-06, 4.5609644364682042778e-03, -1.0069085495948943465e-17, 3.7200670565299670534e-01},
	{1.5357339856004526418e-14, 5.7449766053304475089e-11, -1.3984280239389126139e-08, -4.9565107593918904453e-06, 4.5510935974895309203e-03, 1.3176888418712216091e-17, 3.7656274171953635355e-01},
	{1.2001167396784542008e-14, 5.7526537066977607498e-11, -1.3754329559511343164e-08, -4.9981187479426265234e-06, 4.5411388530058405602e-03, -2.1109576891854844531e-18, 3.8110886487945139223e-01},
	{8.6842801375832725057e-15, 5.7586526673271144748e-11, -1.3524105334388415688e-08, -5.0390364573894521521e-06, 4.5311015826873923124e-03, 1.1045682765283412785e-17, 3.8564499191691825608e-01},
	{5.4079925947262858447e-15, 5.7629931320319770639e-11, -1.3293674296031065194e-08, -5.0792631673922191576e-06, 4.5209831678460999857e-03, 1.6719141600656380103e-17, 3.9017104099663812988e-01},
	{2.1735647002616163550e-15, 5.7656954028916447874e-11, -1.3063102377544151174e-08, -5.1187983566149810542e-06, 4.5107849910351544356e-03, -9.2856668261277400238e-18, 3.9468693166527790694e-01},
	{-1.0177983508073350350e-15, 5.7667804119561918627e-11, -1.2832454687381968278e-08, -5.1576417002903786029e-06, 4.5005084356534389572e-03, -6.0088974338067585957e-19, 3.9919258485251318813e-01},
	{-4.1649461824062165281e-15, 5.7662696938751034044e-11, -1.2601795484696836342e-08, -5.1957930677084437741e-06, 4.4901548855548860384e-03, 6.3701017823813334770e-18, 4.0368792287167842847e-01},
	{-7.2667832500157002316e-15, 5.7641853584850282057e-11, -1.2371188155783315960e-08, -5.2332525196330789547e-06, 4.4797257246629420060e-03, -1.2080252167735519597e-17, 4.0817286942002867223e-01},
	{-1.0322268785744020295e-14, 5.7605500633912927663e-11, -1.2140695191619010772e-08, -5.2700203056495283809e-06, 4.4692223365902531904e-03, -2.7331322009910888239e-17, 4.1264734957861842757e-01},
	{-1.3330416677625857614e-14, 5.7553869865769559131e-11, -1.1910378166501509798e-08, -5.3060968614461028739e-06, 4.4586461042637349356e-03, -1.9182987101376110206e-17, 4.1711128981180300990e-01},
	{-1.6290295284996199786e-14, 5.7487197990722825013e-11, -1.1680297717779736040e-08, -5.3414828060334655415e-06, 4.4479984095551362150e-03, 2.5445966635447451531e-17, 4.2156461796636762740e-01},
	{-1.9201027191850594364e-14, 5.7405726377166164205e-11, -1.1450513526676625906e-08, -5.3761789389047496881e-06, 4.4372806329172221479e-03, 1.9106931037864796402e-17, 4.2600726327028992646e-01},
	{-2.2061788900160207492e-14, 5.7309700780436502092e-11, -1.1221084300198829832e-08, -5.4101862371397725488e-06, 4.4264941530256993185e-03, -8.6377466472901250371e-18, 4.3043915633114127051e-01},
	{-2.4871810465161101634e-14, 5.7199371073201231000e-11, -1.0992067754127910199e-08, -5.4435058524566033860e-06, 4.4156403464269810416e-03, 2.4521631135189295868e-17, 4.3486022913413313606e-01},
	{-2.7630375074682411726e-14, 5.7074990977669556890e-11, -1.0763520597086304944e-08, -5.4761391082137207654e-06, 4.4047205871918983927e-03, -2.4773235395450683853e-17, 4.3927041503981445469e-01},
	{-3.0336818574617685704e-14, 5.6936817799908115973e-11, -1.0535498515670208581e-08, -5.5080874963659709611e-06, 4.3937362465754593518e-03, -1.8967399864947940253e-17, 4.4366964878142489681e-01},
	{-3.2990528942677510131e-14, 5.6785112166530031007e-11, -1.0308056160640415563e-08, -5.5393526743775097927e-06, 4.3826886926827367252e-03, 1.2468148050875444369e-17, 4.4805786646191192446e-01},
	{-3.5590945712589992669e-14, 5.6620137764016191999e-11, -1.0081247134161122084e-08, -5.5699364620948941030e-06, 4.3715792901409655097e-03, -1.8775791715155518145e-17, 4.5243500555061627599e-01},
	{-3.8137559350938619565e-14, 5.6442161080916340371e-11, -9.8551239780756450886e-09, -5.5998408385834518163e-06, 4.3604093997779399053e-03, -3.5751160696176961827e-18, 4.5680100487963254396e-01},
	{-4.0629910588844885036e-14, 5.6251451153166917971e-11, -9.6297381632070875476e-09, -5.6290679389300146251e-06, 4.3491803783067654876e-03, -9.6930975241613182121e-18, 4.6115580463985195170e-01},
	{-4.3067589710715433556e-14, 5.6048279312751365530e-11, -9.4051400796710261300e-09, -5.6576200510150727861e-06, 4.3378935780170428671e-03, 3.0296120243554624753e-19, 4.6549934637669243553e-01},
	{-4.5450235802281499244e-14, 5.5832918939917633801e-11, -9.1813790281864106546e-09, -5.6854996122573767825e-06, 4.3265503464725244692e-03, 1.3194541207392282504e-17, 4.6983157298552358228e-01},
	{-4.7777535960160771085e-14, 5.5605645219156367945e-11, -8.9585032123700656640e-09, -5.7127092063339419961e-06, 4.3151520262153224977e-03, -2.5366712362847814158e-18, 4.7415242870679230602e-01},
	{-5.0049224465170424291e-14, 5.5366734899132213926e-11, -8.7365597319993407322e-09, -5.7392515598783981355e-06, 4.3036999544766845610e-03, 2.1997995391071141313e-17, 4.7846185912085592573e-01},
	{-5.2265081921613330703e-14, 5.5116466056749418835e-11, -8.5155945772267530113e-09, -5.7651295391605599427e-06, 4.2921954628943994117e-03, 1.4063514186535974068e-17, 4.8275981114252969340e-01},
	{-5.4424934364749199664e-14, 5.4855117865521975725e-11, -8.2956526237297524988e-09, -5.7903461467500406479e-06, 4.2806398772368596875e-03, 2.3764707611844840668e-17, 4.8704623301535454605e-01},
	{-5.6528652338647260932e-14, 5.4582970368407202727e-11, -8.0767776287780456708e-09, -5.8149045181667093066e-06, 4.2690345171338111435e-03, 6.7633236007503528755e-18, 4.9132107430559274208e-01},
	{-5.8576149946598736557e-14, 5.4300304255250996244e-11, -7.8590122282003572629e-09, -5.8388079185206889752e-06, 4.2573806958138048565e-03, -4.7753916624983356454e-18, 4.9558428589595721059e-01},
	{-6.0567383876244679904e-14, 5.4007400644981921582e-11, -7.6423979342319061389e-09, -5.8620597391445918291e-06, 4.2456797198483922987e-03, -6.4452209399969692121e-18, 4.9983581997908199668e-01},
	{-6.2502352401548746570e-14, 5.3704540872680441159e-11, -7.4269751342233269010e-09, -5.8846634942205890741e-06, 4.2339328889030433331e-03, -4.9751213552854857290e-17, 5.0407563005074018658e-01},
	{-6.4381094363715141511e-14, 5.3392006281639182502e-11, -7.2127830901913395912e-09, -5.9066228174048762312e-06, 4.2221414954948287626e-03, -5.4546090856903826815e-17, 5.0830367090281591835e-01},
	{-6.6203688133119561400e-14, 5.3070078020519446617e-11, -6.9998599391909619415e-09, -5.9279414584520274603e-06, 4.2103068247568474838e-03, -3.8080208388927406056e-17, 5.1251989861603786114e-01},
	{-6.7970250554284878180e-14, 5.2739036845698875701e-11, -6.7882426944887128720e-09, -5.9486232798416741424e-06, 4.1984301542093982462e-03, -4.9843554878403859117e-18, 5.1672427055248015826e-01},
	{-6.9680935875895703208e-14, 5.2399162928895020964e-11, -6.5779672475158655036e-09, -5.9686722534098768709e-06, 4.1865127535379072915e-03, 3.1613709018507724732e-17, 5.2091674534783805051e-01},
	{-7.1335934667804597202e-14, 5.2050735670139644579e-11, -6.3690683705804977631e-09, -5.9880924569875024061e-06, 4.1745558843775728425e-03, 2.8881361433332354734e-17, 5.2509728290348478552e-01},
	{-7.2935472726939423775e-14, 5.1694033516168766963e-11, -6.1615797203168057590e-09, -6.0068880710478476879e-06, 4.1625608001047307780e-03, -4.5482847651068589278e-17, 5.2926584437831647456e-01},
	{-7.4479809973975981667e-14, 5.1329333784283893426e-11, -5.9555338418499168061e-09, -6.0250633753656911699e-06, 4.1505287456349128708e-03, 4.2504255671842281583e-17, 5.3342239218039144699e-01},
	{-7.5969239342592555056e-14, 5.0956912491730645369e-11, -5.7509621736542172944e-09, -6.0426227456898780460e-06, 4.1384609572275741704e-03, -4.7677527080233541851e-17, 5.3756688995837209610e-01},
	{-7.7404085663073405129e-14, 5.0577044190631773584e-11, -5.5478950530830534294e-09, -6.0595706504315078244e-06, 4.1263586622974600393e-03, 4.4404911542499147776e-17, 5.4169930259277265794e-01},
	{-7.8784704541977713761e-14, 5.0190001808502903982e-11, -5.3463617225475371428e-09, -6.0759116473696707296e-06, 4.1142230792325781494e-03, -4.0144422463012884564e-17, 5.4581959618702435844e-01},
	{-8.0111481239537579664e-14, 4.9796056494370544960e-11, -5.1463903363220794566e-09, -6.0916503803766861911e-06, 4.1020554172187398759e-03, -1.7607275616722521095e-17, 5.4992773805835903911e-01},
	{-8.1384829546395264643e-14, 4.9395477470503801243e-11, -4.9480079679542313971e-09, -6.1067915761646509871e-06, 4.0898568760706311906e-03, -3.6611262595214259463e-17, 5.5402369672852302962e-01},
	{-8.2605190661235033356e-14, 4.8988531889762967189e-11, -4.7512406182563620969e-09, -6.1213400410551113877e-06, 4.0776286460693688188e-03, -1.4873083597338430909e-17, 5.5810744191432359873e-01},
	{-8.3773032070809053401e-14, 4.8575484698560605182e-11, -4.5561132238567227501e-09, -6.1353006577735457399e-06, 4.0653719078064922202e-03, 7.8082161226731320854e-18, 5.6217894451801719846e-01},
	{-8.4888846433800340082e-14, 4.8156598505423050365e-11, -4.3626496662874616264e-09, -6.1486783822703125975e-06, 4.0530878320343341481e-03, 2.6082579077450135284e-17, 5.6623817661754438646e-01},
	{-8.5953150469908692436e-14, 4.7732133455133142061e-11, -4.1708727815872488239e-09, -6.1614782405696432645e-06, 4.0407775795227316232e-03, -1.2483796966782476764e-17, 5.7028511145661853199e-01},
	{-8.6966483855487784599e-14, 4.7302347108428067556e-11, -3.9808043703962083179e-09, -6.1737053256481822354e-06, 4.0284423009220035952e-03, 1.6018127889239175440e-18, 5.7431972343467407871e-01},
	{-8.7929408127003680517e-14, 4.6867494327219534730e-11, -3.7924652085210318755e-09, -6.1853647943445281957e-06, 4.0160831366321406502e-03, -2.3441281644945103200e-17, 5.7834198809668146968e-01},
	{-8.8842505593527194418e-14, 4.6427827165297085864e-11, -3.6058750579482474342e-09, -6.1964618643011435379e-06, 4.0037012166781460465e-03, -2.0364644674742422707e-17, 5.8235188212283361953e-01},
	{-8.9706378259413739858e-14, 4.5983594764469471276e-11, -3.4210526782838039591e-09, -6.2070018109399503788e-06, 3.9912976605914560896e-03, -1.6210731826996749642e-18, 5.8634938331811137235e-01}
};

static const double atan_eighth_coeffs_high[64][8] = {
	{-2.9091124615448302711e-12, 7.2858161167106326010e-10, -2.5904139342049244640e-08, -2.4867959854723912497e-05, 7.9577471545944772346e-03, 4.8396095239860734317e-17, 5.9033447060173305232e-01},
	{-2.9551986094227041222e-12, 7.1403360654547137164e-10, -2.3018930907737327011e-08, -2.4941329874560891789e-05, 7.9079364222473472884e-03, -1.3648602608839915107e-17, 5.9826732461800602447e-01},
	{-2.9953588184231289549e-12, 6.9925524187686217559e-10, -2.0192371898783095743e-08, -2.5006132017976782044e-05, 7.8579875470634642787e-03, -5.2937015560277326021e-17, 6.0615029740252635015e-01},
	{-3.0297717397311505877e-12, 6.8427615006701471119e-10, -1.7425324598158689109e-08, -2.5062543556145136758e-05, 7.8079174879555849481e-03, -3.7458321231861637694e-17, 6.1398325932145980666e-01},
	{-3.0586221945045337186e-12, 6.6912506986205150734e-10, -1.4718534549341007380e-08, -2.5110744171080577630e-05, 7.7577428468249033655e-03, -3.6032067517189329158e-17, 6.2176609752178102486e-01},
	{-3.0821002084833552227e-12, 6.5382981551778942947e-10, -1.2072634192070981660e-08, -2.5150915610843946910e-05, 7.7074798640859873769e-03, 2.7082869698848351368e-17, 6.2949871557196668270e-01},
	{-3.1004000851948993076e-12, 6.3841725079294992047e-10, -9.4881466118200444179e-09, -2.5183241355830089658e-05, 7.6571444148702703589e-03, 3.7998515458536695263e-17, 6.3718103309855533833e-01},
	{-3.1137195197829431119e-12, 6.2291326757708713262e-10, -6.9654893840394842361e-09, -2.5207906296450800733e-05, 7.6067520058856205947e-03, 1.7981455177645671693e-17, 6.4481298541924003676e-01},
	{-3.1222587550938615680e-12, 6.0734276894995462510e-10, -4.5049784950610305276e-09, -2.5225096422469885646e-05, 7.5563177729089398699e-03, -7.2099364672234136690e-18, 6.5239452317313939567e-01},
	{-3.1262197812760122216e-12, 5.9172965646087881642e-10, -2.1068323223461992158e-09, -2.5234998524194148368e-05, 7.5058564788882502217e-03, -2.3213491555724139870e-17, 6.5992561194886789622e-01},
	{-3.1258055797948738488e-12, 5.7609682141043249247e-10, 2.2882434235994899126e-10, -2.5237799905673422512e-05, 7.4553825126304268042e-03, 3.1309143544271815787e-17, 6.6740623191100301170e-01},
	{-3.1212194124353304369e-12, 5.6046613991220118773e-10, 2.5019562425353728007e-09, -2.5233688110014827077e-05, 7.4049098880504182416e-03, -5.5908716204048322905e-18, 6.7483637742552315952e-01},
	{-3.1126641555549432775e-12, 5.4485847150958551686e-10, 4.7126135937182554260e-09, -2.5222850656871026947e-05, 7.3544522439576787490e-03, 1.5366030372193450272e-17, 6.8221605668476470452e-01},
	{-3.1003416795684351714e-12, 5.2929366112127486450e-10, 6.8609280214425137300e-09, -2.5205474792119608198e-05, 7.3040228443554270146e-03, 2.7895298857389367599e-18, 6.8954529133242492556e-01},
	{-3.0844522733839753949e-12, 5.1379054408913485776e-10, 8.9471085131341396875e-09, -2.5181747249710772878e-05, 7.2536345792283745890e-03, 3.0198779073078668455e-17, 6.9682411608910954648e-01},
	{-3.0651941132761269880e-12, 4.9836695410366035478e-10, 1.0971437395928813799e-08, -2.5151854025623329107e-05, 7.2032999657946333166e-03, -4.8328697969067610093e-17, 7.0405257837890289352e-01},
	{-3.0427627754681465010e-12, 4.8303973378472710663e-10, 1.2934266351477106262e-08, -2.5115980163834308712e-05, 7.1530311501976830829e-03, 2.4948894682408798789e-17, 7.1123073795741098557e-01},
	{-3.0173507915071919745e-12, 4.6782474769902456390e-10, 1.4836012477921902911e-08, -2.5074309554175872348e-05, 7.1028399096144875791e-03, -3.1719075616832387592e-17, 7.1835866654170821288e-01},
	{-2.9891472453492695678e-12, 4.5273689760014170420e-10, 1.6677154408367488386e-08, -2.5027024741923685312e-05, 7.0527376547561363568e-03, -2.7291836076581811654e-17, 7.2543644744258839463e-01},
	{-2.9583374109256061120e-12, 4.3779013968270199361e-10, 1.8458228494314503721e-08, -2.4974306748934431741e-05, 7.0027354327377297136e-03, 5.3181981416954037915e-17, 7.3246417519950468566e-01},
	{-2.9251024288376635702e-12, 4.2299750364809419992e-10, 2.0179825061712967499e-08, -2.4916334906125896183e-05, 6.9528439302946045894e-03, 4.5184244214860632265e-18, 7.3944195521855382580e-01},
	{-2.8896190207232510633e-12, 4.0837111338611759321e-10, 2.1842584746489291552e-08, -2.4853286697071218578e-05, 6.9030734773224558878e-03, -2.5176311426837283706e-17, 7.4636990341383979697e-01},
	{-2.8520592397500227797e-12, 3.9392220908415368225e-10, 2.3447194915635132067e-08, -2.4785337612459650220e-05, 6.8534340507193517236e-03, -1.7039599083134770880e-17, 7.5324814585253141441e-01},
	{-2.8125902556240029810e-12, 3.7966117058320400183e-10, 2.4994386179207894848e-08, -2.4712661015158892666e-05, 6.8039352785081814654e-03, -4.3445916126384329258e-17, 7.6007681840390339811e-01},
	{-2.7713741724484464120e-12, 3.6559754180820028636e-10, 2.6484928997886099369e-08, -2.4635428015599129424e-05, 6.7545864442186158080e-03, -1.5750699849926220561e-17, 7.6685606639263115270e-01},
	{-2.7285678777312016878e-12, 3.5174005610832322881e-10, 2.7919630390049264566e-08, -2.4553807357186012433e-05, 6.7053964915082088852e-03, 4.0710228196444379259e-17, 7.7358604425658927806e-01},
	{-2.6843229208155559035e-12, 3.3809666235158060798e-10, 2.9299330741711807651e-08, -2.4467965311438840396e-05, 6.6563740290029108082e-03, 3.6170805403320632313e-17, 7.8026691520938218360e-01},
	{-2.6387854189991706793e-12, 3.2467455162652559395e-10, 3.0624900722034805465e-08, -2.4378065582541156946e-05, 6.6075273353378262756e-03, 2.3135751622831523556e-17, 7.8689885090781674926e-01},
	{-2.5920959896069678977e-12, 3.1148018441267756051e-10, 3.1897238306568296350e-08, -2.4284269220983668142e-05, 6.5588643643797366403e-03, -1.0773962021797669613e-18, 7.9348203112450854668e-01},
	{-2.5443897062955715306e-12, 2.9851931808988248012e-10, 3.3117265909840420230e-08, -2.4186734545973730733e-05, 6.5103927506135056413e-03, -1.2053412170749258449e-17, 8.0001664342579370537e-01},
	{-2.4957960778880567649e-12, 2.8579703466546521780e-10, 3.4285927628407761385e-08, -2.4085617076281576571e-05, 6.4621198146751811578e-03, -1.3511250478258645424e-17, 8.0650288285510207675e-01},
	{-2.4464390480672045312e-12, 2.7331776860653586798e-10, 3.5404186595013855033e-08, -2.3981069469190799181e-05, 6.4140525690152393884e-03, 2.1170612716715009403e-17, 8.1294095162192980819e-01},
	{-2.3964370142922226349e-12, 2.6108533467317414347e-10, 3.6473022444068694604e-08, -2.3873241467219412181e-05, 6.3661977236761082763e-03, 1.8167433268632691638e-17, 8.1933105879653378434e-01},
	{-2.3459028643469553340e-12, 2.4910295565639245475e-10, 3.7493428888261621903e-08, -2.3762279852277596074e-05, 6.3185616921687471140e-03, -4.0580636828450027393e-17, 8.2567342001045407329e-01},
	{-2.2949440289760999015e-12, 2.3737328993274179192e-10, 3.8466411405751066438e-08, -2.3648328406929598479e-05, 6.2711505974337618252e-03, 2.8241306465530366838e-17, 8.3196825716295641495e-01},
	{-2.2436625491189488580e-12, 2.2589845875514219453e-10, 3.9392985037037990598e-08, -2.3531527882429231465e-05, 6.2239702778731607891e-03, 4.9348815745182836367e-18, 8.3821579813347302235e-01},
	{-2.1921551563069163796e-12, 2.1468007320697365512e-10, 4.0274172290322470748e-08, -2.3412015973201696201e-05, 6.1770262934395386845e-03, -5.4499560849847412387e-17, 8.4441627650010364636e-01},
	{-2.1405133648508275670e-12, 2.0371926075363410502e-10, 4.1111001153865943936e-08, -2.3289927297448402099e-05, 6.1303239317701289576e-03, 5.4023048585622834787e-17, 8.5056993126423008356e-01},
	{-2.0888235745059239934e-12, 1.9301669133264047821e-10, 4.1904503213631589891e-08, -2.3165393383556309622e-05, 6.0838682143537752695e-03, -4.3593942524771442315e-17, 8.5667700658128276281e-01},
	{-2.0371671823661837869e-12, 1.8257260292991076960e-10, 4.2655711874253117440e-08, -2.3038542661998868906e-05, 6.0376639027195566287e-03, -3.8037064526738827494e-17, 8.6273775149768405779e-01},
	{-1.9856207028042200015e-12, 1.7238682659610672794e-10, 4.3365660681185057695e-08, -2.2909500462421667378e-05, 5.9917155046363612322e-03, 2.3047916565169800128e-17, 8.6875241969398886432e-01},
	{-1.9342558943382503530e-12, 1.6245881086283610211e-10, 4.4035381741714977519e-08, -2.2778389015612763918e-05, 5.9460272803133666988e-03, 5.0957934709639697689e-17, 8.7472126923422466316e-01},
	{-1.8831398923728898148e-12, 1.5278764552410517818e-10, 4.4665904242368386491e-08, -2.2645327460064744582e-05, 5.9006032485919290842e-03, 2.7753081918595782455e-17, 8.8064456232142873660e-01},
	{-1.8323353468254124665e-12, 1.4337208475367910694e-10, 4.5258253060109202013e-08, -2.2510431852843192080e-05, 5.8554471931200040985e-03, 4.9090827489653108187e-17, 8.8652256505936932740e-01},
	{-1.7819005637132898141e-12, 1.3421056953394819373e-10, 4.5813447464631103717e-08, -2.2373815184484257212e-05, 5.8105626685007513016e-03, 3.4645001175526951387e-17, 8.9235554722042931264e-01},
	{-1.7318896498418732021e-12, 1.2530124937651959976e-10, 4.6332499908946639694e-08, -2.2235587397652162111e-05, 5.7659530064075384392e-03, -1.9853787293791010365e-18, 8.9814378201962175030e-01},
	{-1.6823526597928177081e-12, 1.1664200331905785384e-10, 4.6816414905410497767e-08, -2.2095855409296077818e-05, 5.7216213216580904394e-03, 1.9834740690303218536e-17, 9.0388754589470088341e-01},
	{-1.6333357444739405074e-12, 1.0823046018689513081e-10, 4.7266187984259323597e-08, -2.1954723136054424525e-05, 5.6775705182410393310e-03, -4.9773339170913082460e-17, 9.0958711829232430368e-01},
	{-1.5848813005495094006e-12, 1.0006401811162710038e-10, 4.7682804731711980320e-08, -2.1812291522663458773e-05, 5.6338032952886127336e-03, 3.0956236724053161855e-17, 9.1524278146021431635e-01},
	{-1.5370281201262616182e-12, 9.2139863302314683823e-11, 4.8067239904649745930e-08, -2.1668658573135953150e-05, 5.5903221529897077074e-03, -5.0940397457713669890e-17, 9.2085482024526421618e-01},
	{-1.4898115401246456680e-12, 8.4454988068034765526e-11, 4.8420456618884615541e-08, -2.1523919384484695004e-05, 5.5471293984380156891e-03, -5.0620400125255241222e-17, 9.2642352189752352754e-01},
	{-1.4432635908167225373e-12, 7.7006208093374134064e-11, 4.8743405608024596949e-08, -2.1378166182774532936e-05, 5.5042271514103430219e-03, -1.1211426958151520062e-17, 9.3194917587999881459e-01},
	{-1.3974131430618133946e-12, 6.9790178971053401351e-11, 4.9037024549956362600e-08, -2.1231488361295688564e-05, 5.4616173500706697089e-03, 2.4636966099594444615e-17, 9.3743207368419489978e-01},
	{-1.3522860538182386750e-12, 6.2803411998210469885e-11, 4.9302237457987015231e-08, -2.1083972520659856787e-05, 5.4193017565959070853e-03, -4.7057903299051437474e-17, 9.4287250865132166133e-01},
	{-1.3079053095543613185e-12, 5.6042289244981213577e-11, 4.9539954133717171339e-08, -2.0935702510629599737e-05, 5.3772819627196993472e-03, -2.9071307474895927371e-17, 9.4827077579908547467e-01},
	{-1.2642911672245869892e-12, 4.9503077905897300102e-11, 4.9751069678755557377e-08, -2.0786759473500108185e-05, 5.3355593951909825040e-03, 2.8414449315417506018e-18, 9.5362717165398303010e-01},
	{-1.2214612925160002766e-12, 4.3181943946292317124e-11, 4.9936464062431145997e-08, -2.0637221888861138745e-05, 5.2941353211443768767e-03, 4.9980118927611432713e-17, 9.5894199408900893111e-01},
	{-1.1794308951089398740e-12, 3.7074965057377807521e-11, 5.0097001742710125015e-08, -2.0487165619575320897e-05, 5.2530108533798032522e-03, 9.0719108999934324262e-18, 9.6421554216668903248e-01},
	{-1.1382128607300827847e-12, 3.1178142934933245986e-11, 5.0233531337582424560e-08, -2.0336663958817332112e-05, 5.2121869555490692866e-03, -4.6040790315472894193e-17, 9.6944811598734659253e-01},
	{-1.0978178798095437736e-12, 2.5487414897660495275e-11, 5.0346885344244526729e-08, -2.0185787678026543803e-05, 5.1716644472474286240e-03, -2.5469331027183991969e-17, 9.7464001654250809192e-01},
	{-1.0582545725841760815e-12, 1.9998664862194550542e-11, 5.0437879903471105783e-08, -2.0034605075633733415e-05, 5.1314440090084421919e-03, -5.2849902478095314632e-17, 9.7979154557335246256e-01},
	{-1.0195296105177282819e-12, 1.4707733692550773790e-11, 5.0507314606637900672e-08, -1.9883182026430040615e-05, 5.0915261872007252716e-03, -5.1125965967505992098e-17, 9.8490300543410558287e-01},
	{-9.8164783393485370683e-13, 9.6104289424345658041e-12, 5.0555972342930318740e-08, -1.9731582031454012876e-05, 5.0519113988254154765e-03, -3.5230039627354576315e-17, 9.8997469896028267300e-01},
	{-9.4461236579025477613e-13, 4.7025340093536836898e-12, 5.0584619184347238478e-08, -1.9579866268279707609e-05, 5.0125999362134474394e-03, 5.3048651420504596188e-17, 9.9500692934167767056e-01}
};

static const double atane_c1_high = 0.2732395447351627649e+00;
static const double atane_c1_low = -7.8714706700729943528e-17;
static const double atane_c3 = -4.2441318157838758829e-01;
static const double atane_c5 = 2.5464790894703254187e-01;
static const double atane_c7 = -1.8189136353359466880e-01;
static const double atane_c9 = 1.4147106052612917759e-01;

static const double ataneh_c1 = -6.3661977236758138243e-01;
static const double ataneh_c2 = -3.1830988618379069122e-01;
static const double ataneh_c3 = -1.0610329539459689707e-01;
static const double ataneh_c5 = 3.1830988618379067734e-02;
static const double ataneh_c6 = 2.6525823848649224268e-02;
static const double ataneh_c7 = 1.1368210220849666800e-02;

static const double low_taylor_threshold = 0.0234375;

static const double high_taylor_threshold = 0.9921875;

double atan_eighth(double x) {
	const double* coeffs;
	if (x < 0.5) {
		if (x < low_taylor_threshold) {
			const double x2 = x*x;
			return x + x*(atane_c1_high + (atane_c1_low + x2*(atane_c3 + x2*(atane_c5 + x2*(atane_c7 + x2*atane_c9)))));
		}

		x *= 256;

		int64_t index = int64_t(x);
		x -= index;
		coeffs = atan_eighth_coeffs_low[index];
	}
	else {
		if (x >= high_taylor_threshold) {

			x = 1.0-x;
			return 1.0 + x*(ataneh_c1 + x*(ataneh_c2 + x*(ataneh_c3 + x*x*(ataneh_c5 + x*(ataneh_c6 + x*ataneh_c7)))));
		}

		x *= 128;

		int64_t index = int64_t(x);
		x -= index;
		coeffs = atan_eighth_coeffs_high[index-64];
	}

	return (((((coeffs[0]*x + coeffs[1])*x + coeffs[2])*x + coeffs[3])*x + coeffs[4])*x + coeffs[5]) + coeffs[6];
}

double atan_eighths(double x) {

	bool negate = ((*(const int64_t*)&x) & (int64_t(1)<<63)) != 0;
	if (negate) {
		x = -x;
	}
	int extra = 0;
	if (x > 1) {
		extra += negate ? -2 : 2;
		negate = !negate;
		x = 1/x;
	}

	if (x != x) {
		return x;
	}

	double a = atan_eighth(x);

	return extra + (negate ? -a : a);
}

double atan2_eighths(double y, double x) {

	bool negate = ((*(const int64_t*)&y) & (int64_t(1)<<63)) != 0;
	if (negate) {
		y = -y;
	}
	int extra = 0;
	if (((*(const int64_t*)&x) & (int64_t(1)<<63)) != 0) {
		extra = negate ? -4 : 4;
		negate = !negate;
		x = -x;
	}
	if ((*(const int64_t*)&x) < (*(const int64_t*)&y)) {
		extra += negate ? -2 : 2;
		negate = !negate;
		double temp = y;
		y = x;
		x = temp;
	}

	if ((*(const int64_t*)&x) == 0) {

		if (extra != 0) {
			return double(extra);
		}

		return negate ? -0.0 : 0.0;
	}

	if ((*(const int64_t*)&x) >= 0x7FF0000000000000) {

		if ((*(const int64_t*)&x) != 0x7FF0000000000000) {
			return x;
		}
		if ((*(const int64_t*)&y) == 0x7FF0000000000000) {

			return extra + (negate ? -1 : 1);
		}

		return extra + (negate ? -0.0 : 0.0);
	}

	double a = atan_eighth(y/x);

	return extra + (negate ? -a : a);
}
#include "Atan.h"

#include <stdint.h>
#include <fenv.h>
#include <limits>

static const double atan_eighth_coeffs_low[128][8] = {
	{2.3158656769252482684e-13, 2.1534361111052781935e-17, -2.5296996938534819769e-08, 3.1404097582121295763e-18, 4.9735919716217286829e-03, -1.6384368483746724039e-37, 4.0056120047108912695e-21},
	{2.3148056901789530986e-13, 1.1579974231474541370e-12, -2.5294681048550810265e-08, -7.5888674811302815290e-08, 4.9735160817889374762e-03, -4.2686482301848676369e-19, 4.9735666748564021089e-03},
	{2.3126866222303496850e-13, 2.3154432633903996904e-12, -2.5287734376775937391e-08, -1.5176345516045608817e-07, 4.9732884261855592536e-03, -5.7038965588626565253e-19, 9.9469815746789577715e-03},
	{2.3095102829242877575e-13, 3.4718294777927776914e-12, -2.5276160102380014250e-08, -2.2761045293832463277e-07, 4.9729090464902207108e-03, -4.3240058951572183359e-19, 1.4920092952221691504e-02},
	{2.3052793839227276869e-13, 4.6266273941058899723e-12, -2.5259963520979585819e-08, -3.0341579275207704180e-07, 4.9723780121461048226e-03, 6.9712615851193319229e-19, 1.9892749115801650756e-02},
	{2.2999975349853675919e-13, 5.7793096960881309779e-12, -2.5239152040116146127e-08, -3.7916561826505329767e-07, 4.9716954203291811171e-03, -3.6084281033800221048e-19, 2.4864798457048638974e-02},
	{2.2936692390221207976e-13, 6.9293508726035631061e-12, -2.5213735172934304548e-08, -4.5484609852350559637e-07, 4.9708613959037603255e-03, 8.4170782414171452993e-19, 2.9836089478616822923e-02},
	{2.2862998859273926312e-13, 8.0762276642462857840e-12, -2.5183724530068556817e-08, -5.3044343426168378142e-07, 4.9698760913654245822e-03, 1.1385294940247436004e-18, 3.4806470821845604535e-02},
	{2.2778957452085233718e-13, 9.2194195068813809703e-12, -2.5149133809749827704e-08, -6.0594386417990775896e-07, 4.9687396867713617965e-03, -3.2504349420665137918e-18, 3.9775791294357099037e-02},
	{2.2684639574231751783e-13, 1.0358408971499438189e-11, -2.5109978786145265098e-08, -6.8133367119030522416e-07, 4.9674523896581874657e-03, 1.0508846224639702350e-18, 4.4743899897577675551e-02},
	{2.2580125244427978127e-13, 1.1492682199789031296e-11, -2.5066277295947246762e-08, -7.5659918862493911309e-07, 4.9660144349473033659e-03, 1.4029498401656991053e-18, 4.9710645854171141289e-02},
	{2.2465502985616076622e-13, 1.2621729334840085427e-11, -2.5018049223229933394e-08, -8.3172680640109705143e-07, 4.9644260848378876649e-03, -9.4759163437472045505e-19, 5.4675878635371009950e-02},
	{2.2340869704727897639e-13, 1.3745044946400809720e-11, -2.4965316482593921781e-08, -9.0670297713857854620e-07, 4.9626876286875936523e-03, -2.5057418042279750664e-18, 5.9639447988199659201e-02},
	{2.2206330561358183767e-13, 1.4862128450121721685e-11, -2.4908103000621980437e-08, -9.8151422222387543502e-07, 4.9607993828810759140e-03, 1.2917748011760968052e-18, 6.4601203962562081529e-02},
	{2.2061998825609292665e-13, 1.5972484520232221019e-11, -2.4846434695671013995e-08, -1.0561471378162180291e-06, 4.9587616906864402308e-03, -7.3846088809925218541e-19, 6.9560996938202127038e-02},
	{2.1907995725388377561e-13, 1.7075623495108226217e-11, -2.4780339456027576504e-08, -1.1305884007905346658e-06, 4.9565749220997403629e-03, 1.3713512439334065645e-18, 7.4518677651509157567e-02},
	{2.1744450283457817419e-13, 1.8171061775203409020e-11, -2.4709847116456467260e-08, -1.2048247746124606899e-06, 4.9542394736776657060e-03, 5.6674475463062163132e-18, 7.9474097222163350707e-02},
	{2.1571499144558775471e-13, 1.9258322212831601218e-11, -2.4634989433173924773e-08, -1.2788431151406199155e-06, 4.9517557683585412473e-03, -2.3590842991904814042e-18, 8.4427107179607802090e-02},
	{2.1389286392945861871e-13, 2.0336934493303987919e-11, -2.4555800057279071874e-08, -1.3526303763515072881e-06, 4.9491242552718028858e-03, 8.9449236023045309715e-19, 8.9377559489335803300e-02},
	{2.1197963360688241310e-13, 2.1406435506941545454e-11, -2.4472314506679084775e-08, -1.4261736159823942146e-06, 4.9463454095361077123e-03, -1.1264040336393123850e-18, 9.4325306578982026640e-02},
	{2.0997688427108790811e-13, 2.2466369711501002058e-11, -2.4384570136545530906e-08, -1.4994600010877986295e-06, 4.9434197320462397104e-03, 2.7893458118189217744e-18, 9.9270201364206056560e-02},
	{2.0788626809748286275e-13, 2.3516289484571130220e-11, -2.4292606108341146742e-08, -1.5724768135051679510e-06, 4.9403477492489930242e-03, 5.9497178644377929950e-18, 1.0421209727435741532e-01},
	{2.0570950347255884164e-13, 2.4555755465515628059e-11, -2.4196463357457924965e-08, -1.6452114552255514108e-06, 4.9371300129082218780e-03, -3.9339811552248329073e-18, 1.0915084827791098065e-01},
	{2.0344837274620488300e-13, 2.5584336886558789869e-11, -2.4096184559509233189e-08, -1.7176514536651530118e-06, 4.9337670998592410287e-03, -1.4706564682135449446e-18, 1.1408630890766208177e-01},
	{2.0110471991169688409e-13, 2.6601611892630981205e-11, -2.3991814095320089365e-08, -1.7897844668338005760e-06, 4.9302596117527944589e-03, 2.6720467902321030104e-18, 1.1901833428567087925e-01},
	{1.9868044821774124843e-13, 2.7607167849612298427e-11, -2.3883398014661290635e-08, -1.8615982883964872590e-06, 4.9266081747887831288e-03, -4.2842873553472224746e-18, 1.2394678014794546783e-01},
	{1.9617751771705041953e-13, 2.8600601640634557779e-11, -2.3770983998774491988e-08, -1.9330808526242901384e-06, 4.9228134394399903143e-03, 1.7002653674207939722e-18, 1.2887150286885368233e-01},
	{1.9359794275601615255e-13, 2.9581519950124332076e-11, -2.3654621321736618166e-08, -2.0042202392311125720e-06, 4.9188760801660100924e-03, -5.8888331159386452302e-18, 1.3379235948525383670e-01},
	{1.9094378941012291338e-13, 3.0549539535292439159e-11, -2.3534360810713262827e-08, -2.0750046780928380546e-06, 4.9147967951176209714e-03, 1.2978739099614535511e-18, 1.3870920772033440427e-01},
	{1.8821717286980887264e-13, 3.1504287484798557176e-11, -2.3410254805151757959e-08, -2.1454225538456423308e-06, 4.9105763058318483913e-03, 1.3560754872222811115e-18, 1.4362190600715360467e-01},
	{1.8542025478153530178e-13, 3.2445401464343248705e-11, -2.3282357114965807560e-08, -2.2154624103603600240e-06, 4.9062153569179442134e-03, 1.3796190558230810639e-17, 1.4853031351186929410e-01},
	{1.8255524054886640113e-13, 3.3372529948963295652e-11, -2.3150722977764314125e-08, -2.2851129550899553534e-06, 4.9017147157345520789e-03, -1.1524295069041734015e-17, 1.5343429015665061010e-01},
	{1.7962437659839183134e-13, 3.4285332441830561393e-11, -2.3015409015178072023e-08, -2.3543630632873150718e-06, 4.8970751720583006322e-03, 1.2166445532214648423e-17, 1.5833369664226215612e-01},
	{1.7662994761534219348e-13, 3.5183479679378410425e-11, -2.2876473188338604061e-08, -2.4232017820907348564e-06, 4.8922975377440969594e-03, 2.6379809287036182236e-18, 1.6322839447031312066e-01},
	{1.7357427375375477074e-13, 3.6066653822604279154e-11, -2.2733974752564161970e-08, -2.4916183344746389467e-06, 4.8873826463773830525e-03, -9.9436318091606231079e-18, 1.6811824596516206087e-01},
	{1.7045970782604184694e-13, 3.6934548634421076639e-11, -2.2587974211308414493e-08, -2.5596021230632396871e-06, 4.8823313529186267851e-03, -4.2209237339308054966e-18, 1.7300311429547043929e-01},
	{1.6728863247679798797e-13, 3.7786869642954521769e-11, -2.2438533269427849663e-08, -2.6271427338050032975e-06, 4.8771445333403223507e-03, -1.3787362596358920578e-17, 1.7788286349539680908e-01},
	{1.6406345734565631833e-13, 3.8623334290707479284e-11, -2.2285714785824258679e-08, -2.6942299395059711565e-06, 4.8718230842567872632e-03, -8.3824990890890976656e-18, 1.8275735848542420947e-01},
	{1.6078661622396489917e-13, 3.9443672069536745973e-11, -2.2129582725518946695e-08, -2.7608537032201379222e-06, 4.8663679225470343401e-03, 1.2614390082637134856e-17, 1.8762646509281408203e-01},
	{1.5746056421000738663e-13, 4.0247624641411235440e-11, -2.1970202111215441589e-08, -2.8270041814952728915e-06, 4.8607799849709996953e-03, 1.1574491730619903250e-17, 1.9249005007167963033e-01},
	{1.5408777486743239767e-13, 4.1034945944944420564e-11, -2.1807638974407637211e-08, -2.8926717274727332095e-06, 4.8550602277794372569e-03, -7.7020523772156529484e-18, 1.9734798112267212811e-01},
	{1.5067073739148795400e-13, 4.1805402287717066725e-11, -2.1641960306090224878e-08, -2.9578468938399903301e-06, 4.8492096263177512927e-03, -8.4722693022497282456e-18, 2.0220012691227415291e-01},
	{1.4721195378757934710e-13, 4.2558772424429327167e-11, -2.1473234007128147789e-08, -3.0225204356347618109e-06, 4.8432291746240757266e-03, -1.0632006052920365867e-17, 2.0704635709169383340e-01},
	{1.4371393606658089412e-13, 4.3294847620943806055e-11, -2.1301528838341654204e-08, -3.0866833128998120461e-06, 4.8371198850218934118e-03, -1.3074834734093199481e-17, 2.1188654231535425376e-01},
	{1.4017920346123617998e-13, 4.4013431704303483443e-11, -2.1126914370363217511e-08, -3.1503266931876502908e-06, 4.8308827877074972043e-03, -6.7852100435297557872e-18, 2.1672055425897296388e-01},
	{1.3661027966787634198e-13, 4.4714341098829948294e-11, -2.0949460933322217445e-08, -3.2134419539145283950e-06, 4.8245189303325920760e-03, -8.6932638167343771562e-18, 2.2154826563722651578e-01},
	{1.3300969011757324142e-13, 4.5397404848428536953e-11, -2.0769239566412757230e-08, -3.2760206845633041429e-06, 4.8180293775823366392e-03, 5.2563932548808394154e-18, 2.2636955022099519708e-01},
	{1.2937995928072405545e-13, 4.6062464625247654004e-11, -2.0586321967399577822e-08, -3.3380546887348991473e-06, 4.8114152107491354668e-03, -2.2774770695330071091e-18, 2.3118428285418382573e-01},
	{1.2572360800893634270e-13, 4.6709374724859501697e-11, -2.0400780442116229758e-08, -3.3995359860482509246e-06, 4.8046775273024788441e-03, -8.2263427705633583796e-18, 2.3599233947011410972e-01},
	{1.2204315091794796193e-13, 4.7338002048148701944e-11, -2.0212687854009093957e-08, -3.4604568138888167499e-06, 4.7978174404551300614e-03, 3.1496247385196498852e-18, 2.4079359710748518553e-01},
	{1.1834109381517690362e-13, 4.7948226070114100303e-11, -2.0022117573779992534e-08, -3.5208096290058402032e-06, 4.7908360787259707606e-03, 5.1850128410598930124e-18, 2.4558793392589861604e-01},
	{1.1461993117534862186e-13, 4.8539938795806974398e-11, -1.9829143429179290230e-08, -3.5805871089587628406e-06, 4.7837345854998044453e-03, 6.9522012847481338429e-18, 2.5037522922094457289e-01},
	{1.1088214366749877191e-13, 4.9113044703646046140e-11, -1.9633839655000450724e-08, -3.6397821534133023417e-06, 4.7765141185844104538e-03, 1.6251732377579494033e-17, 2.5515536343884653858e-01},
	{1.0713019573649162596e-13, 4.9667460676366234260e-11, -1.9436280843326029375e-08, -3.6983878852878789929e-06, 4.7691758497651641144e-03, 1.5225871180269482085e-17, 2.5992821819066180833e-01},
	{1.0336653324203612414e-13, 5.0203115919873916428e-11, -1.9236541894074041719e-08, -3.7563976517512197524e-06, 4.7617209643575075795e-03, -1.2928615670349938058e-17, 2.6469367626603546029e-01},
	{9.9593581158016084700e-14, 5.0719951870296029897e-11, -1.9034697965892455886e-08, -3.8138050250721110200e-06, 4.7541506607575757803e-03, 2.4639080181965870792e-17, 2.6945162164650576786e-01},
	{9.5813741334785360540e-14, 5.1217922089524912211e-11, -1.8830824427448488403e-08, -3.8706038033224173490e-06, 4.7464661499912646006e-03, 1.4717695302509477959e-17, 2.7420193951835986068e-01},
	{9.2029390326908297385e-14, 5.1696992149573533722e-11, -1.8624996809158026248e-08, -3.9267880109346150490e-06, 4.7386686552620500487e-03, -1.0239709138237778439e-17, 2.7894451628503713625e-01},
	{8.8242877288654735721e-14, 5.2157139506068607891e-11, -1.8417290755399346618e-08, -3.9823518991152298145e-06, 4.7307594114978247096e-03, -2.3757913165347803703e-17, 2.8367923957908047772e-01},
	{8.4456521939384882984e-14, 5.2598353361220296921e-11, -1.8207781977253850007e-08, -4.0372899461156962621e-06, 4.7227396648970559195e-03, 1.1321348049890709517e-17, 2.8840599827363377905e-01},
	{8.0672612600785075879e-14, 5.3020634516618125756e-11, -1.7996546205815205323e-08, -4.0915968573622826202e-06, 4.7146106724745449543e-03, 7.8550238953329020538e-18, 2.9312468249348555549e-01},
	{7.6893404307740199354e-14, 5.3423995216212320570e-11, -1.7783659146106935992e-08, -4.1452675654468470586e-06, 4.7063737016070595828e-03, -1.5217453609296245167e-17, 2.9783518362565786219e-01},
	{7.3121116994452909368e-14, 5.3808458979848938535e-11, -1.7569196431646877828e-08, -4.1982972299803026825e-06, 4.6980300295791314197e-03, 1.4920967192658588647e-17, 3.0253739432954118715e-01},
	{6.9357933757244856185e-14, 5.4174060427735065561e-11, -1.7353233579695629254e-08, -4.2506812373107978126e-06, 4.6895809431292730801e-03, 1.6368711022622260305e-17, 3.0723120854657548495e-01},
	{6.5605999195300305991e-14, 5.4520845096217473776e-11, -1.7135845947224453437e-08, -4.3024152001087096514e-06, 4.6810277379968996334e-03, 6.3209346853261319236e-18, 3.1191652150947729583e-01},
	{6.1867417830439551921e-14, 5.4848869245264657456e-11, -1.6917108687636616229e-08, -4.3534949568206663271e-06, 4.6723717184702067556e-03, -1.8395361268814438143e-17, 3.1659322975101461539e-01},
	{5.8144252606837496095e-14, 5.5158199658047348946e-11, -1.6697096708274535768e-08, -4.4039165709949003980e-06, 4.6636141969352735981e-03, 1.7908006108409984051e-17, 3.2126123111233001461e-01},
	{5.4438523471432869885e-14, 5.5448913433017398221e-11, -1.6475884628743584331e-08, -4.4536763304803410842e-06, 4.6547564934266349654e-03, -6.2971179809582735001e-18, 3.2592042475081395292e-01},
	{5.0752206035606586225e-14, 5.5721097768888479906e-11, -1.6253546740081725379e-08, -4.5027707465019473624e-06, 4.6457999351795916873e-03, -1.4854923151332813236e-17, 3.3057071114752883956e-01},
	{4.7087230318542334620e-14, 5.5974849742925044848e-11, -1.6030156964802540837e-08, -4.5511965526148391169e-06, 4.6367458561844768911e-03, 1.6732651971230405222e-17, 3.3521199211418700736e-01},
	{4.3445479572521444158e-14, 5.6210276082948040070e-11, -1.5805788817837641917e-08, -4.5989507035399173690e-06, 4.6275955967431444543e-03, -1.7756662329604295209e-17, 3.3984417079968387565e-01},
	{3.9828789190245491369e-14, 5.6427492933467038911e-11, -1.5580515368402756148e-08, -4.6460303738836747746e-06, 4.6183505030279008163e-03, 1.0359635746052492860e-17, 3.4446715169618835617e-01},
	{3.6238945694125746569e-14, 5.6626625616349108178e-11, -1.5354409202810145412e-08, -4.6924329567450331015e-06, 4.6090119266431021916e-03, 4.6077227854699910437e-18, 3.4908084064479433239e-01},
	{3.2677685807328094450e-14, 5.6807808386434189828e-11, -1.5127542388248424949e-08, -4.7381560622120520249e-06, 4.5995812241896591802e-03, -2.2264148159377139842e-17, 3.5368514484073437787e-01},
	{2.9146695606215809866e-14, 5.6971184182505908751e-11, -1.4899986437549165813e-08, -4.7831975157514628434e-06, 4.5900597568326508696e-03, 2.3278903544210397537e-17, 3.5827997283815987695e-01},
	{2.5647609753691070218e-14, 5.7116904374024798893e-11, -1.4671812274958027123e-08, -4.8275553564939968144e-06, 4.5804488898722644022e-03, -1.9382913529632845642e-17, 3.6286523455449071207e-01},
	{2.2182010812799142720e-14, 5.7245128504028535982e-11, -1.4443090202926587829e-08, -4.8712278354185591198e-06, 4.5707499923182664386e-03, 1.9130078176438598699e-18, 3.6744084127433673803e-01},
	{1.8751428639827378825e-14, 5.7356024028600546860e-11, -1.4213889869939388398e-08, -4.9142134134383257352e-06, 4.5609644364682042778e-03, -1.0069085495948943465e-17, 3.7200670565299670534e-01},
	{1.5357339856004526418e-14, 5.7449766053304475089e-11, -1.3984280239389126139e-08, -4.9565107593918904453e-06, 4.5510935974895309203e-03, 1.3176888418712216091e-17, 3.7656274171953635355e-01},
	{1.2001167396784542008e-14, 5.7526537066977607498e-11, -1.3754329559511343164e-08, -4.9981187479426265234e-06, 4.5411388530058405602e-03, -2.1109576891854844531e-18, 3.8110886487945139223e-01},
	{8.6842801375832725057e-15, 5.7586526673271144748e-11, -1.3524105334388415688e-08, -5.0390364573894521521e-06, 4.5311015826873923124e-03, 1.1045682765283412785e-17, 3.8564499191691825608e-01},
	{5.4079925947262858447e-15, 5.7629931320319770639e-11, -1.3293674296031065194e-08, -5.0792631673922191576e-06, 4.5209831678460999857e-03, 1.6719141600656380103e-17, 3.9017104099663812988e-01},
	{2.1735647002616163550e-15, 5.7656954028916447874e-11, -1.3063102377544151174e-08, -5.1187983566149810542e-06, 4.5107849910351544356e-03, -9.2856668261277400238e-18, 3.9468693166527790694e-01},
	{-1.0177983508073350350e-15, 5.7667804119561918627e-11, -1.2832454687381968278e-08, -5.1576417002903786029e-06, 4.5005084356534389572e-03, -6.0088974338067585957e-19, 3.9919258485251318813e-01},
	{-4.1649461824062165281e-15, 5.7662696938751034044e-11, -1.2601795484696836342e-08, -5.1957930677084437741e-06, 4.4901548855548860384e-03, 6.3701017823813334770e-18, 4.0368792287167842847e-01},
	{-7.2667832500157002316e-15, 5.7641853584850282057e-11, -1.2371188155783315960e-08, -5.2332525196330789547e-06, 4.4797257246629420060e-03, -1.2080252167735519597e-17, 4.0817286942002867223e-01},
	{-1.0322268785744020295e-14, 5.7605500633912927663e-11, -1.2140695191619010772e-08, -5.2700203056495283809e-06, 4.4692223365902531904e-03, -2.7331322009910888239e-17, 4.1264734957861842757e-01},
	{-1.3330416677625857614e-14, 5.7553869865769559131e-11, -1.1910378166501509798e-08, -5.3060968614461028739e-06, 4.4586461042637349356e-03, -1.9182987101376110206e-17, 4.1711128981180300990e-01},
	{-1.6290295284996199786e-14, 5.7487197990722825013e-11, -1.1680297717779736040e-08, -5.3414828060334655415e-06, 4.4479984095551362150e-03, 2.5445966635447451531e-17, 4.2156461796636762740e-01},
	{-1.9201027191850594364e-14, 5.7405726377166164205e-11, -1.1450513526676625906e-08, -5.3761789389047496881e-06, 4.4372806329172221479e-03, 1.9106931037864796402e-17, 4.2600726327028992646e-01},
	{-2.2061788900160207492e-14, 5.7309700780436502092e-11, -1.1221084300198829832e-08, -5.4101862371397725488e-06, 4.4264941530256993185e-03, -8.6377466472901250371e-18, 4.3043915633114127051e-01},
	{-2.4871810465161101634e-14, 5.7199371073201231000e-11, -1.0992067754127910199e-08, -5.4435058524566033860e-06, 4.4156403464269810416e-03, 2.4521631135189295868e-17, 4.3486022913413313606e-01},
	{-2.7630375074682411726e-14, 5.7074990977669556890e-11, -1.0763520597086304944e-08, -5.4761391082137207654e-06, 4.4047205871918983927e-03, -2.4773235395450683853e-17, 4.3927041503981445469e-01},
	{-3.0336818574617685704e-14, 5.6936817799908115973e-11, -1.0535498515670208581e-08, -5.5080874963659709611e-06, 4.3937362465754593518e-03, -1.8967399864947940253e-17, 4.4366964878142489681e-01},
	{-3.2990528942677510131e-14, 5.6785112166530031007e-11, -1.0308056160640415563e-08, -5.5393526743775097927e-06, 4.3826886926827367252e-03, 1.2468148050875444369e-17, 4.4805786646191192446e-01},
	{-3.5590945712589992669e-14, 5.6620137764016191999e-11, -1.0081247134161122084e-08, -5.5699364620948941030e-06, 4.3715792901409655097e-03, -1.8775791715155518145e-17, 4.5243500555061627599e-01},
	{-3.8137559350938619565e-14, 5.6442161080916340371e-11, -9.8551239780756450886e-09, -5.5998408385834518163e-06, 4.3604093997779399053e-03, -3.5751160696176961827e-18, 4.5680100487963254396e-01},
	{-4.0629910588844885036e-14, 5.6251451153166917971e-11, -9.6297381632070875476e-09, -5.6290679389300146251e-06, 4.3491803783067654876e-03, -9.6930975241613182121e-18, 4.6115580463985195170e-01},
	{-4.3067589710715433556e-14, 5.6048279312751365530e-11, -9.4051400796710261300e-09, -5.6576200510150727861e-06, 4.3378935780170428671e-03, 3.0296120243554624753e-19, 4.6549934637669243553e-01},
	{-4.5450235802281499244e-14, 5.5832918939917633801e-11, -9.1813790281864106546e-09, -5.6854996122573767825e-06, 4.3265503464725244692e-03, 1.3194541207392282504e-17, 4.6983157298552358228e-01},
	{-4.7777535960160771085e-14, 5.5605645219156367945e-11, -8.9585032123700656640e-09, -5.7127092063339419961e-06, 4.3151520262153224977e-03, -2.5366712362847814158e-18, 4.7415242870679230602e-01},
	{-5.0049224465170424291e-14, 5.5366734899132213926e-11, -8.7365597319993407322e-09, -5.7392515598783981355e-06, 4.3036999544766845610e-03, 2.1997995391071141313e-17, 4.7846185912085592573e-01},
	{-5.2265081921613330703e-14, 5.5116466056749418835e-11, -8.5155945772267530113e-09, -5.7651295391605599427e-06, 4.2921954628943994117e-03, 1.4063514186535974068e-17, 4.8275981114252969340e-01},
	{-5.4424934364749199664e-14, 5.4855117865521975725e-11, -8.2956526237297524988e-09, -5.7903461467500406479e-06, 4.2806398772368596875e-03, 2.3764707611844840668e-17, 4.8704623301535454605e-01},
	{-5.6528652338647260932e-14, 5.4582970368407202727e-11, -8.0767776287780456708e-09, -5.8149045181667093066e-06, 4.2690345171338111435e-03, 6.7633236007503528755e-18, 4.9132107430559274208e-01},
	{-5.8576149946598736557e-14, 5.4300304255250996244e-11, -7.8590122282003572629e-09, -5.8388079185206889752e-06, 4.2573806958138048565e-03, -4.7753916624983356454e-18, 4.9558428589595721059e-01},
	{-6.0567383876244679904e-14, 5.4007400644981921582e-11, -7.6423979342319061389e-09, -5.8620597391445918291e-06, 4.2456797198483922987e-03, -6.4452209399969692121e-18, 4.9983581997908199668e-01},
	{-6.2502352401548746570e-14, 5.3704540872680441159e-11, -7.4269751342233269010e-09, -5.8846634942205890741e-06, 4.2339328889030433331e-03, -4.9751213552854857290e-17, 5.0407563005074018658e-01},
	{-6.4381094363715141511e-14, 5.3392006281639182502e-11, -7.2127830901913395912e-09, -5.9066228174048762312e-06, 4.2221414954948287626e-03, -5.4546090856903826815e-17, 5.0830367090281591835e-01},
	{-6.6203688133119561400e-14, 5.3070078020519446617e-11, -6.9998599391909619415e-09, -5.9279414584520274603e-06, 4.2103068247568474838e-03, -3.8080208388927406056e-17, 5.1251989861603786114e-01},
	{-6.7970250554284878180e-14, 5.2739036845698875701e-11, -6.7882426944887128720e-09, -5.9486232798416741424e-06, 4.1984301542093982462e-03, -4.9843554878403859117e-18, 5.1672427055248015826e-01},
	{-6.9680935875895703208e-14, 5.2399162928895020964e-11, -6.5779672475158655036e-09, -5.9686722534098768709e-06, 4.1865127535379072915e-03, 3.1613709018507724732e-17, 5.2091674534783805051e-01},
	{-7.1335934667804597202e-14, 5.2050735670139644579e-11, -6.3690683705804977631e-09, -5.9880924569875024061e-06, 4.1745558843775728425e-03, 2.8881361433332354734e-17, 5.2509728290348478552e-01},
	{-7.2935472726939423775e-14, 5.1694033516168766963e-11, -6.1615797203168057590e-09, -6.0068880710478476879e-06, 4.1625608001047307780e-03, -4.5482847651068589278e-17, 5.2926584437831647456e-01},
	{-7.4479809973975981667e-14, 5.1329333784283893426e-11, -5.9555338418499168061e-09, -6.0250633753656911699e-06, 4.1505287456349128708e-03, 4.2504255671842281583e-17, 5.3342239218039144699e-01},
	{-7.5969239342592555056e-14, 5.0956912491730645369e-11, -5.7509621736542172944e-09, -6.0426227456898780460e-06, 4.1384609572275741704e-03, -4.7677527080233541851e-17, 5.3756688995837209610e-01},
	{-7.7404085663073405129e-14, 5.0577044190631773584e-11, -5.5478950530830534294e-09, -6.0595706504315078244e-06, 4.1263586622974600393e-03, 4.4404911542499147776e-17, 5.4169930259277265794e-01},
	{-7.8784704541977713761e-14, 5.0190001808502903982e-11, -5.3463617225475371428e-09, -6.0759116473696707296e-06, 4.1142230792325781494e-03, -4.0144422463012884564e-17, 5.4581959618702435844e-01},
	{-8.0111481239537579664e-14, 4.9796056494370544960e-11, -5.1463903363220794566e-09, -6.0916503803766861911e-06, 4.1020554172187398759e-03, -1.7607275616722521095e-17, 5.4992773805835903911e-01},
	{-8.1384829546395264643e-14, 4.9395477470503801243e-11, -4.9480079679542313971e-09, -6.1067915761646509871e-06, 4.0898568760706311906e-03, -3.6611262595214259463e-17, 5.5402369672852302962e-01},
	{-8.2605190661235033356e-14, 4.8988531889762967189e-11, -4.7512406182563620969e-09, -6.1213400410551113877e-06, 4.0776286460693688188e-03, -1.4873083597338430909e-17, 5.5810744191432359873e-01},
	{-8.3773032070809053401e-14, 4.8575484698560605182e-11, -4.5561132238567227501e-09, -6.1353006577735457399e-06, 4.0653719078064922202e-03, 7.8082161226731320854e-18, 5.6217894451801719846e-01},
	{-8.4888846433800340082e-14, 4.8156598505423050365e-11, -4.3626496662874616264e-09, -6.1486783822703125975e-06, 4.0530878320343341481e-03, 2.6082579077450135284e-17, 5.6623817661754438646e-01},
	{-8.5953150469908692436e-14, 4.7732133455133142061e-11, -4.1708727815872488239e-09, -6.1614782405696432645e-06, 4.0407775795227316232e-03, -1.2483796966782476764e-17, 5.7028511145661853199e-01},
	{-8.6966483855487784599e-14, 4.7302347108428067556e-11, -3.9808043703962083179e-09, -6.1737053256481822354e-06, 4.0284423009220035952e-03, 1.6018127889239175440e-18, 5.7431972343467407871e-01},
	{-8.7929408127003680517e-14, 4.6867494327219534730e-11, -3.7924652085210318755e-09, -6.1853647943445281957e-06, 4.0160831366321406502e-03, -2.3441281644945103200e-17, 5.7834198809668146968e-01},
	{-8.8842505593527194418e-14, 4.6427827165297085864e-11, -3.6058750579482474342e-09, -6.1964618643011435379e-06, 4.0037012166781460465e-03, -2.0364644674742422707e-17, 5.8235188212283361953e-01},
	{-8.9706378259413739858e-14, 4.5983594764469471276e-11, -3.4210526782838039591e-09, -6.2070018109399503788e-06, 3.9912976605914560896e-03, -1.6210731826996749642e-18, 5.8634938331811137235e-01}
};

static const double atan_eighth_coeffs_high[64][8] = {
	{-2.9091124615448302711e-12, 7.2858161167106326010e-10, -2.5904139342049244640e-08, -2.4867959854723912497e-05, 7.9577471545944772346e-03, 4.8396095239860734317e-17, 5.9033447060173305232e-01},
	{-2.9551986094227041222e-12, 7.1403360654547137164e-10, -2.3018930907737327011e-08, -2.4941329874560891789e-05, 7.9079364222473472884e-03, -1.3648602608839915107e-17, 5.9826732461800602447e-01},
	{-2.9953588184231289549e-12, 6.9925524187686217559e-10, -2.0192371898783095743e-08, -2.5006132017976782044e-05, 7.8579875470634642787e-03, -5.2937015560277326021e-17, 6.0615029740252635015e-01},
	{-3.0297717397311505877e-12, 6.8427615006701471119e-10, -1.7425324598158689109e-08, -2.5062543556145136758e-05, 7.8079174879555849481e-03, -3.7458321231861637694e-17, 6.1398325932145980666e-01},
	{-3.0586221945045337186e-12, 6.6912506986205150734e-10, -1.4718534549341007380e-08, -2.5110744171080577630e-05, 7.7577428468249033655e-03, -3.6032067517189329158e-17, 6.2176609752178102486e-01},
	{-3.0821002084833552227e-12, 6.5382981551778942947e-10, -1.2072634192070981660e-08, -2.5150915610843946910e-05, 7.7074798640859873769e-03, 2.7082869698848351368e-17, 6.2949871557196668270e-01},
	{-3.1004000851948993076e-12, 6.3841725079294992047e-10, -9.4881466118200444179e-09, -2.5183241355830089658e-05, 7.6571444148702703589e-03, 3.7998515458536695263e-17, 6.3718103309855533833e-01},
	{-3.1137195197829431119e-12, 6.2291326757708713262e-10, -6.9654893840394842361e-09, -2.5207906296450800733e-05, 7.6067520058856205947e-03, 1.7981455177645671693e-17, 6.4481298541924003676e-01},
	{-3.1222587550938615680e-12, 6.0734276894995462510e-10, -4.5049784950610305276e-09, -2.5225096422469885646e-05, 7.5563177729089398699e-03, -7.2099364672234136690e-18, 6.5239452317313939567e-01},
	{-3.1262197812760122216e-12, 5.9172965646087881642e-10, -2.1068323223461992158e-09, -2.5234998524194148368e-05, 7.5058564788882502217e-03, -2.3213491555724139870e-17, 6.5992561194886789622e-01},
	{-3.1258055797948738488e-12, 5.7609682141043249247e-10, 2.2882434235994899126e-10, -2.5237799905673422512e-05, 7.4553825126304268042e-03, 3.1309143544271815787e-17, 6.6740623191100301170e-01},
	{-3.1212194124353304369e-12, 5.6046613991220118773e-10, 2.5019562425353728007e-09, -2.5233688110014827077e-05, 7.4049098880504182416e-03, -5.5908716204048322905e-18, 6.7483637742552315952e-01},
	{-3.1126641555549432775e-12, 5.4485847150958551686e-10, 4.7126135937182554260e-09, -2.5222850656871026947e-05, 7.3544522439576787490e-03, 1.5366030372193450272e-17, 6.8221605668476470452e-01},
	{-3.1003416795684351714e-12, 5.2929366112127486450e-10, 6.8609280214425137300e-09, -2.5205474792119608198e-05, 7.3040228443554270146e-03, 2.7895298857389367599e-18, 6.8954529133242492556e-01},
	{-3.0844522733839753949e-12, 5.1379054408913485776e-10, 8.9471085131341396875e-09, -2.5181747249710772878e-05, 7.2536345792283745890e-03, 3.0198779073078668455e-17, 6.9682411608910954648e-01},
	{-3.0651941132761269880e-12, 4.9836695410366035478e-10, 1.0971437395928813799e-08, -2.5151854025623329107e-05, 7.2032999657946333166e-03, -4.8328697969067610093e-17, 7.0405257837890289352e-01},
	{-3.0427627754681465010e-12, 4.8303973378472710663e-10, 1.2934266351477106262e-08, -2.5115980163834308712e-05, 7.1530311501976830829e-03, 2.4948894682408798789e-17, 7.1123073795741098557e-01},
	{-3.0173507915071919745e-12, 4.6782474769902456390e-10, 1.4836012477921902911e-08, -2.5074309554175872348e-05, 7.1028399096144875791e-03, -3.1719075616832387592e-17, 7.1835866654170821288e-01},
	{-2.9891472453492695678e-12, 4.5273689760014170420e-10, 1.6677154408367488386e-08, -2.5027024741923685312e-05, 7.0527376547561363568e-03, -2.7291836076581811654e-17, 7.2543644744258839463e-01},
	{-2.9583374109256061120e-12, 4.3779013968270199361e-10, 1.8458228494314503721e-08, -2.4974306748934431741e-05, 7.0027354327377297136e-03, 5.3181981416954037915e-17, 7.3246417519950468566e-01},
	{-2.9251024288376635702e-12, 4.2299750364809419992e-10, 2.0179825061712967499e-08, -2.4916334906125896183e-05, 6.9528439302946045894e-03, 4.5184244214860632265e-18, 7.3944195521855382580e-01},
	{-2.8896190207232510633e-12, 4.0837111338611759321e-10, 2.1842584746489291552e-08, -2.4853286697071218578e-05, 6.9030734773224558878e-03, -2.5176311426837283706e-17, 7.4636990341383979697e-01},
	{-2.8520592397500227797e-12, 3.9392220908415368225e-10, 2.3447194915635132067e-08, -2.4785337612459650220e-05, 6.8534340507193517236e-03, -1.7039599083134770880e-17, 7.5324814585253141441e-01},
	{-2.8125902556240029810e-12, 3.7966117058320400183e-10, 2.4994386179207894848e-08, -2.4712661015158892666e-05, 6.8039352785081814654e-03, -4.3445916126384329258e-17, 7.6007681840390339811e-01},
	{-2.7713741724484464120e-12, 3.6559754180820028636e-10, 2.6484928997886099369e-08, -2.4635428015599129424e-05, 6.7545864442186158080e-03, -1.5750699849926220561e-17, 7.6685606639263115270e-01},
	{-2.7285678777312016878e-12, 3.5174005610832322881e-10, 2.7919630390049264566e-08, -2.4553807357186012433e-05, 6.7053964915082088852e-03, 4.0710228196444379259e-17, 7.7358604425658927806e-01},
	{-2.6843229208155559035e-12, 3.3809666235158060798e-10, 2.9299330741711807651e-08, -2.4467965311438840396e-05, 6.6563740290029108082e-03, 3.6170805403320632313e-17, 7.8026691520938218360e-01},
	{-2.6387854189991706793e-12, 3.2467455162652559395e-10, 3.0624900722034805465e-08, -2.4378065582541156946e-05, 6.6075273353378262756e-03, 2.3135751622831523556e-17, 7.8689885090781674926e-01},
	{-2.5920959896069678977e-12, 3.1148018441267756051e-10, 3.1897238306568296350e-08, -2.4284269220983668142e-05, 6.5588643643797366403e-03, -1.0773962021797669613e-18, 7.9348203112450854668e-01},
	{-2.5443897062955715306e-12, 2.9851931808988248012e-10, 3.3117265909840420230e-08, -2.4186734545973730733e-05, 6.5103927506135056413e-03, -1.2053412170749258449e-17, 8.0001664342579370537e-01},
	{-2.4957960778880567649e-12, 2.8579703466546521780e-10, 3.4285927628407761385e-08, -2.4085617076281576571e-05, 6.4621198146751811578e-03, -1.3511250478258645424e-17, 8.0650288285510207675e-01},
	{-2.4464390480672045312e-12, 2.7331776860653586798e-10, 3.5404186595013855033e-08, -2.3981069469190799181e-05, 6.4140525690152393884e-03, 2.1170612716715009403e-17, 8.1294095162192980819e-01},
	{-2.3964370142922226349e-12, 2.6108533467317414347e-10, 3.6473022444068694604e-08, -2.3873241467219412181e-05, 6.3661977236761082763e-03, 1.8167433268632691638e-17, 8.1933105879653378434e-01},
	{-2.3459028643469553340e-12, 2.4910295565639245475e-10, 3.7493428888261621903e-08, -2.3762279852277596074e-05, 6.3185616921687471140e-03, -4.0580636828450027393e-17, 8.2567342001045407329e-01},
	{-2.2949440289760999015e-12, 2.3737328993274179192e-10, 3.8466411405751066438e-08, -2.3648328406929598479e-05, 6.2711505974337618252e-03, 2.8241306465530366838e-17, 8.3196825716295641495e-01},
	{-2.2436625491189488580e-12, 2.2589845875514219453e-10, 3.9392985037037990598e-08, -2.3531527882429231465e-05, 6.2239702778731607891e-03, 4.9348815745182836367e-18, 8.3821579813347302235e-01},
	{-2.1921551563069163796e-12, 2.1468007320697365512e-10, 4.0274172290322470748e-08, -2.3412015973201696201e-05, 6.1770262934395386845e-03, -5.4499560849847412387e-17, 8.4441627650010364636e-01},
	{-2.1405133648508275670e-12, 2.0371926075363410502e-10, 4.1111001153865943936e-08, -2.3289927297448402099e-05, 6.1303239317701289576e-03, 5.4023048585622834787e-17, 8.5056993126423008356e-01},
	{-2.0888235745059239934e-12, 1.9301669133264047821e-10, 4.1904503213631589891e-08, -2.3165393383556309622e-05, 6.0838682143537752695e-03, -4.3593942524771442315e-17, 8.5667700658128276281e-01},
	{-2.0371671823661837869e-12, 1.8257260292991076960e-10, 4.2655711874253117440e-08, -2.3038542661998868906e-05, 6.0376639027195566287e-03, -3.8037064526738827494e-17, 8.6273775149768405779e-01},
	{-1.9856207028042200015e-12, 1.7238682659610672794e-10, 4.3365660681185057695e-08, -2.2909500462421667378e-05, 5.9917155046363612322e-03, 2.3047916565169800128e-17, 8.6875241969398886432e-01},
	{-1.9342558943382503530e-12, 1.6245881086283610211e-10, 4.4035381741714977519e-08, -2.2778389015612763918e-05, 5.9460272803133666988e-03, 5.0957934709639697689e-17, 8.7472126923422466316e-01},
	{-1.8831398923728898148e-12, 1.5278764552410517818e-10, 4.4665904242368386491e-08, -2.2645327460064744582e-05, 5.9006032485919290842e-03, 2.7753081918595782455e-17, 8.8064456232142873660e-01},
	{-1.8323353468254124665e-12, 1.4337208475367910694e-10, 4.5258253060109202013e-08, -2.2510431852843192080e-05, 5.8554471931200040985e-03, 4.9090827489653108187e-17, 8.8652256505936932740e-01},
	{-1.7819005637132898141e-12, 1.3421056953394819373e-10, 4.5813447464631103717e-08, -2.2373815184484257212e-05, 5.8105626685007513016e-03, 3.4645001175526951387e-17, 8.9235554722042931264e-01},
	{-1.7318896498418732021e-12, 1.2530124937651959976e-10, 4.6332499908946639694e-08, -2.2235587397652162111e-05, 5.7659530064075384392e-03, -1.9853787293791010365e-18, 8.9814378201962175030e-01},
	{-1.6823526597928177081e-12, 1.1664200331905785384e-10, 4.6816414905410497767e-08, -2.2095855409296077818e-05, 5.7216213216580904394e-03, 1.9834740690303218536e-17, 9.0388754589470088341e-01},
	{-1.6333357444739405074e-12, 1.0823046018689513081e-10, 4.7266187984259323597e-08, -2.1954723136054424525e-05, 5.6775705182410393310e-03, -4.9773339170913082460e-17, 9.0958711829232430368e-01},
	{-1.5848813005495094006e-12, 1.0006401811162710038e-10, 4.7682804731711980320e-08, -2.1812291522663458773e-05, 5.6338032952886127336e-03, 3.0956236724053161855e-17, 9.1524278146021431635e-01},
	{-1.5370281201262616182e-12, 9.2139863302314683823e-11, 4.8067239904649745930e-08, -2.1668658573135953150e-05, 5.5903221529897077074e-03, -5.0940397457713669890e-17, 9.2085482024526421618e-01},
	{-1.4898115401246456680e-12, 8.4454988068034765526e-11, 4.8420456618884615541e-08, -2.1523919384484695004e-05, 5.5471293984380156891e-03, -5.0620400125255241222e-17, 9.2642352189752352754e-01},
	{-1.4432635908167225373e-12, 7.7006208093374134064e-11, 4.8743405608024596949e-08, -2.1378166182774532936e-05, 5.5042271514103430219e-03, -1.1211426958151520062e-17, 9.3194917587999881459e-01},
	{-1.3974131430618133946e-12, 6.9790178971053401351e-11, 4.9037024549956362600e-08, -2.1231488361295688564e-05, 5.4616173500706697089e-03, 2.4636966099594444615e-17, 9.3743207368419489978e-01},
	{-1.3522860538182386750e-12, 6.2803411998210469885e-11, 4.9302237457987015231e-08, -2.1083972520659856787e-05, 5.4193017565959070853e-03, -4.7057903299051437474e-17, 9.4287250865132166133e-01},
	{-1.3079053095543613185e-12, 5.6042289244981213577e-11, 4.9539954133717171339e-08, -2.0935702510629599737e-05, 5.3772819627196993472e-03, -2.9071307474895927371e-17, 9.4827077579908547467e-01},
	{-1.2642911672245869892e-12, 4.9503077905897300102e-11, 4.9751069678755557377e-08, -2.0786759473500108185e-05, 5.3355593951909825040e-03, 2.8414449315417506018e-18, 9.5362717165398303010e-01},
	{-1.2214612925160002766e-12, 4.3181943946292317124e-11, 4.9936464062431145997e-08, -2.0637221888861138745e-05, 5.2941353211443768767e-03, 4.9980118927611432713e-17, 9.5894199408900893111e-01},
	{-1.1794308951089398740e-12, 3.7074965057377807521e-11, 5.0097001742710125015e-08, -2.0487165619575320897e-05, 5.2530108533798032522e-03, 9.0719108999934324262e-18, 9.6421554216668903248e-01},
	{-1.1382128607300827847e-12, 3.1178142934933245986e-11, 5.0233531337582424560e-08, -2.0336663958817332112e-05, 5.2121869555490692866e-03, -4.6040790315472894193e-17, 9.6944811598734659253e-01},
	{-1.0978178798095437736e-12, 2.5487414897660495275e-11, 5.0346885344244526729e-08, -2.0185787678026543803e-05, 5.1716644472474286240e-03, -2.5469331027183991969e-17, 9.7464001654250809192e-01},
	{-1.0582545725841760815e-12, 1.9998664862194550542e-11, 5.0437879903471105783e-08, -2.0034605075633733415e-05, 5.1314440090084421919e-03, -5.2849902478095314632e-17, 9.7979154557335246256e-01},
	{-1.0195296105177282819e-12, 1.4707733692550773790e-11, 5.0507314606637900672e-08, -1.9883182026430040615e-05, 5.0915261872007252716e-03, -5.1125965967505992098e-17, 9.8490300543410558287e-01},
	{-9.8164783393485370683e-13, 9.6104289424345658041e-12, 5.0555972342930318740e-08, -1.9731582031454012876e-05, 5.0519113988254154765e-03, -3.5230039627354576315e-17, 9.8997469896028267300e-01},
	{-9.4461236579025477613e-13, 4.7025340093536836898e-12, 5.0584619184347238478e-08, -1.9579866268279707609e-05, 5.0125999362134474394e-03, 5.3048651420504596188e-17, 9.9500692934167767056e-01}
};

// NOTE: For slightly better accuracy for small x in atan_eighth, don't just scale x!
//       Instead do this as: x + x*(c1_high + (c1_low + x2*(c3 + x2*(c5 + x2*(c7 + x2*c9)))))
// a = (8/tau)
// c1_high = double(a)
// c1_low = double(a-c1_high)
// c3 = double(-a / 3)
// c5 = double(+a / 5)
// c7 = double(-a / 7)
// c9 = double(+a / 9)
// Relative truncation error is < (a / 11)*x^10, so for 2^-63,
// x < ((11/a)*2^-63)^(1/10)
// x < (8.64*2^-63)^(1/10)
// x < (2.0154/128)
// x < 2/128
static const double atane_c1_high = 0.2732395447351627649e+00;
static const double atane_c1_low = -7.8714706700729943528e-17;
static const double atane_c3 = -4.2441318157838758829e-01;
static const double atane_c5 = 2.5464790894703254187e-01;
static const double atane_c7 = -1.8189136353359466880e-01;
static const double atane_c9 = 1.4147106052612917759e-01;

// x1 = 1-x
// 1.0 + x1*(c1 + x1*(c2 + x1*(c3 + x1*x1*(c5 + x1*(c6 + x1*c7)))))
// a = (8/tau)
// c0 = 1.0
// c1 = double(-a / 2)
// c2 = double(-a / 4)
// c3 = double(-a / 12)
// c4 = 0
// c5 = double(-a / 40)
// c6 = double(+a / 48)
// c7 = double(-a / 112)
// c8 = 0
// Relative truncation error is approximately < (a / 288)*x^9, so for 2^-63,
// x < ((288/a)*2^-63)^(1/9)
// x < (1.826/128)
// x < (1/128)
static const double ataneh_c1 = -6.3661977236758138243e-01;
static const double ataneh_c2 = -3.1830988618379069122e-01;
static const double ataneh_c3 = -1.0610329539459689707e-01;
static const double ataneh_c5 = 3.1830988618379067734e-02;
static const double ataneh_c6 = 2.6525823848649224268e-02;
static const double ataneh_c7 = 1.1368210220849666800e-02;

//// 2/128, which should be exact in floating-point.
//// 4/128, which should be exact in floating-point.
// 3/128, which should be exact in floating-point.
static const double low_taylor_threshold = 0.0234375;//0.03125;//0.015625;

// (128-1)/128, which should be exact in floating-point.
static const double high_taylor_threshold = 0.9921875;

double atan_eighth(double x) {
	const double* coeffs;
	if (x < 0.5) {
		if (x < low_taylor_threshold) {
			const double x2 = x*x;
			return x + x*(atane_c1_high + (atane_c1_low + x2*(atane_c3 + x2*(atane_c5 + x2*(atane_c7 + x2*atane_c9)))));
		}
		// NOTE: Visual C++ isn't smart enough to figure out how to
		// add (8ULL<<52) without redundantly writing the value to memory,
		// so stick to multiplying, instead.
		x *= 256;
		//(*(uint64_t*)&x) += (8ULL<<52);
		// NOTE: The compiler doesn't know the precondition that x is in [0,1],
		// and casting to size_t, instead of int64_t, would require additional
		// handling for large values, so use int64_t, even though index
		// should never be negative.
		int64_t index = int64_t(x);
		x -= index;
		coeffs = atan_eighth_coeffs_low[index];
	}
	else {
		if (x >= high_taylor_threshold) {
			// Subtract x from 1, to map onto cos_quarter.
			// This shouldn't lose any accuracy, since floating-point has
			// more absolute precision near zero.
			x = 1.0-x;
			return 1.0 + x*(ataneh_c1 + x*(ataneh_c2 + x*(ataneh_c3 + x*x*(ataneh_c5 + x*(ataneh_c6 + x*ataneh_c7)))));
		}
		// NOTE: Visual C++ isn't smart enough to figure out how to
		// add (7ULL<<52) without redundantly writing the value to memory,
		// so stick to multiplying, instead.
		x *= 128;
		//(*(uint64_t*)&x) += (7ULL<<52);
		// NOTE: The compiler doesn't know the precondition that x is in [0,1],
		// and casting to size_t, instead of int64_t, would require additional
		// handling for large values, so use int64_t, even though index
		// should never be negative.
		int64_t index = int64_t(x);
		x -= index;
		coeffs = atan_eighth_coeffs_high[index-64];
	}

	// x should be in [0,1)
	return (((((coeffs[0]*x + coeffs[1])*x + coeffs[2])*x + coeffs[3])*x + coeffs[4])*x + coeffs[5]) + coeffs[6];
}

double atan_eighths(double x) {
	// First, flip x into the first eighth, similar to how atan2_eighths does it,
	// but where atan(x) corresponds with atan2(x,1), being careful to note
	// that the first argument to atan2 is named y, not x.
	// Saves ~1.5cc over std::signbit(x)
	bool negate = ((*(const int64_t*)&x) & (int64_t(1)<<63)) != 0;//std::signbit(x);//
	if (negate) {
		x = -x;
	}
	int extra = 0;
	if (x > 1) {
		extra += negate ? -2 : 2;
		negate = !negate;
		x = 1/x;
	}

	// If x is NaN, return the same NaN.
	// Same speed using x!=x vs. integer comparison.
	if (x != x) {//((*(const int64_t*)&x) > 0x7FF0000000000000) {//
		return x;
	}

	// x should now be in [0,1]
	double a = atan_eighth(x);

	return extra + (negate ? -a : a);
}

double atan2_eighths(double y, double x) {
	// First, flip (x,y) into the first eighth.
	bool negate = ((*(const int64_t*)&y) & (int64_t(1)<<63)) != 0;//std::signbit(y);//
	if (negate) {
		y = -y;
	}
	int extra = 0;
	if (((*(const int64_t*)&x) & (int64_t(1)<<63)) != 0) {//(std::signbit(x)) {//
		extra = negate ? -4 : 4;
		negate = !negate;
		x = -x;
	}
	if ((*(const int64_t*)&x) < (*(const int64_t*)&y)) {
		extra += negate ? -2 : 2;
		negate = !negate;
		double temp = y;
		y = x;
		x = temp;
	}
	// x is now >= y

	// If x is +/- 0 and y is +/- 0, the standard requires that x is treated
	// as if it's small but finite, and y only affects the sign,
	// so x = +0 means returning +/- 0, and x = -0 means returning +/- 4.
	if ((*(const int64_t*)&x) == 0) {
		// NOTE: y is also zero at this point, since y <= x and both have a clear sign bit.
		if (extra != 0) {
			return double(extra);
		}
		// Return a zero of the correct sign.
		return negate ? -0.0 : 0.0;
	}

	if ((*(const int64_t*)&x) >= 0x7FF0000000000000) {
		// If x or y is NaN, return the same NaN.
		// FIXME: This may not be the same NaN, since the sign bit has been cleared!!!
		if ((*(const int64_t*)&x) != 0x7FF0000000000000) {
			return x;
		}
		if ((*(const int64_t*)&y) == 0x7FF0000000000000) {
			// y is infinity.
			// NOTE: x is also infinite at this point.
			return extra + (negate ? -1 : 1);
		}
		// x is positive infinity and y is positive finite, so y/x will be positive zero.
		return extra + (negate ? -0.0 : 0.0);
	}

	// y/x should now be in [0,1]
	double a = atan_eighth(y/x);

	return extra + (negate ? -a : a);
}
