12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993 |
- // Copyright 2009 The Go Authors. All rights reserved.
- // Use of this source code is governed by a BSD-style
- // license that can be found in the LICENSE file.
- package math_test
- import (
- "fmt"
- . "math"
- "testing"
- )
- var vf = []float64{
- 4.9790119248836735e+00,
- 7.7388724745781045e+00,
- -2.7688005719200159e-01,
- -5.0106036182710749e+00,
- 9.6362937071984173e+00,
- 2.9263772392439646e+00,
- 5.2290834314593066e+00,
- 2.7279399104360102e+00,
- 1.8253080916808550e+00,
- -8.6859247685756013e+00,
- }
- // The expected results below were computed by the high precision calculators
- // at http://keisan.casio.com/. More exact input values (array vf[], above)
- // were obtained by printing them with "%.26f". The answers were calculated
- // to 26 digits (by using the "Digit number" drop-down control of each
- // calculator).
- var acos = []float64{
- 1.0496193546107222142571536e+00,
- 6.8584012813664425171660692e-01,
- 1.5984878714577160325521819e+00,
- 2.0956199361475859327461799e+00,
- 2.7053008467824138592616927e-01,
- 1.2738121680361776018155625e+00,
- 1.0205369421140629186287407e+00,
- 1.2945003481781246062157835e+00,
- 1.3872364345374451433846657e+00,
- 2.6231510803970463967294145e+00,
- }
- var acosh = []float64{
- 2.4743347004159012494457618e+00,
- 2.8576385344292769649802701e+00,
- 7.2796961502981066190593175e-01,
- 2.4796794418831451156471977e+00,
- 3.0552020742306061857212962e+00,
- 2.044238592688586588942468e+00,
- 2.5158701513104513595766636e+00,
- 1.99050839282411638174299e+00,
- 1.6988625798424034227205445e+00,
- 2.9611454842470387925531875e+00,
- }
- var asin = []float64{
- 5.2117697218417440497416805e-01,
- 8.8495619865825236751471477e-01,
- -02.769154466281941332086016e-02,
- -5.2482360935268931351485822e-01,
- 1.3002662421166552333051524e+00,
- 2.9698415875871901741575922e-01,
- 5.5025938468083370060258102e-01,
- 2.7629597861677201301553823e-01,
- 1.83559892257451475846656e-01,
- -1.0523547536021497774980928e+00,
- }
- var asinh = []float64{
- 2.3083139124923523427628243e+00,
- 2.743551594301593620039021e+00,
- -2.7345908534880091229413487e-01,
- -2.3145157644718338650499085e+00,
- 2.9613652154015058521951083e+00,
- 1.7949041616585821933067568e+00,
- 2.3564032905983506405561554e+00,
- 1.7287118790768438878045346e+00,
- 1.3626658083714826013073193e+00,
- -2.8581483626513914445234004e+00,
- }
- var atan = []float64{
- 1.372590262129621651920085e+00,
- 1.442290609645298083020664e+00,
- -2.7011324359471758245192595e-01,
- -1.3738077684543379452781531e+00,
- 1.4673921193587666049154681e+00,
- 1.2415173565870168649117764e+00,
- 1.3818396865615168979966498e+00,
- 1.2194305844639670701091426e+00,
- 1.0696031952318783760193244e+00,
- -1.4561721938838084990898679e+00,
- }
- var atanh = []float64{
- 5.4651163712251938116878204e-01,
- 1.0299474112843111224914709e+00,
- -2.7695084420740135145234906e-02,
- -5.5072096119207195480202529e-01,
- 1.9943940993171843235906642e+00,
- 3.01448604578089708203017e-01,
- 5.8033427206942188834370595e-01,
- 2.7987997499441511013958297e-01,
- 1.8459947964298794318714228e-01,
- -1.3273186910532645867272502e+00,
- }
- var atan2 = []float64{
- 1.1088291730037004444527075e+00,
- 9.1218183188715804018797795e-01,
- 1.5984772603216203736068915e+00,
- 2.0352918654092086637227327e+00,
- 8.0391819139044720267356014e-01,
- 1.2861075249894661588866752e+00,
- 1.0889904479131695712182587e+00,
- 1.3044821793397925293797357e+00,
- 1.3902530903455392306872261e+00,
- 2.2859857424479142655411058e+00,
- }
- var cbrt = []float64{
- 1.7075799841925094446722675e+00,
- 1.9779982212970353936691498e+00,
- -6.5177429017779910853339447e-01,
- -1.7111838886544019873338113e+00,
- 2.1279920909827937423960472e+00,
- 1.4303536770460741452312367e+00,
- 1.7357021059106154902341052e+00,
- 1.3972633462554328350552916e+00,
- 1.2221149580905388454977636e+00,
- -2.0556003730500069110343596e+00,
- }
- var ceil = []float64{
- 5.0000000000000000e+00,
- 8.0000000000000000e+00,
- 0.0000000000000000e+00,
- -5.0000000000000000e+00,
- 1.0000000000000000e+01,
- 3.0000000000000000e+00,
- 6.0000000000000000e+00,
- 3.0000000000000000e+00,
- 2.0000000000000000e+00,
- -8.0000000000000000e+00,
- }
- var copysign = []float64{
- -4.9790119248836735e+00,
- -7.7388724745781045e+00,
- -2.7688005719200159e-01,
- -5.0106036182710749e+00,
- -9.6362937071984173e+00,
- -2.9263772392439646e+00,
- -5.2290834314593066e+00,
- -2.7279399104360102e+00,
- -1.8253080916808550e+00,
- -8.6859247685756013e+00,
- }
- var cos = []float64{
- 2.634752140995199110787593e-01,
- 1.148551260848219865642039e-01,
- 9.6191297325640768154550453e-01,
- 2.938141150061714816890637e-01,
- -9.777138189897924126294461e-01,
- -9.7693041344303219127199518e-01,
- 4.940088096948647263961162e-01,
- -9.1565869021018925545016502e-01,
- -2.517729313893103197176091e-01,
- -7.39241351595676573201918e-01,
- }
- // Results for 100000 * Pi + vf[i]
- var cosLarge = []float64{
- 2.634752141185559426744e-01,
- 1.14855126055543100712e-01,
- 9.61912973266488928113e-01,
- 2.9381411499556122552e-01,
- -9.777138189880161924641e-01,
- -9.76930413445147608049e-01,
- 4.940088097314976789841e-01,
- -9.15658690217517835002e-01,
- -2.51772931436786954751e-01,
- -7.3924135157173099849e-01,
- }
- var cosh = []float64{
- 7.2668796942212842775517446e+01,
- 1.1479413465659254502011135e+03,
- 1.0385767908766418550935495e+00,
- 7.5000957789658051428857788e+01,
- 7.655246669605357888468613e+03,
- 9.3567491758321272072888257e+00,
- 9.331351599270605471131735e+01,
- 7.6833430994624643209296404e+00,
- 3.1829371625150718153881164e+00,
- 2.9595059261916188501640911e+03,
- }
- var erf = []float64{
- 5.1865354817738701906913566e-01,
- 7.2623875834137295116929844e-01,
- -3.123458688281309990629839e-02,
- -5.2143121110253302920437013e-01,
- 8.2704742671312902508629582e-01,
- 3.2101767558376376743993945e-01,
- 5.403990312223245516066252e-01,
- 3.0034702916738588551174831e-01,
- 2.0369924417882241241559589e-01,
- -7.8069386968009226729944677e-01,
- }
- var erfc = []float64{
- 4.8134645182261298093086434e-01,
- 2.7376124165862704883070156e-01,
- 1.0312345868828130999062984e+00,
- 1.5214312111025330292043701e+00,
- 1.7295257328687097491370418e-01,
- 6.7898232441623623256006055e-01,
- 4.596009687776754483933748e-01,
- 6.9965297083261411448825169e-01,
- 7.9630075582117758758440411e-01,
- 1.7806938696800922672994468e+00,
- }
- var exp = []float64{
- 1.4533071302642137507696589e+02,
- 2.2958822575694449002537581e+03,
- 7.5814542574851666582042306e-01,
- 6.6668778421791005061482264e-03,
- 1.5310493273896033740861206e+04,
- 1.8659907517999328638667732e+01,
- 1.8662167355098714543942057e+02,
- 1.5301332413189378961665788e+01,
- 6.2047063430646876349125085e+00,
- 1.6894712385826521111610438e-04,
- }
- var expm1 = []float64{
- 5.105047796122957327384770212e-02,
- 8.046199708567344080562675439e-02,
- -2.764970978891639815187418703e-03,
- -4.8871434888875355394330300273e-02,
- 1.0115864277221467777117227494e-01,
- 2.969616407795910726014621657e-02,
- 5.368214487944892300914037972e-02,
- 2.765488851131274068067445335e-02,
- 1.842068661871398836913874273e-02,
- -8.3193870863553801814961137573e-02,
- }
- var exp2 = []float64{
- 3.1537839463286288034313104e+01,
- 2.1361549283756232296144849e+02,
- 8.2537402562185562902577219e-01,
- 3.1021158628740294833424229e-02,
- 7.9581744110252191462569661e+02,
- 7.6019905892596359262696423e+00,
- 3.7506882048388096973183084e+01,
- 6.6250893439173561733216375e+00,
- 3.5438267900243941544605339e+00,
- 2.4281533133513300984289196e-03,
- }
- var fabs = []float64{
- 4.9790119248836735e+00,
- 7.7388724745781045e+00,
- 2.7688005719200159e-01,
- 5.0106036182710749e+00,
- 9.6362937071984173e+00,
- 2.9263772392439646e+00,
- 5.2290834314593066e+00,
- 2.7279399104360102e+00,
- 1.8253080916808550e+00,
- 8.6859247685756013e+00,
- }
- var fdim = []float64{
- 4.9790119248836735e+00,
- 7.7388724745781045e+00,
- 0.0000000000000000e+00,
- 0.0000000000000000e+00,
- 9.6362937071984173e+00,
- 2.9263772392439646e+00,
- 5.2290834314593066e+00,
- 2.7279399104360102e+00,
- 1.8253080916808550e+00,
- 0.0000000000000000e+00,
- }
- var floor = []float64{
- 4.0000000000000000e+00,
- 7.0000000000000000e+00,
- -1.0000000000000000e+00,
- -6.0000000000000000e+00,
- 9.0000000000000000e+00,
- 2.0000000000000000e+00,
- 5.0000000000000000e+00,
- 2.0000000000000000e+00,
- 1.0000000000000000e+00,
- -9.0000000000000000e+00,
- }
- var fmod = []float64{
- 4.197615023265299782906368e-02,
- 2.261127525421895434476482e+00,
- 3.231794108794261433104108e-02,
- 4.989396381728925078391512e+00,
- 3.637062928015826201999516e-01,
- 1.220868282268106064236690e+00,
- 4.770916568540693347699744e+00,
- 1.816180268691969246219742e+00,
- 8.734595415957246977711748e-01,
- 1.314075231424398637614104e+00,
- }
- type fi struct {
- f float64
- i int
- }
- var frexp = []fi{
- {6.2237649061045918750e-01, 3},
- {9.6735905932226306250e-01, 3},
- {-5.5376011438400318000e-01, -1},
- {-6.2632545228388436250e-01, 3},
- {6.02268356699901081250e-01, 4},
- {7.3159430981099115000e-01, 2},
- {6.5363542893241332500e-01, 3},
- {6.8198497760900255000e-01, 2},
- {9.1265404584042750000e-01, 1},
- {-5.4287029803597508250e-01, 4},
- }
- var gamma = []float64{
- 2.3254348370739963835386613898e+01,
- 2.991153837155317076427529816e+03,
- -4.561154336726758060575129109e+00,
- 7.719403468842639065959210984e-01,
- 1.6111876618855418534325755566e+05,
- 1.8706575145216421164173224946e+00,
- 3.4082787447257502836734201635e+01,
- 1.579733951448952054898583387e+00,
- 9.3834586598354592860187267089e-01,
- -2.093995902923148389186189429e-05,
- }
- var j0 = []float64{
- -1.8444682230601672018219338e-01,
- 2.27353668906331975435892e-01,
- 9.809259936157051116270273e-01,
- -1.741170131426226587841181e-01,
- -2.1389448451144143352039069e-01,
- -2.340905848928038763337414e-01,
- -1.0029099691890912094586326e-01,
- -1.5466726714884328135358907e-01,
- 3.252650187653420388714693e-01,
- -8.72218484409407250005360235e-03,
- }
- var j1 = []float64{
- -3.251526395295203422162967e-01,
- 1.893581711430515718062564e-01,
- -1.3711761352467242914491514e-01,
- 3.287486536269617297529617e-01,
- 1.3133899188830978473849215e-01,
- 3.660243417832986825301766e-01,
- -3.4436769271848174665420672e-01,
- 4.329481396640773768835036e-01,
- 5.8181350531954794639333955e-01,
- -2.7030574577733036112996607e-01,
- }
- var j2 = []float64{
- 5.3837518920137802565192769e-02,
- -1.7841678003393207281244667e-01,
- 9.521746934916464142495821e-03,
- 4.28958355470987397983072e-02,
- 2.4115371837854494725492872e-01,
- 4.842458532394520316844449e-01,
- -3.142145220618633390125946e-02,
- 4.720849184745124761189957e-01,
- 3.122312022520957042957497e-01,
- 7.096213118930231185707277e-02,
- }
- var jM3 = []float64{
- -3.684042080996403091021151e-01,
- 2.8157665936340887268092661e-01,
- 4.401005480841948348343589e-04,
- 3.629926999056814081597135e-01,
- 3.123672198825455192489266e-02,
- -2.958805510589623607540455e-01,
- -3.2033177696533233403289416e-01,
- -2.592737332129663376736604e-01,
- -1.0241334641061485092351251e-01,
- -2.3762660886100206491674503e-01,
- }
- var lgamma = []fi{
- {3.146492141244545774319734e+00, 1},
- {8.003414490659126375852113e+00, 1},
- {1.517575735509779707488106e+00, -1},
- {-2.588480028182145853558748e-01, 1},
- {1.1989897050205555002007985e+01, 1},
- {6.262899811091257519386906e-01, 1},
- {3.5287924899091566764846037e+00, 1},
- {4.5725644770161182299423372e-01, 1},
- {-6.363667087767961257654854e-02, 1},
- {-1.077385130910300066425564e+01, -1},
- }
- var log = []float64{
- 1.605231462693062999102599e+00,
- 2.0462560018708770653153909e+00,
- -1.2841708730962657801275038e+00,
- 1.6115563905281545116286206e+00,
- 2.2655365644872016636317461e+00,
- 1.0737652208918379856272735e+00,
- 1.6542360106073546632707956e+00,
- 1.0035467127723465801264487e+00,
- 6.0174879014578057187016475e-01,
- 2.161703872847352815363655e+00,
- }
- var logb = []float64{
- 2.0000000000000000e+00,
- 2.0000000000000000e+00,
- -2.0000000000000000e+00,
- 2.0000000000000000e+00,
- 3.0000000000000000e+00,
- 1.0000000000000000e+00,
- 2.0000000000000000e+00,
- 1.0000000000000000e+00,
- 0.0000000000000000e+00,
- 3.0000000000000000e+00,
- }
- var log10 = []float64{
- 6.9714316642508290997617083e-01,
- 8.886776901739320576279124e-01,
- -5.5770832400658929815908236e-01,
- 6.998900476822994346229723e-01,
- 9.8391002850684232013281033e-01,
- 4.6633031029295153334285302e-01,
- 7.1842557117242328821552533e-01,
- 4.3583479968917773161304553e-01,
- 2.6133617905227038228626834e-01,
- 9.3881606348649405716214241e-01,
- }
- var log1p = []float64{
- 4.8590257759797794104158205e-02,
- 7.4540265965225865330849141e-02,
- -2.7726407903942672823234024e-03,
- -5.1404917651627649094953380e-02,
- 9.1998280672258624681335010e-02,
- 2.8843762576593352865894824e-02,
- 5.0969534581863707268992645e-02,
- 2.6913947602193238458458594e-02,
- 1.8088493239630770262045333e-02,
- -9.0865245631588989681559268e-02,
- }
- var log2 = []float64{
- 2.3158594707062190618898251e+00,
- 2.9521233862883917703341018e+00,
- -1.8526669502700329984917062e+00,
- 2.3249844127278861543568029e+00,
- 3.268478366538305087466309e+00,
- 1.5491157592596970278166492e+00,
- 2.3865580889631732407886495e+00,
- 1.447811865817085365540347e+00,
- 8.6813999540425116282815557e-01,
- 3.118679457227342224364709e+00,
- }
- var modf = [][2]float64{
- {4.0000000000000000e+00, 9.7901192488367350108546816e-01},
- {7.0000000000000000e+00, 7.3887247457810456552351752e-01},
- {0.0000000000000000e+00, -2.7688005719200159404635997e-01},
- {-5.0000000000000000e+00, -1.060361827107492160848778e-02},
- {9.0000000000000000e+00, 6.3629370719841737980004837e-01},
- {2.0000000000000000e+00, 9.2637723924396464525443662e-01},
- {5.0000000000000000e+00, 2.2908343145930665230025625e-01},
- {2.0000000000000000e+00, 7.2793991043601025126008608e-01},
- {1.0000000000000000e+00, 8.2530809168085506044576505e-01},
- {-8.0000000000000000e+00, -6.8592476857560136238589621e-01},
- }
- var nextafter32 = []float32{
- 4.979012489318848e+00,
- 7.738873004913330e+00,
- -2.768800258636475e-01,
- -5.010602951049805e+00,
- 9.636294364929199e+00,
- 2.926377534866333e+00,
- 5.229084014892578e+00,
- 2.727940082550049e+00,
- 1.825308203697205e+00,
- -8.685923576354980e+00,
- }
- var nextafter64 = []float64{
- 4.97901192488367438926388786e+00,
- 7.73887247457810545370193722e+00,
- -2.7688005719200153853520874e-01,
- -5.01060361827107403343006808e+00,
- 9.63629370719841915615688777e+00,
- 2.92637723924396508934364647e+00,
- 5.22908343145930754047867595e+00,
- 2.72793991043601069534929593e+00,
- 1.82530809168085528249036997e+00,
- -8.68592476857559958602905681e+00,
- }
- var pow = []float64{
- 9.5282232631648411840742957e+04,
- 5.4811599352999901232411871e+07,
- 5.2859121715894396531132279e-01,
- 9.7587991957286474464259698e-06,
- 4.328064329346044846740467e+09,
- 8.4406761805034547437659092e+02,
- 1.6946633276191194947742146e+05,
- 5.3449040147551939075312879e+02,
- 6.688182138451414936380374e+01,
- 2.0609869004248742886827439e-09,
- }
- var remainder = []float64{
- 4.197615023265299782906368e-02,
- 2.261127525421895434476482e+00,
- 3.231794108794261433104108e-02,
- -2.120723654214984321697556e-02,
- 3.637062928015826201999516e-01,
- 1.220868282268106064236690e+00,
- -4.581668629186133046005125e-01,
- -9.117596417440410050403443e-01,
- 8.734595415957246977711748e-01,
- 1.314075231424398637614104e+00,
- }
- var signbit = []bool{
- false,
- false,
- true,
- true,
- false,
- false,
- false,
- false,
- false,
- true,
- }
- var sin = []float64{
- -9.6466616586009283766724726e-01,
- 9.9338225271646545763467022e-01,
- -2.7335587039794393342449301e-01,
- 9.5586257685042792878173752e-01,
- -2.099421066779969164496634e-01,
- 2.135578780799860532750616e-01,
- -8.694568971167362743327708e-01,
- 4.019566681155577786649878e-01,
- 9.6778633541687993721617774e-01,
- -6.734405869050344734943028e-01,
- }
- // Results for 100000 * Pi + vf[i]
- var sinLarge = []float64{
- -9.646661658548936063912e-01,
- 9.933822527198506903752e-01,
- -2.7335587036246899796e-01,
- 9.55862576853689321268e-01,
- -2.099421066862688873691e-01,
- 2.13557878070308981163e-01,
- -8.694568970959221300497e-01,
- 4.01956668098863248917e-01,
- 9.67786335404528727927e-01,
- -6.7344058693131973066e-01,
- }
- var sinh = []float64{
- 7.2661916084208532301448439e+01,
- 1.1479409110035194500526446e+03,
- -2.8043136512812518927312641e-01,
- -7.499429091181587232835164e+01,
- 7.6552466042906758523925934e+03,
- 9.3031583421672014313789064e+00,
- 9.330815755828109072810322e+01,
- 7.6179893137269146407361477e+00,
- 3.021769180549615819524392e+00,
- -2.95950575724449499189888e+03,
- }
- var sqrt = []float64{
- 2.2313699659365484748756904e+00,
- 2.7818829009464263511285458e+00,
- 5.2619393496314796848143251e-01,
- 2.2384377628763938724244104e+00,
- 3.1042380236055381099288487e+00,
- 1.7106657298385224403917771e+00,
- 2.286718922705479046148059e+00,
- 1.6516476350711159636222979e+00,
- 1.3510396336454586262419247e+00,
- 2.9471892997524949215723329e+00,
- }
- var tan = []float64{
- -3.661316565040227801781974e+00,
- 8.64900232648597589369854e+00,
- -2.8417941955033612725238097e-01,
- 3.253290185974728640827156e+00,
- 2.147275640380293804770778e-01,
- -2.18600910711067004921551e-01,
- -1.760002817872367935518928e+00,
- -4.389808914752818126249079e-01,
- -3.843885560201130679995041e+00,
- 9.10988793377685105753416e-01,
- }
- // Results for 100000 * Pi + vf[i]
- var tanLarge = []float64{
- -3.66131656475596512705e+00,
- 8.6490023287202547927e+00,
- -2.841794195104782406e-01,
- 3.2532901861033120983e+00,
- 2.14727564046880001365e-01,
- -2.18600910700688062874e-01,
- -1.760002817699722747043e+00,
- -4.38980891453536115952e-01,
- -3.84388555942723509071e+00,
- 9.1098879344275101051e-01,
- }
- var tanh = []float64{
- 9.9990531206936338549262119e-01,
- 9.9999962057085294197613294e-01,
- -2.7001505097318677233756845e-01,
- -9.9991110943061718603541401e-01,
- 9.9999999146798465745022007e-01,
- 9.9427249436125236705001048e-01,
- 9.9994257600983138572705076e-01,
- 9.9149409509772875982054701e-01,
- 9.4936501296239685514466577e-01,
- -9.9999994291374030946055701e-01,
- }
- var trunc = []float64{
- 4.0000000000000000e+00,
- 7.0000000000000000e+00,
- -0.0000000000000000e+00,
- -5.0000000000000000e+00,
- 9.0000000000000000e+00,
- 2.0000000000000000e+00,
- 5.0000000000000000e+00,
- 2.0000000000000000e+00,
- 1.0000000000000000e+00,
- -8.0000000000000000e+00,
- }
- var y0 = []float64{
- -3.053399153780788357534855e-01,
- 1.7437227649515231515503649e-01,
- -8.6221781263678836910392572e-01,
- -3.100664880987498407872839e-01,
- 1.422200649300982280645377e-01,
- 4.000004067997901144239363e-01,
- -3.3340749753099352392332536e-01,
- 4.5399790746668954555205502e-01,
- 4.8290004112497761007536522e-01,
- 2.7036697826604756229601611e-01,
- }
- var y1 = []float64{
- 0.15494213737457922210218611,
- -0.2165955142081145245075746,
- -2.4644949631241895201032829,
- 0.1442740489541836405154505,
- 0.2215379960518984777080163,
- 0.3038800915160754150565448,
- 0.0691107642452362383808547,
- 0.2380116417809914424860165,
- -0.20849492979459761009678934,
- 0.0242503179793232308250804,
- }
- var y2 = []float64{
- 0.3675780219390303613394936,
- -0.23034826393250119879267257,
- -16.939677983817727205631397,
- 0.367653980523052152867791,
- -0.0962401471767804440353136,
- -0.1923169356184851105200523,
- 0.35984072054267882391843766,
- -0.2794987252299739821654982,
- -0.7113490692587462579757954,
- -0.2647831587821263302087457,
- }
- var yM3 = []float64{
- -0.14035984421094849100895341,
- -0.097535139617792072703973,
- 242.25775994555580176377379,
- -0.1492267014802818619511046,
- 0.26148702629155918694500469,
- 0.56675383593895176530394248,
- -0.206150264009006981070575,
- 0.64784284687568332737963658,
- 1.3503631555901938037008443,
- 0.1461869756579956803341844,
- }
- // arguments and expected results for special cases
- var vfacosSC = []float64{
- -Pi,
- 1,
- Pi,
- NaN(),
- }
- var acosSC = []float64{
- NaN(),
- 0,
- NaN(),
- NaN(),
- }
- var vfacoshSC = []float64{
- Inf(-1),
- 0.5,
- 1,
- Inf(1),
- NaN(),
- }
- var acoshSC = []float64{
- NaN(),
- NaN(),
- 0,
- Inf(1),
- NaN(),
- }
- var vfasinSC = []float64{
- -Pi,
- Copysign(0, -1),
- 0,
- Pi,
- NaN(),
- }
- var asinSC = []float64{
- NaN(),
- Copysign(0, -1),
- 0,
- NaN(),
- NaN(),
- }
- var vfasinhSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var asinhSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var vfatanSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var atanSC = []float64{
- -Pi / 2,
- Copysign(0, -1),
- 0,
- Pi / 2,
- NaN(),
- }
- var vfatanhSC = []float64{
- Inf(-1),
- -Pi,
- -1,
- Copysign(0, -1),
- 0,
- 1,
- Pi,
- Inf(1),
- NaN(),
- }
- var atanhSC = []float64{
- NaN(),
- NaN(),
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- NaN(),
- NaN(),
- }
- var vfatan2SC = [][2]float64{
- {Inf(-1), Inf(-1)},
- {Inf(-1), -Pi},
- {Inf(-1), 0},
- {Inf(-1), +Pi},
- {Inf(-1), Inf(1)},
- {Inf(-1), NaN()},
- {-Pi, Inf(-1)},
- {-Pi, 0},
- {-Pi, Inf(1)},
- {-Pi, NaN()},
- {Copysign(0, -1), Inf(-1)},
- {Copysign(0, -1), -Pi},
- {Copysign(0, -1), Copysign(0, -1)},
- {Copysign(0, -1), 0},
- {Copysign(0, -1), +Pi},
- {Copysign(0, -1), Inf(1)},
- {Copysign(0, -1), NaN()},
- {0, Inf(-1)},
- {0, -Pi},
- {0, Copysign(0, -1)},
- {0, 0},
- {0, +Pi},
- {0, Inf(1)},
- {0, NaN()},
- {+Pi, Inf(-1)},
- {+Pi, 0},
- {+Pi, Inf(1)},
- {+Pi, NaN()},
- {Inf(1), Inf(-1)},
- {Inf(1), -Pi},
- {Inf(1), 0},
- {Inf(1), +Pi},
- {Inf(1), Inf(1)},
- {Inf(1), NaN()},
- {NaN(), NaN()},
- }
- var atan2SC = []float64{
- -3 * Pi / 4, // atan2(-Inf, -Inf)
- -Pi / 2, // atan2(-Inf, -Pi)
- -Pi / 2, // atan2(-Inf, +0)
- -Pi / 2, // atan2(-Inf, +Pi)
- -Pi / 4, // atan2(-Inf, +Inf)
- NaN(), // atan2(-Inf, NaN)
- -Pi, // atan2(-Pi, -Inf)
- -Pi / 2, // atan2(-Pi, +0)
- Copysign(0, -1), // atan2(-Pi, Inf)
- NaN(), // atan2(-Pi, NaN)
- -Pi, // atan2(-0, -Inf)
- -Pi, // atan2(-0, -Pi)
- -Pi, // atan2(-0, -0)
- Copysign(0, -1), // atan2(-0, +0)
- Copysign(0, -1), // atan2(-0, +Pi)
- Copysign(0, -1), // atan2(-0, +Inf)
- NaN(), // atan2(-0, NaN)
- Pi, // atan2(+0, -Inf)
- Pi, // atan2(+0, -Pi)
- Pi, // atan2(+0, -0)
- 0, // atan2(+0, +0)
- 0, // atan2(+0, +Pi)
- 0, // atan2(+0, +Inf)
- NaN(), // atan2(+0, NaN)
- Pi, // atan2(+Pi, -Inf)
- Pi / 2, // atan2(+Pi, +0)
- 0, // atan2(+Pi, +Inf)
- NaN(), // atan2(+Pi, NaN)
- 3 * Pi / 4, // atan2(+Inf, -Inf)
- Pi / 2, // atan2(+Inf, -Pi)
- Pi / 2, // atan2(+Inf, +0)
- Pi / 2, // atan2(+Inf, +Pi)
- Pi / 4, // atan2(+Inf, +Inf)
- NaN(), // atan2(+Inf, NaN)
- NaN(), // atan2(NaN, NaN)
- }
- var vfcbrtSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var cbrtSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var vfceilSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var ceilSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var vfcopysignSC = []float64{
- Inf(-1),
- Inf(1),
- NaN(),
- }
- var copysignSC = []float64{
- Inf(-1),
- Inf(-1),
- NaN(),
- }
- var vfcosSC = []float64{
- Inf(-1),
- Inf(1),
- NaN(),
- }
- var cosSC = []float64{
- NaN(),
- NaN(),
- NaN(),
- }
- var vfcoshSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var coshSC = []float64{
- Inf(1),
- 1,
- 1,
- Inf(1),
- NaN(),
- }
- var vferfSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var erfSC = []float64{
- -1,
- Copysign(0, -1),
- 0,
- 1,
- NaN(),
- }
- var vferfcSC = []float64{
- Inf(-1),
- Inf(1),
- NaN(),
- }
- var erfcSC = []float64{
- 2,
- 0,
- NaN(),
- }
- var vfexpSC = []float64{
- Inf(-1),
- -2000,
- 2000,
- Inf(1),
- NaN(),
- }
- var expSC = []float64{
- 0,
- 0,
- Inf(1),
- Inf(1),
- NaN(),
- }
- var vfexpm1SC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var expm1SC = []float64{
- -1,
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var vffabsSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var fabsSC = []float64{
- Inf(1),
- 0,
- 0,
- Inf(1),
- NaN(),
- }
- var vffdimSC = [][2]float64{
- {Inf(-1), Inf(-1)},
- {Inf(-1), Inf(1)},
- {Inf(-1), NaN()},
- {Copysign(0, -1), Copysign(0, -1)},
- {Copysign(0, -1), 0},
- {0, Copysign(0, -1)},
- {0, 0},
- {Inf(1), Inf(-1)},
- {Inf(1), Inf(1)},
- {Inf(1), NaN()},
- {NaN(), Inf(-1)},
- {NaN(), Copysign(0, -1)},
- {NaN(), 0},
- {NaN(), Inf(1)},
- {NaN(), NaN()},
- }
- var fdimSC = []float64{
- NaN(),
- 0,
- NaN(),
- 0,
- 0,
- 0,
- 0,
- Inf(1),
- NaN(),
- NaN(),
- NaN(),
- NaN(),
- NaN(),
- NaN(),
- NaN(),
- }
- var fmaxSC = []float64{
- Inf(-1),
- Inf(1),
- NaN(),
- Copysign(0, -1),
- 0,
- 0,
- 0,
- Inf(1),
- Inf(1),
- Inf(1),
- NaN(),
- NaN(),
- NaN(),
- Inf(1),
- NaN(),
- }
- var fminSC = []float64{
- Inf(-1),
- Inf(-1),
- Inf(-1),
- Copysign(0, -1),
- Copysign(0, -1),
- Copysign(0, -1),
- 0,
- Inf(-1),
- Inf(1),
- NaN(),
- Inf(-1),
- NaN(),
- NaN(),
- NaN(),
- NaN(),
- }
- var vffmodSC = [][2]float64{
- {Inf(-1), Inf(-1)},
- {Inf(-1), -Pi},
- {Inf(-1), 0},
- {Inf(-1), Pi},
- {Inf(-1), Inf(1)},
- {Inf(-1), NaN()},
- {-Pi, Inf(-1)},
- {-Pi, 0},
- {-Pi, Inf(1)},
- {-Pi, NaN()},
- {Copysign(0, -1), Inf(-1)},
- {Copysign(0, -1), 0},
- {Copysign(0, -1), Inf(1)},
- {Copysign(0, -1), NaN()},
- {0, Inf(-1)},
- {0, 0},
- {0, Inf(1)},
- {0, NaN()},
- {Pi, Inf(-1)},
- {Pi, 0},
- {Pi, Inf(1)},
- {Pi, NaN()},
- {Inf(1), Inf(-1)},
- {Inf(1), -Pi},
- {Inf(1), 0},
- {Inf(1), Pi},
- {Inf(1), Inf(1)},
- {Inf(1), NaN()},
- {NaN(), Inf(-1)},
- {NaN(), -Pi},
- {NaN(), 0},
- {NaN(), Pi},
- {NaN(), Inf(1)},
- {NaN(), NaN()},
- }
- var fmodSC = []float64{
- NaN(), // fmod(-Inf, -Inf)
- NaN(), // fmod(-Inf, -Pi)
- NaN(), // fmod(-Inf, 0)
- NaN(), // fmod(-Inf, Pi)
- NaN(), // fmod(-Inf, +Inf)
- NaN(), // fmod(-Inf, NaN)
- -Pi, // fmod(-Pi, -Inf)
- NaN(), // fmod(-Pi, 0)
- -Pi, // fmod(-Pi, +Inf)
- NaN(), // fmod(-Pi, NaN)
- Copysign(0, -1), // fmod(-0, -Inf)
- NaN(), // fmod(-0, 0)
- Copysign(0, -1), // fmod(-0, Inf)
- NaN(), // fmod(-0, NaN)
- 0, // fmod(0, -Inf)
- NaN(), // fmod(0, 0)
- 0, // fmod(0, +Inf)
- NaN(), // fmod(0, NaN)
- Pi, // fmod(Pi, -Inf)
- NaN(), // fmod(Pi, 0)
- Pi, // fmod(Pi, +Inf)
- NaN(), // fmod(Pi, NaN)
- NaN(), // fmod(+Inf, -Inf)
- NaN(), // fmod(+Inf, -Pi)
- NaN(), // fmod(+Inf, 0)
- NaN(), // fmod(+Inf, Pi)
- NaN(), // fmod(+Inf, +Inf)
- NaN(), // fmod(+Inf, NaN)
- NaN(), // fmod(NaN, -Inf)
- NaN(), // fmod(NaN, -Pi)
- NaN(), // fmod(NaN, 0)
- NaN(), // fmod(NaN, Pi)
- NaN(), // fmod(NaN, +Inf)
- NaN(), // fmod(NaN, NaN)
- }
- var vffrexpSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var frexpSC = []fi{
- {Inf(-1), 0},
- {Copysign(0, -1), 0},
- {0, 0},
- {Inf(1), 0},
- {NaN(), 0},
- }
- var vfgammaSC = []float64{
- Inf(-1),
- -3,
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var gammaSC = []float64{
- NaN(),
- NaN(),
- Inf(-1),
- Inf(1),
- Inf(1),
- NaN(),
- }
- var vfhypotSC = [][2]float64{
- {Inf(-1), Inf(-1)},
- {Inf(-1), 0},
- {Inf(-1), Inf(1)},
- {Inf(-1), NaN()},
- {Copysign(0, -1), Copysign(0, -1)},
- {Copysign(0, -1), 0},
- {0, Copysign(0, -1)},
- {0, 0}, // +0, +0
- {0, Inf(-1)},
- {0, Inf(1)},
- {0, NaN()},
- {Inf(1), Inf(-1)},
- {Inf(1), 0},
- {Inf(1), Inf(1)},
- {Inf(1), NaN()},
- {NaN(), Inf(-1)},
- {NaN(), 0},
- {NaN(), Inf(1)},
- {NaN(), NaN()},
- }
- var hypotSC = []float64{
- Inf(1),
- Inf(1),
- Inf(1),
- Inf(1),
- 0,
- 0,
- 0,
- 0,
- Inf(1),
- Inf(1),
- NaN(),
- Inf(1),
- Inf(1),
- Inf(1),
- Inf(1),
- Inf(1),
- NaN(),
- Inf(1),
- NaN(),
- }
- var vfilogbSC = []float64{
- Inf(-1),
- 0,
- Inf(1),
- NaN(),
- }
- var ilogbSC = []int{
- MaxInt32,
- MinInt32,
- MaxInt32,
- MaxInt32,
- }
- var vfj0SC = []float64{
- Inf(-1),
- 0,
- Inf(1),
- NaN(),
- }
- var j0SC = []float64{
- 0,
- 1,
- 0,
- NaN(),
- }
- var j1SC = []float64{
- 0,
- 0,
- 0,
- NaN(),
- }
- var j2SC = []float64{
- 0,
- 0,
- 0,
- NaN(),
- }
- var jM3SC = []float64{
- 0,
- 0,
- 0,
- NaN(),
- }
- var vfldexpSC = []fi{
- {0, 0},
- {0, -1075},
- {0, 1024},
- {Copysign(0, -1), 0},
- {Copysign(0, -1), -1075},
- {Copysign(0, -1), 1024},
- {Inf(1), 0},
- {Inf(1), -1024},
- {Inf(-1), 0},
- {Inf(-1), -1024},
- {NaN(), -1024},
- }
- var ldexpSC = []float64{
- 0,
- 0,
- 0,
- Copysign(0, -1),
- Copysign(0, -1),
- Copysign(0, -1),
- Inf(1),
- Inf(1),
- Inf(-1),
- Inf(-1),
- NaN(),
- }
- var vflgammaSC = []float64{
- Inf(-1),
- -3,
- 0,
- 1,
- 2,
- Inf(1),
- NaN(),
- }
- var lgammaSC = []fi{
- {Inf(-1), 1},
- {Inf(1), 1},
- {Inf(1), 1},
- {0, 1},
- {0, 1},
- {Inf(1), 1},
- {NaN(), 1},
- }
- var vflogSC = []float64{
- Inf(-1),
- -Pi,
- Copysign(0, -1),
- 0,
- 1,
- Inf(1),
- NaN(),
- }
- var logSC = []float64{
- NaN(),
- NaN(),
- Inf(-1),
- Inf(-1),
- 0,
- Inf(1),
- NaN(),
- }
- var vflogbSC = []float64{
- Inf(-1),
- 0,
- Inf(1),
- NaN(),
- }
- var logbSC = []float64{
- Inf(1),
- Inf(-1),
- Inf(1),
- NaN(),
- }
- var vflog1pSC = []float64{
- Inf(-1),
- -Pi,
- -1,
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var log1pSC = []float64{
- NaN(),
- NaN(),
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var vfmodfSC = []float64{
- Inf(-1),
- Inf(1),
- NaN(),
- }
- var modfSC = [][2]float64{
- {Inf(-1), NaN()}, // [2]float64{Copysign(0, -1), Inf(-1)},
- {Inf(1), NaN()}, // [2]float64{0, Inf(1)},
- {NaN(), NaN()},
- }
- var vfnextafter32SC = [][2]float32{
- {0, 0},
- {0, float32(Copysign(0, -1))},
- {0, -1},
- {0, float32(NaN())},
- {float32(Copysign(0, -1)), 1},
- {float32(Copysign(0, -1)), 0},
- {float32(Copysign(0, -1)), float32(Copysign(0, -1))},
- {float32(Copysign(0, -1)), -1},
- {float32(NaN()), 0},
- {float32(NaN()), float32(NaN())},
- }
- var nextafter32SC = []float32{
- 0,
- 0,
- -1.401298464e-45, // Float32frombits(0x80000001)
- float32(NaN()),
- 1.401298464e-45, // Float32frombits(0x00000001)
- float32(Copysign(0, -1)),
- float32(Copysign(0, -1)),
- -1.401298464e-45, // Float32frombits(0x80000001)
- float32(NaN()),
- float32(NaN()),
- }
- var vfnextafter64SC = [][2]float64{
- {0, 0},
- {0, Copysign(0, -1)},
- {0, -1},
- {0, NaN()},
- {Copysign(0, -1), 1},
- {Copysign(0, -1), 0},
- {Copysign(0, -1), Copysign(0, -1)},
- {Copysign(0, -1), -1},
- {NaN(), 0},
- {NaN(), NaN()},
- }
- var nextafter64SC = []float64{
- 0,
- 0,
- -4.9406564584124654418e-324, // Float64frombits(0x8000000000000001)
- NaN(),
- 4.9406564584124654418e-324, // Float64frombits(0x0000000000000001)
- Copysign(0, -1),
- Copysign(0, -1),
- -4.9406564584124654418e-324, // Float64frombits(0x8000000000000001)
- NaN(),
- NaN(),
- }
- var vfpowSC = [][2]float64{
- {Inf(-1), -Pi},
- {Inf(-1), -3},
- {Inf(-1), Copysign(0, -1)},
- {Inf(-1), 0},
- {Inf(-1), 1},
- {Inf(-1), 3},
- {Inf(-1), Pi},
- {Inf(-1), NaN()},
- {-Pi, Inf(-1)},
- {-Pi, -Pi},
- {-Pi, Copysign(0, -1)},
- {-Pi, 0},
- {-Pi, 1},
- {-Pi, Pi},
- {-Pi, Inf(1)},
- {-Pi, NaN()},
- {-1, Inf(-1)},
- {-1, Inf(1)},
- {-1, NaN()},
- {-1 / 2, Inf(-1)},
- {-1 / 2, Inf(1)},
- {Copysign(0, -1), Inf(-1)},
- {Copysign(0, -1), -Pi},
- {Copysign(0, -1), -3},
- {Copysign(0, -1), 3},
- {Copysign(0, -1), Pi},
- {Copysign(0, -1), Inf(1)},
- {0, Inf(-1)},
- {0, -Pi},
- {0, -3},
- {0, Copysign(0, -1)},
- {0, 0},
- {0, 3},
- {0, Pi},
- {0, Inf(1)},
- {0, NaN()},
- {1 / 2, Inf(-1)},
- {1 / 2, Inf(1)},
- {1, Inf(-1)},
- {1, Inf(1)},
- {1, NaN()},
- {Pi, Inf(-1)},
- {Pi, Copysign(0, -1)},
- {Pi, 0},
- {Pi, 1},
- {Pi, Inf(1)},
- {Pi, NaN()},
- {Inf(1), -Pi},
- {Inf(1), Copysign(0, -1)},
- {Inf(1), 0},
- {Inf(1), 1},
- {Inf(1), Pi},
- {Inf(1), NaN()},
- {NaN(), -Pi},
- {NaN(), Copysign(0, -1)},
- {NaN(), 0},
- {NaN(), 1},
- {NaN(), Pi},
- {NaN(), NaN()},
- }
- var powSC = []float64{
- 0, // pow(-Inf, -Pi)
- Copysign(0, -1), // pow(-Inf, -3)
- 1, // pow(-Inf, -0)
- 1, // pow(-Inf, +0)
- Inf(-1), // pow(-Inf, 1)
- Inf(-1), // pow(-Inf, 3)
- Inf(1), // pow(-Inf, Pi)
- NaN(), // pow(-Inf, NaN)
- 0, // pow(-Pi, -Inf)
- NaN(), // pow(-Pi, -Pi)
- 1, // pow(-Pi, -0)
- 1, // pow(-Pi, +0)
- -Pi, // pow(-Pi, 1)
- NaN(), // pow(-Pi, Pi)
- Inf(1), // pow(-Pi, +Inf)
- NaN(), // pow(-Pi, NaN)
- 1, // pow(-1, -Inf) IEEE 754-2008
- 1, // pow(-1, +Inf) IEEE 754-2008
- NaN(), // pow(-1, NaN)
- Inf(1), // pow(-1/2, -Inf)
- 0, // pow(-1/2, +Inf)
- Inf(1), // pow(-0, -Inf)
- Inf(1), // pow(-0, -Pi)
- Inf(-1), // pow(-0, -3) IEEE 754-2008
- Copysign(0, -1), // pow(-0, 3) IEEE 754-2008
- 0, // pow(-0, +Pi)
- 0, // pow(-0, +Inf)
- Inf(1), // pow(+0, -Inf)
- Inf(1), // pow(+0, -Pi)
- Inf(1), // pow(+0, -3)
- 1, // pow(+0, -0)
- 1, // pow(+0, +0)
- 0, // pow(+0, 3)
- 0, // pow(+0, +Pi)
- 0, // pow(+0, +Inf)
- NaN(), // pow(+0, NaN)
- Inf(1), // pow(1/2, -Inf)
- 0, // pow(1/2, +Inf)
- 1, // pow(1, -Inf) IEEE 754-2008
- 1, // pow(1, +Inf) IEEE 754-2008
- 1, // pow(1, NaN) IEEE 754-2008
- 0, // pow(+Pi, -Inf)
- 1, // pow(+Pi, -0)
- 1, // pow(+Pi, +0)
- Pi, // pow(+Pi, 1)
- Inf(1), // pow(+Pi, +Inf)
- NaN(), // pow(+Pi, NaN)
- 0, // pow(+Inf, -Pi)
- 1, // pow(+Inf, -0)
- 1, // pow(+Inf, +0)
- Inf(1), // pow(+Inf, 1)
- Inf(1), // pow(+Inf, Pi)
- NaN(), // pow(+Inf, NaN)
- NaN(), // pow(NaN, -Pi)
- 1, // pow(NaN, -0)
- 1, // pow(NaN, +0)
- NaN(), // pow(NaN, 1)
- NaN(), // pow(NaN, +Pi)
- NaN(), // pow(NaN, NaN)
- }
- var vfpow10SC = []int{
- MinInt32,
- MaxInt32,
- -325,
- 309,
- }
- var pow10SC = []float64{
- 0, // pow10(MinInt32)
- Inf(1), // pow10(MaxInt32)
- 0, // pow10(-325)
- Inf(1), // pow10(309)
- }
- var vfsignbitSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var signbitSC = []bool{
- true,
- true,
- false,
- false,
- false,
- }
- var vfsinSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var sinSC = []float64{
- NaN(),
- Copysign(0, -1),
- 0,
- NaN(),
- NaN(),
- }
- var vfsinhSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var sinhSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var vfsqrtSC = []float64{
- Inf(-1),
- -Pi,
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var sqrtSC = []float64{
- NaN(),
- NaN(),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var vftanhSC = []float64{
- Inf(-1),
- Copysign(0, -1),
- 0,
- Inf(1),
- NaN(),
- }
- var tanhSC = []float64{
- -1,
- Copysign(0, -1),
- 0,
- 1,
- NaN(),
- }
- var vfy0SC = []float64{
- Inf(-1),
- 0,
- Inf(1),
- NaN(),
- }
- var y0SC = []float64{
- NaN(),
- Inf(-1),
- 0,
- NaN(),
- }
- var y1SC = []float64{
- NaN(),
- Inf(-1),
- 0,
- NaN(),
- }
- var y2SC = []float64{
- NaN(),
- Inf(-1),
- 0,
- NaN(),
- }
- var yM3SC = []float64{
- NaN(),
- Inf(1),
- 0,
- NaN(),
- }
- // arguments and expected results for boundary cases
- const (
- SmallestNormalFloat64 = 2.2250738585072014e-308 // 2**-1022
- LargestSubnormalFloat64 = SmallestNormalFloat64 - SmallestNonzeroFloat64
- )
- var vffrexpBC = []float64{
- SmallestNormalFloat64,
- LargestSubnormalFloat64,
- SmallestNonzeroFloat64,
- MaxFloat64,
- -SmallestNormalFloat64,
- -LargestSubnormalFloat64,
- -SmallestNonzeroFloat64,
- -MaxFloat64,
- }
- var frexpBC = []fi{
- {0.5, -1021},
- {0.99999999999999978, -1022},
- {0.5, -1073},
- {0.99999999999999989, 1024},
- {-0.5, -1021},
- {-0.99999999999999978, -1022},
- {-0.5, -1073},
- {-0.99999999999999989, 1024},
- }
- var vfldexpBC = []fi{
- {SmallestNormalFloat64, -52},
- {LargestSubnormalFloat64, -51},
- {SmallestNonzeroFloat64, 1074},
- {MaxFloat64, -(1023 + 1074)},
- {1, -1075},
- {-1, -1075},
- {1, 1024},
- {-1, 1024},
- }
- var ldexpBC = []float64{
- SmallestNonzeroFloat64,
- 1e-323, // 2**-1073
- 1,
- 1e-323, // 2**-1073
- 0,
- Copysign(0, -1),
- Inf(1),
- Inf(-1),
- }
- var logbBC = []float64{
- -1022,
- -1023,
- -1074,
- 1023,
- -1022,
- -1023,
- -1074,
- 1023,
- }
- func tolerance(a, b, e float64) bool {
- d := a - b
- if d < 0 {
- d = -d
- }
- if a != 0 {
- e = e * a
- if e < 0 {
- e = -e
- }
- }
- return d < e
- }
- func kindaclose(a, b float64) bool { return tolerance(a, b, 1e-8) }
- func close(a, b float64) bool { return tolerance(a, b, 1e-14) }
- func veryclose(a, b float64) bool { return tolerance(a, b, 4e-16) }
- func soclose(a, b, e float64) bool { return tolerance(a, b, e) }
- func alike(a, b float64) bool {
- switch {
- case IsNaN(a) && IsNaN(b):
- return true
- case a == b:
- return Signbit(a) == Signbit(b)
- }
- return false
- }
- func TestNaN(t *testing.T) {
- f64 := NaN()
- if f64 == f64 {
- t.Fatalf("NaN() returns %g, expected NaN", f64)
- }
- f32 := float32(f64)
- if f32 == f32 {
- t.Fatalf("float32(NaN()) is %g, expected NaN", f32)
- }
- }
- func TestAcos(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := vf[i] / 10
- if f := Acos(a); !close(acos[i], f) {
- t.Errorf("Acos(%g) = %g, want %g", a, f, acos[i])
- }
- }
- for i := 0; i < len(vfacosSC); i++ {
- if f := Acos(vfacosSC[i]); !alike(acosSC[i], f) {
- t.Errorf("Acos(%g) = %g, want %g", vfacosSC[i], f, acosSC[i])
- }
- }
- }
- func TestAcosh(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := 1 + Abs(vf[i])
- if f := Acosh(a); !veryclose(acosh[i], f) {
- t.Errorf("Acosh(%g) = %g, want %g", a, f, acosh[i])
- }
- }
- for i := 0; i < len(vfacoshSC); i++ {
- if f := Acosh(vfacoshSC[i]); !alike(acoshSC[i], f) {
- t.Errorf("Acosh(%g) = %g, want %g", vfacoshSC[i], f, acoshSC[i])
- }
- }
- }
- func TestAsin(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := vf[i] / 10
- if f := Asin(a); !veryclose(asin[i], f) {
- t.Errorf("Asin(%g) = %g, want %g", a, f, asin[i])
- }
- }
- for i := 0; i < len(vfasinSC); i++ {
- if f := Asin(vfasinSC[i]); !alike(asinSC[i], f) {
- t.Errorf("Asin(%g) = %g, want %g", vfasinSC[i], f, asinSC[i])
- }
- }
- }
- func TestAsinh(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Asinh(vf[i]); !veryclose(asinh[i], f) {
- t.Errorf("Asinh(%g) = %g, want %g", vf[i], f, asinh[i])
- }
- }
- for i := 0; i < len(vfasinhSC); i++ {
- if f := Asinh(vfasinhSC[i]); !alike(asinhSC[i], f) {
- t.Errorf("Asinh(%g) = %g, want %g", vfasinhSC[i], f, asinhSC[i])
- }
- }
- }
- func TestAtan(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Atan(vf[i]); !veryclose(atan[i], f) {
- t.Errorf("Atan(%g) = %g, want %g", vf[i], f, atan[i])
- }
- }
- for i := 0; i < len(vfatanSC); i++ {
- if f := Atan(vfatanSC[i]); !alike(atanSC[i], f) {
- t.Errorf("Atan(%g) = %g, want %g", vfatanSC[i], f, atanSC[i])
- }
- }
- }
- func TestAtanh(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := vf[i] / 10
- if f := Atanh(a); !veryclose(atanh[i], f) {
- t.Errorf("Atanh(%g) = %g, want %g", a, f, atanh[i])
- }
- }
- for i := 0; i < len(vfatanhSC); i++ {
- if f := Atanh(vfatanhSC[i]); !alike(atanhSC[i], f) {
- t.Errorf("Atanh(%g) = %g, want %g", vfatanhSC[i], f, atanhSC[i])
- }
- }
- }
- func TestAtan2(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Atan2(10, vf[i]); !veryclose(atan2[i], f) {
- t.Errorf("Atan2(10, %g) = %g, want %g", vf[i], f, atan2[i])
- }
- }
- for i := 0; i < len(vfatan2SC); i++ {
- if f := Atan2(vfatan2SC[i][0], vfatan2SC[i][1]); !alike(atan2SC[i], f) {
- t.Errorf("Atan2(%g, %g) = %g, want %g", vfatan2SC[i][0], vfatan2SC[i][1], f, atan2SC[i])
- }
- }
- }
- func TestCbrt(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Cbrt(vf[i]); !veryclose(cbrt[i], f) {
- t.Errorf("Cbrt(%g) = %g, want %g", vf[i], f, cbrt[i])
- }
- }
- for i := 0; i < len(vfcbrtSC); i++ {
- if f := Cbrt(vfcbrtSC[i]); !alike(cbrtSC[i], f) {
- t.Errorf("Cbrt(%g) = %g, want %g", vfcbrtSC[i], f, cbrtSC[i])
- }
- }
- }
- func TestCeil(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Ceil(vf[i]); ceil[i] != f {
- t.Errorf("Ceil(%g) = %g, want %g", vf[i], f, ceil[i])
- }
- }
- for i := 0; i < len(vfceilSC); i++ {
- if f := Ceil(vfceilSC[i]); !alike(ceilSC[i], f) {
- t.Errorf("Ceil(%g) = %g, want %g", vfceilSC[i], f, ceilSC[i])
- }
- }
- }
- func TestCopysign(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Copysign(vf[i], -1); copysign[i] != f {
- t.Errorf("Copysign(%g, -1) = %g, want %g", vf[i], f, copysign[i])
- }
- }
- for i := 0; i < len(vf); i++ {
- if f := Copysign(vf[i], 1); -copysign[i] != f {
- t.Errorf("Copysign(%g, 1) = %g, want %g", vf[i], f, -copysign[i])
- }
- }
- for i := 0; i < len(vfcopysignSC); i++ {
- if f := Copysign(vfcopysignSC[i], -1); !alike(copysignSC[i], f) {
- t.Errorf("Copysign(%g, -1) = %g, want %g", vfcopysignSC[i], f, copysignSC[i])
- }
- }
- }
- func TestCos(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Cos(vf[i]); !veryclose(cos[i], f) {
- t.Errorf("Cos(%g) = %g, want %g", vf[i], f, cos[i])
- }
- }
- for i := 0; i < len(vfcosSC); i++ {
- if f := Cos(vfcosSC[i]); !alike(cosSC[i], f) {
- t.Errorf("Cos(%g) = %g, want %g", vfcosSC[i], f, cosSC[i])
- }
- }
- }
- func TestCosh(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Cosh(vf[i]); !close(cosh[i], f) {
- t.Errorf("Cosh(%g) = %g, want %g", vf[i], f, cosh[i])
- }
- }
- for i := 0; i < len(vfcoshSC); i++ {
- if f := Cosh(vfcoshSC[i]); !alike(coshSC[i], f) {
- t.Errorf("Cosh(%g) = %g, want %g", vfcoshSC[i], f, coshSC[i])
- }
- }
- }
- func TestErf(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := vf[i] / 10
- if f := Erf(a); !veryclose(erf[i], f) {
- t.Errorf("Erf(%g) = %g, want %g", a, f, erf[i])
- }
- }
- for i := 0; i < len(vferfSC); i++ {
- if f := Erf(vferfSC[i]); !alike(erfSC[i], f) {
- t.Errorf("Erf(%g) = %g, want %g", vferfSC[i], f, erfSC[i])
- }
- }
- }
- func TestErfc(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := vf[i] / 10
- if f := Erfc(a); !veryclose(erfc[i], f) {
- t.Errorf("Erfc(%g) = %g, want %g", a, f, erfc[i])
- }
- }
- for i := 0; i < len(vferfcSC); i++ {
- if f := Erfc(vferfcSC[i]); !alike(erfcSC[i], f) {
- t.Errorf("Erfc(%g) = %g, want %g", vferfcSC[i], f, erfcSC[i])
- }
- }
- }
- func TestExp(t *testing.T) {
- testExp(t, Exp, "Exp")
- testExp(t, ExpGo, "ExpGo")
- }
- func testExp(t *testing.T, Exp func(float64) float64, name string) {
- for i := 0; i < len(vf); i++ {
- if f := Exp(vf[i]); !close(exp[i], f) {
- t.Errorf("%s(%g) = %g, want %g", name, vf[i], f, exp[i])
- }
- }
- for i := 0; i < len(vfexpSC); i++ {
- if f := Exp(vfexpSC[i]); !alike(expSC[i], f) {
- t.Errorf("%s(%g) = %g, want %g", name, vfexpSC[i], f, expSC[i])
- }
- }
- }
- func TestExpm1(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := vf[i] / 100
- if f := Expm1(a); !veryclose(expm1[i], f) {
- t.Errorf("Expm1(%g) = %g, want %g", a, f, expm1[i])
- }
- }
- for i := 0; i < len(vfexpm1SC); i++ {
- if f := Expm1(vfexpm1SC[i]); !alike(expm1SC[i], f) {
- t.Errorf("Expm1(%g) = %g, want %g", vfexpm1SC[i], f, expm1SC[i])
- }
- }
- }
- func TestExp2(t *testing.T) {
- testExp2(t, Exp2, "Exp2")
- testExp2(t, Exp2Go, "Exp2Go")
- }
- func testExp2(t *testing.T, Exp2 func(float64) float64, name string) {
- for i := 0; i < len(vf); i++ {
- if f := Exp2(vf[i]); !close(exp2[i], f) {
- t.Errorf("%s(%g) = %g, want %g", name, vf[i], f, exp2[i])
- }
- }
- for i := 0; i < len(vfexpSC); i++ {
- if f := Exp2(vfexpSC[i]); !alike(expSC[i], f) {
- t.Errorf("%s(%g) = %g, want %g", name, vfexpSC[i], f, expSC[i])
- }
- }
- for n := -1074; n < 1024; n++ {
- f := Exp2(float64(n))
- vf := Ldexp(1, n)
- if f != vf {
- t.Errorf("%s(%d) = %g, want %g", name, n, f, vf)
- }
- }
- }
- func TestAbs(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Abs(vf[i]); fabs[i] != f {
- t.Errorf("Abs(%g) = %g, want %g", vf[i], f, fabs[i])
- }
- }
- for i := 0; i < len(vffabsSC); i++ {
- if f := Abs(vffabsSC[i]); !alike(fabsSC[i], f) {
- t.Errorf("Abs(%g) = %g, want %g", vffabsSC[i], f, fabsSC[i])
- }
- }
- }
- func TestDim(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Dim(vf[i], 0); fdim[i] != f {
- t.Errorf("Dim(%g, %g) = %g, want %g", vf[i], 0.0, f, fdim[i])
- }
- }
- for i := 0; i < len(vffdimSC); i++ {
- if f := Dim(vffdimSC[i][0], vffdimSC[i][1]); !alike(fdimSC[i], f) {
- t.Errorf("Dim(%g, %g) = %g, want %g", vffdimSC[i][0], vffdimSC[i][1], f, fdimSC[i])
- }
- }
- }
- func TestFloor(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Floor(vf[i]); floor[i] != f {
- t.Errorf("Floor(%g) = %g, want %g", vf[i], f, floor[i])
- }
- }
- for i := 0; i < len(vfceilSC); i++ {
- if f := Floor(vfceilSC[i]); !alike(ceilSC[i], f) {
- t.Errorf("Floor(%g) = %g, want %g", vfceilSC[i], f, ceilSC[i])
- }
- }
- }
- func TestMax(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Max(vf[i], ceil[i]); ceil[i] != f {
- t.Errorf("Max(%g, %g) = %g, want %g", vf[i], ceil[i], f, ceil[i])
- }
- }
- for i := 0; i < len(vffdimSC); i++ {
- if f := Max(vffdimSC[i][0], vffdimSC[i][1]); !alike(fmaxSC[i], f) {
- t.Errorf("Max(%g, %g) = %g, want %g", vffdimSC[i][0], vffdimSC[i][1], f, fmaxSC[i])
- }
- }
- }
- func TestMin(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Min(vf[i], floor[i]); floor[i] != f {
- t.Errorf("Min(%g, %g) = %g, want %g", vf[i], floor[i], f, floor[i])
- }
- }
- for i := 0; i < len(vffdimSC); i++ {
- if f := Min(vffdimSC[i][0], vffdimSC[i][1]); !alike(fminSC[i], f) {
- t.Errorf("Min(%g, %g) = %g, want %g", vffdimSC[i][0], vffdimSC[i][1], f, fminSC[i])
- }
- }
- }
- func TestMod(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Mod(10, vf[i]); fmod[i] != f {
- t.Errorf("Mod(10, %g) = %g, want %g", vf[i], f, fmod[i])
- }
- }
- for i := 0; i < len(vffmodSC); i++ {
- if f := Mod(vffmodSC[i][0], vffmodSC[i][1]); !alike(fmodSC[i], f) {
- t.Errorf("Mod(%g, %g) = %g, want %g", vffmodSC[i][0], vffmodSC[i][1], f, fmodSC[i])
- }
- }
- }
- func TestFrexp(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f, j := Frexp(vf[i]); !veryclose(frexp[i].f, f) || frexp[i].i != j {
- t.Errorf("Frexp(%g) = %g, %d, want %g, %d", vf[i], f, j, frexp[i].f, frexp[i].i)
- }
- }
- for i := 0; i < len(vffrexpSC); i++ {
- if f, j := Frexp(vffrexpSC[i]); !alike(frexpSC[i].f, f) || frexpSC[i].i != j {
- t.Errorf("Frexp(%g) = %g, %d, want %g, %d", vffrexpSC[i], f, j, frexpSC[i].f, frexpSC[i].i)
- }
- }
- for i := 0; i < len(vffrexpBC); i++ {
- if f, j := Frexp(vffrexpBC[i]); !alike(frexpBC[i].f, f) || frexpBC[i].i != j {
- t.Errorf("Frexp(%g) = %g, %d, want %g, %d", vffrexpBC[i], f, j, frexpBC[i].f, frexpBC[i].i)
- }
- }
- }
- func TestGamma(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Gamma(vf[i]); !close(gamma[i], f) {
- t.Errorf("Gamma(%g) = %g, want %g", vf[i], f, gamma[i])
- }
- }
- for i := 0; i < len(vfgammaSC); i++ {
- if f := Gamma(vfgammaSC[i]); !alike(gammaSC[i], f) {
- t.Errorf("Gamma(%g) = %g, want %g", vfgammaSC[i], f, gammaSC[i])
- }
- }
- }
- func TestHypot(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := Abs(1e200 * tanh[i] * Sqrt(2))
- if f := Hypot(1e200*tanh[i], 1e200*tanh[i]); !veryclose(a, f) {
- t.Errorf("Hypot(%g, %g) = %g, want %g", 1e200*tanh[i], 1e200*tanh[i], f, a)
- }
- }
- for i := 0; i < len(vfhypotSC); i++ {
- if f := Hypot(vfhypotSC[i][0], vfhypotSC[i][1]); !alike(hypotSC[i], f) {
- t.Errorf("Hypot(%g, %g) = %g, want %g", vfhypotSC[i][0], vfhypotSC[i][1], f, hypotSC[i])
- }
- }
- }
- func TestHypotGo(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := Abs(1e200 * tanh[i] * Sqrt(2))
- if f := HypotGo(1e200*tanh[i], 1e200*tanh[i]); !veryclose(a, f) {
- t.Errorf("HypotGo(%g, %g) = %g, want %g", 1e200*tanh[i], 1e200*tanh[i], f, a)
- }
- }
- for i := 0; i < len(vfhypotSC); i++ {
- if f := HypotGo(vfhypotSC[i][0], vfhypotSC[i][1]); !alike(hypotSC[i], f) {
- t.Errorf("HypotGo(%g, %g) = %g, want %g", vfhypotSC[i][0], vfhypotSC[i][1], f, hypotSC[i])
- }
- }
- }
- func TestIlogb(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := frexp[i].i - 1 // adjust because fr in the interval [½, 1)
- if e := Ilogb(vf[i]); a != e {
- t.Errorf("Ilogb(%g) = %d, want %d", vf[i], e, a)
- }
- }
- for i := 0; i < len(vflogbSC); i++ {
- if e := Ilogb(vflogbSC[i]); ilogbSC[i] != e {
- t.Errorf("Ilogb(%g) = %d, want %d", vflogbSC[i], e, ilogbSC[i])
- }
- }
- for i := 0; i < len(vffrexpBC); i++ {
- if e := Ilogb(vffrexpBC[i]); int(logbBC[i]) != e {
- t.Errorf("Ilogb(%g) = %d, want %d", vffrexpBC[i], e, int(logbBC[i]))
- }
- }
- }
- func TestJ0(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := J0(vf[i]); !soclose(j0[i], f, 4e-14) {
- t.Errorf("J0(%g) = %g, want %g", vf[i], f, j0[i])
- }
- }
- for i := 0; i < len(vfj0SC); i++ {
- if f := J0(vfj0SC[i]); !alike(j0SC[i], f) {
- t.Errorf("J0(%g) = %g, want %g", vfj0SC[i], f, j0SC[i])
- }
- }
- }
- func TestJ1(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := J1(vf[i]); !close(j1[i], f) {
- t.Errorf("J1(%g) = %g, want %g", vf[i], f, j1[i])
- }
- }
- for i := 0; i < len(vfj0SC); i++ {
- if f := J1(vfj0SC[i]); !alike(j1SC[i], f) {
- t.Errorf("J1(%g) = %g, want %g", vfj0SC[i], f, j1SC[i])
- }
- }
- }
- func TestJn(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Jn(2, vf[i]); !close(j2[i], f) {
- t.Errorf("Jn(2, %g) = %g, want %g", vf[i], f, j2[i])
- }
- if f := Jn(-3, vf[i]); !close(jM3[i], f) {
- t.Errorf("Jn(-3, %g) = %g, want %g", vf[i], f, jM3[i])
- }
- }
- for i := 0; i < len(vfj0SC); i++ {
- if f := Jn(2, vfj0SC[i]); !alike(j2SC[i], f) {
- t.Errorf("Jn(2, %g) = %g, want %g", vfj0SC[i], f, j2SC[i])
- }
- if f := Jn(-3, vfj0SC[i]); !alike(jM3SC[i], f) {
- t.Errorf("Jn(-3, %g) = %g, want %g", vfj0SC[i], f, jM3SC[i])
- }
- }
- }
- func TestLdexp(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Ldexp(frexp[i].f, frexp[i].i); !veryclose(vf[i], f) {
- t.Errorf("Ldexp(%g, %d) = %g, want %g", frexp[i].f, frexp[i].i, f, vf[i])
- }
- }
- for i := 0; i < len(vffrexpSC); i++ {
- if f := Ldexp(frexpSC[i].f, frexpSC[i].i); !alike(vffrexpSC[i], f) {
- t.Errorf("Ldexp(%g, %d) = %g, want %g", frexpSC[i].f, frexpSC[i].i, f, vffrexpSC[i])
- }
- }
- for i := 0; i < len(vfldexpSC); i++ {
- if f := Ldexp(vfldexpSC[i].f, vfldexpSC[i].i); !alike(ldexpSC[i], f) {
- t.Errorf("Ldexp(%g, %d) = %g, want %g", vfldexpSC[i].f, vfldexpSC[i].i, f, ldexpSC[i])
- }
- }
- for i := 0; i < len(vffrexpBC); i++ {
- if f := Ldexp(frexpBC[i].f, frexpBC[i].i); !alike(vffrexpBC[i], f) {
- t.Errorf("Ldexp(%g, %d) = %g, want %g", frexpBC[i].f, frexpBC[i].i, f, vffrexpBC[i])
- }
- }
- for i := 0; i < len(vfldexpBC); i++ {
- if f := Ldexp(vfldexpBC[i].f, vfldexpBC[i].i); !alike(ldexpBC[i], f) {
- t.Errorf("Ldexp(%g, %d) = %g, want %g", vfldexpBC[i].f, vfldexpBC[i].i, f, ldexpBC[i])
- }
- }
- }
- func TestLgamma(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f, s := Lgamma(vf[i]); !close(lgamma[i].f, f) || lgamma[i].i != s {
- t.Errorf("Lgamma(%g) = %g, %d, want %g, %d", vf[i], f, s, lgamma[i].f, lgamma[i].i)
- }
- }
- for i := 0; i < len(vflgammaSC); i++ {
- if f, s := Lgamma(vflgammaSC[i]); !alike(lgammaSC[i].f, f) || lgammaSC[i].i != s {
- t.Errorf("Lgamma(%g) = %g, %d, want %g, %d", vflgammaSC[i], f, s, lgammaSC[i].f, lgammaSC[i].i)
- }
- }
- }
- func TestLog(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := Abs(vf[i])
- if f := Log(a); log[i] != f {
- t.Errorf("Log(%g) = %g, want %g", a, f, log[i])
- }
- }
- if f := Log(10); f != Ln10 {
- t.Errorf("Log(%g) = %g, want %g", 10.0, f, Ln10)
- }
- for i := 0; i < len(vflogSC); i++ {
- if f := Log(vflogSC[i]); !alike(logSC[i], f) {
- t.Errorf("Log(%g) = %g, want %g", vflogSC[i], f, logSC[i])
- }
- }
- }
- func TestLogb(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Logb(vf[i]); logb[i] != f {
- t.Errorf("Logb(%g) = %g, want %g", vf[i], f, logb[i])
- }
- }
- for i := 0; i < len(vflogbSC); i++ {
- if f := Logb(vflogbSC[i]); !alike(logbSC[i], f) {
- t.Errorf("Logb(%g) = %g, want %g", vflogbSC[i], f, logbSC[i])
- }
- }
- for i := 0; i < len(vffrexpBC); i++ {
- if f := Logb(vffrexpBC[i]); !alike(logbBC[i], f) {
- t.Errorf("Logb(%g) = %g, want %g", vffrexpBC[i], f, logbBC[i])
- }
- }
- }
- func TestLog10(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := Abs(vf[i])
- if f := Log10(a); !veryclose(log10[i], f) {
- t.Errorf("Log10(%g) = %g, want %g", a, f, log10[i])
- }
- }
- if f := Log10(E); f != Log10E {
- t.Errorf("Log10(%g) = %g, want %g", E, f, Log10E)
- }
- for i := 0; i < len(vflogSC); i++ {
- if f := Log10(vflogSC[i]); !alike(logSC[i], f) {
- t.Errorf("Log10(%g) = %g, want %g", vflogSC[i], f, logSC[i])
- }
- }
- }
- func TestLog1p(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := vf[i] / 100
- if f := Log1p(a); !veryclose(log1p[i], f) {
- t.Errorf("Log1p(%g) = %g, want %g", a, f, log1p[i])
- }
- }
- a := 9.0
- if f := Log1p(a); f != Ln10 {
- t.Errorf("Log1p(%g) = %g, want %g", a, f, Ln10)
- }
- for i := 0; i < len(vflogSC); i++ {
- if f := Log1p(vflog1pSC[i]); !alike(log1pSC[i], f) {
- t.Errorf("Log1p(%g) = %g, want %g", vflog1pSC[i], f, log1pSC[i])
- }
- }
- }
- func TestLog2(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := Abs(vf[i])
- if f := Log2(a); !veryclose(log2[i], f) {
- t.Errorf("Log2(%g) = %g, want %g", a, f, log2[i])
- }
- }
- if f := Log2(E); f != Log2E {
- t.Errorf("Log2(%g) = %g, want %g", E, f, Log2E)
- }
- for i := 0; i < len(vflogSC); i++ {
- if f := Log2(vflogSC[i]); !alike(logSC[i], f) {
- t.Errorf("Log2(%g) = %g, want %g", vflogSC[i], f, logSC[i])
- }
- }
- for i := -1074; i <= 1023; i++ {
- f := Ldexp(1, i)
- l := Log2(f)
- if l != float64(i) {
- t.Errorf("Log2(2**%d) = %g, want %d", i, l, i)
- }
- }
- }
- func TestModf(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f, g := Modf(vf[i]); !veryclose(modf[i][0], f) || !veryclose(modf[i][1], g) {
- t.Errorf("Modf(%g) = %g, %g, want %g, %g", vf[i], f, g, modf[i][0], modf[i][1])
- }
- }
- for i := 0; i < len(vfmodfSC); i++ {
- if f, g := Modf(vfmodfSC[i]); !alike(modfSC[i][0], f) || !alike(modfSC[i][1], g) {
- t.Errorf("Modf(%g) = %g, %g, want %g, %g", vfmodfSC[i], f, g, modfSC[i][0], modfSC[i][1])
- }
- }
- }
- func TestNextafter32(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- vfi := float32(vf[i])
- if f := Nextafter32(vfi, 10); nextafter32[i] != f {
- t.Errorf("Nextafter32(%g, %g) = %g want %g", vfi, 10.0, f, nextafter32[i])
- }
- }
- for i := 0; i < len(vfnextafter32SC); i++ {
- if f := Nextafter32(vfnextafter32SC[i][0], vfnextafter32SC[i][1]); !alike(float64(nextafter32SC[i]), float64(f)) {
- t.Errorf("Nextafter32(%g, %g) = %g want %g", vfnextafter32SC[i][0], vfnextafter32SC[i][1], f, nextafter32SC[i])
- }
- }
- }
- func TestNextafter64(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Nextafter(vf[i], 10); nextafter64[i] != f {
- t.Errorf("Nextafter64(%g, %g) = %g want %g", vf[i], 10.0, f, nextafter64[i])
- }
- }
- for i := 0; i < len(vfnextafter64SC); i++ {
- if f := Nextafter(vfnextafter64SC[i][0], vfnextafter64SC[i][1]); !alike(nextafter64SC[i], f) {
- t.Errorf("Nextafter64(%g, %g) = %g want %g", vfnextafter64SC[i][0], vfnextafter64SC[i][1], f, nextafter64SC[i])
- }
- }
- }
- func TestPow(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Pow(10, vf[i]); !close(pow[i], f) {
- t.Errorf("Pow(10, %g) = %g, want %g", vf[i], f, pow[i])
- }
- }
- for i := 0; i < len(vfpowSC); i++ {
- if f := Pow(vfpowSC[i][0], vfpowSC[i][1]); !alike(powSC[i], f) {
- t.Errorf("Pow(%g, %g) = %g, want %g", vfpowSC[i][0], vfpowSC[i][1], f, powSC[i])
- }
- }
- }
- func TestPow10(t *testing.T) {
- for i := 0; i < len(vfpow10SC); i++ {
- if f := Pow10(vfpow10SC[i]); !alike(pow10SC[i], f) {
- t.Errorf("Pow10(%d) = %g, want %g", vfpow10SC[i], f, pow10SC[i])
- }
- }
- }
- func TestRemainder(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Remainder(10, vf[i]); remainder[i] != f {
- t.Errorf("Remainder(10, %g) = %g, want %g", vf[i], f, remainder[i])
- }
- }
- for i := 0; i < len(vffmodSC); i++ {
- if f := Remainder(vffmodSC[i][0], vffmodSC[i][1]); !alike(fmodSC[i], f) {
- t.Errorf("Remainder(%g, %g) = %g, want %g", vffmodSC[i][0], vffmodSC[i][1], f, fmodSC[i])
- }
- }
- }
- func TestSignbit(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Signbit(vf[i]); signbit[i] != f {
- t.Errorf("Signbit(%g) = %t, want %t", vf[i], f, signbit[i])
- }
- }
- for i := 0; i < len(vfsignbitSC); i++ {
- if f := Signbit(vfsignbitSC[i]); signbitSC[i] != f {
- t.Errorf("Signbit(%g) = %t, want %t", vfsignbitSC[i], f, signbitSC[i])
- }
- }
- }
- func TestSin(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Sin(vf[i]); !veryclose(sin[i], f) {
- t.Errorf("Sin(%g) = %g, want %g", vf[i], f, sin[i])
- }
- }
- for i := 0; i < len(vfsinSC); i++ {
- if f := Sin(vfsinSC[i]); !alike(sinSC[i], f) {
- t.Errorf("Sin(%g) = %g, want %g", vfsinSC[i], f, sinSC[i])
- }
- }
- }
- func TestSincos(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if s, c := Sincos(vf[i]); !veryclose(sin[i], s) || !veryclose(cos[i], c) {
- t.Errorf("Sincos(%g) = %g, %g want %g, %g", vf[i], s, c, sin[i], cos[i])
- }
- }
- }
- func TestSinh(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Sinh(vf[i]); !close(sinh[i], f) {
- t.Errorf("Sinh(%g) = %g, want %g", vf[i], f, sinh[i])
- }
- }
- for i := 0; i < len(vfsinhSC); i++ {
- if f := Sinh(vfsinhSC[i]); !alike(sinhSC[i], f) {
- t.Errorf("Sinh(%g) = %g, want %g", vfsinhSC[i], f, sinhSC[i])
- }
- }
- }
- func TestSqrt(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := Abs(vf[i])
- if f := SqrtGo(a); sqrt[i] != f {
- t.Errorf("SqrtGo(%g) = %g, want %g", a, f, sqrt[i])
- }
- a = Abs(vf[i])
- if f := Sqrt(a); sqrt[i] != f {
- t.Errorf("Sqrt(%g) = %g, want %g", a, f, sqrt[i])
- }
- }
- for i := 0; i < len(vfsqrtSC); i++ {
- if f := SqrtGo(vfsqrtSC[i]); !alike(sqrtSC[i], f) {
- t.Errorf("SqrtGo(%g) = %g, want %g", vfsqrtSC[i], f, sqrtSC[i])
- }
- if f := Sqrt(vfsqrtSC[i]); !alike(sqrtSC[i], f) {
- t.Errorf("Sqrt(%g) = %g, want %g", vfsqrtSC[i], f, sqrtSC[i])
- }
- }
- }
- func TestTan(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Tan(vf[i]); !veryclose(tan[i], f) {
- t.Errorf("Tan(%g) = %g, want %g", vf[i], f, tan[i])
- }
- }
- // same special cases as Sin
- for i := 0; i < len(vfsinSC); i++ {
- if f := Tan(vfsinSC[i]); !alike(sinSC[i], f) {
- t.Errorf("Tan(%g) = %g, want %g", vfsinSC[i], f, sinSC[i])
- }
- }
- }
- func TestTanh(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Tanh(vf[i]); !veryclose(tanh[i], f) {
- t.Errorf("Tanh(%g) = %g, want %g", vf[i], f, tanh[i])
- }
- }
- for i := 0; i < len(vftanhSC); i++ {
- if f := Tanh(vftanhSC[i]); !alike(tanhSC[i], f) {
- t.Errorf("Tanh(%g) = %g, want %g", vftanhSC[i], f, tanhSC[i])
- }
- }
- }
- func TestTrunc(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- if f := Trunc(vf[i]); trunc[i] != f {
- t.Errorf("Trunc(%g) = %g, want %g", vf[i], f, trunc[i])
- }
- }
- for i := 0; i < len(vfceilSC); i++ {
- if f := Trunc(vfceilSC[i]); !alike(ceilSC[i], f) {
- t.Errorf("Trunc(%g) = %g, want %g", vfceilSC[i], f, ceilSC[i])
- }
- }
- }
- func TestY0(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := Abs(vf[i])
- if f := Y0(a); !close(y0[i], f) {
- t.Errorf("Y0(%g) = %g, want %g", a, f, y0[i])
- }
- }
- for i := 0; i < len(vfy0SC); i++ {
- if f := Y0(vfy0SC[i]); !alike(y0SC[i], f) {
- t.Errorf("Y0(%g) = %g, want %g", vfy0SC[i], f, y0SC[i])
- }
- }
- }
- func TestY1(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := Abs(vf[i])
- if f := Y1(a); !soclose(y1[i], f, 2e-14) {
- t.Errorf("Y1(%g) = %g, want %g", a, f, y1[i])
- }
- }
- for i := 0; i < len(vfy0SC); i++ {
- if f := Y1(vfy0SC[i]); !alike(y1SC[i], f) {
- t.Errorf("Y1(%g) = %g, want %g", vfy0SC[i], f, y1SC[i])
- }
- }
- }
- func TestYn(t *testing.T) {
- for i := 0; i < len(vf); i++ {
- a := Abs(vf[i])
- if f := Yn(2, a); !close(y2[i], f) {
- t.Errorf("Yn(2, %g) = %g, want %g", a, f, y2[i])
- }
- if f := Yn(-3, a); !close(yM3[i], f) {
- t.Errorf("Yn(-3, %g) = %g, want %g", a, f, yM3[i])
- }
- }
- for i := 0; i < len(vfy0SC); i++ {
- if f := Yn(2, vfy0SC[i]); !alike(y2SC[i], f) {
- t.Errorf("Yn(2, %g) = %g, want %g", vfy0SC[i], f, y2SC[i])
- }
- if f := Yn(-3, vfy0SC[i]); !alike(yM3SC[i], f) {
- t.Errorf("Yn(-3, %g) = %g, want %g", vfy0SC[i], f, yM3SC[i])
- }
- }
- }
- // Check that math functions of high angle values
- // return accurate results. [Since (vf[i] + large) - large != vf[i],
- // testing for Trig(vf[i] + large) == Trig(vf[i]), where large is
- // a multiple of 2*Pi, is misleading.]
- func TestLargeCos(t *testing.T) {
- large := float64(100000 * Pi)
- for i := 0; i < len(vf); i++ {
- f1 := cosLarge[i]
- f2 := Cos(vf[i] + large)
- if !close(f1, f2) {
- t.Errorf("Cos(%g) = %g, want %g", vf[i]+large, f2, f1)
- }
- }
- }
- func TestLargeSin(t *testing.T) {
- large := float64(100000 * Pi)
- for i := 0; i < len(vf); i++ {
- f1 := sinLarge[i]
- f2 := Sin(vf[i] + large)
- if !close(f1, f2) {
- t.Errorf("Sin(%g) = %g, want %g", vf[i]+large, f2, f1)
- }
- }
- }
- func TestLargeSincos(t *testing.T) {
- large := float64(100000 * Pi)
- for i := 0; i < len(vf); i++ {
- f1, g1 := sinLarge[i], cosLarge[i]
- f2, g2 := Sincos(vf[i] + large)
- if !close(f1, f2) || !close(g1, g2) {
- t.Errorf("Sincos(%g) = %g, %g, want %g, %g", vf[i]+large, f2, g2, f1, g1)
- }
- }
- }
- func TestLargeTan(t *testing.T) {
- large := float64(100000 * Pi)
- for i := 0; i < len(vf); i++ {
- f1 := tanLarge[i]
- f2 := Tan(vf[i] + large)
- if !close(f1, f2) {
- t.Errorf("Tan(%g) = %g, want %g", vf[i]+large, f2, f1)
- }
- }
- }
- // Check that math constants are accepted by compiler
- // and have right value (assumes strconv.ParseFloat works).
- // http://code.google.com/p/go/issues/detail?id=201
- type floatTest struct {
- val interface{}
- name string
- str string
- }
- var floatTests = []floatTest{
- {float64(MaxFloat64), "MaxFloat64", "1.7976931348623157e+308"},
- {float64(SmallestNonzeroFloat64), "SmallestNonzeroFloat64", "5e-324"},
- {float32(MaxFloat32), "MaxFloat32", "3.4028235e+38"},
- {float32(SmallestNonzeroFloat32), "SmallestNonzeroFloat32", "1e-45"},
- }
- func TestFloatMinMax(t *testing.T) {
- for _, tt := range floatTests {
- s := fmt.Sprint(tt.val)
- if s != tt.str {
- t.Errorf("Sprint(%v) = %s, want %s", tt.name, s, tt.str)
- }
- }
- }
- // Benchmarks
- func BenchmarkAcos(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Acos(.5)
- }
- }
- func BenchmarkAcosh(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Acosh(1.5)
- }
- }
- func BenchmarkAsin(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Asin(.5)
- }
- }
- func BenchmarkAsinh(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Asinh(.5)
- }
- }
- func BenchmarkAtan(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Atan(.5)
- }
- }
- func BenchmarkAtanh(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Atanh(.5)
- }
- }
- func BenchmarkAtan2(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Atan2(.5, 1)
- }
- }
- func BenchmarkCbrt(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Cbrt(10)
- }
- }
- func BenchmarkCeil(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Ceil(.5)
- }
- }
- func BenchmarkCopysign(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Copysign(.5, -1)
- }
- }
- func BenchmarkCos(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Cos(.5)
- }
- }
- func BenchmarkCosh(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Cosh(2.5)
- }
- }
- func BenchmarkErf(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Erf(.5)
- }
- }
- func BenchmarkErfc(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Erfc(.5)
- }
- }
- func BenchmarkExp(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Exp(.5)
- }
- }
- func BenchmarkExpGo(b *testing.B) {
- for i := 0; i < b.N; i++ {
- ExpGo(.5)
- }
- }
- func BenchmarkExpm1(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Expm1(.5)
- }
- }
- func BenchmarkExp2(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Exp2(.5)
- }
- }
- func BenchmarkExp2Go(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Exp2Go(.5)
- }
- }
- func BenchmarkAbs(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Abs(.5)
- }
- }
- func BenchmarkDim(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Dim(10, 3)
- }
- }
- func BenchmarkFloor(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Floor(.5)
- }
- }
- func BenchmarkMax(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Max(10, 3)
- }
- }
- func BenchmarkMin(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Min(10, 3)
- }
- }
- func BenchmarkMod(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Mod(10, 3)
- }
- }
- func BenchmarkFrexp(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Frexp(8)
- }
- }
- func BenchmarkGamma(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Gamma(2.5)
- }
- }
- func BenchmarkHypot(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Hypot(3, 4)
- }
- }
- func BenchmarkHypotGo(b *testing.B) {
- for i := 0; i < b.N; i++ {
- HypotGo(3, 4)
- }
- }
- func BenchmarkIlogb(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Ilogb(.5)
- }
- }
- func BenchmarkJ0(b *testing.B) {
- for i := 0; i < b.N; i++ {
- J0(2.5)
- }
- }
- func BenchmarkJ1(b *testing.B) {
- for i := 0; i < b.N; i++ {
- J1(2.5)
- }
- }
- func BenchmarkJn(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Jn(2, 2.5)
- }
- }
- func BenchmarkLdexp(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Ldexp(.5, 2)
- }
- }
- func BenchmarkLgamma(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Lgamma(2.5)
- }
- }
- func BenchmarkLog(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Log(.5)
- }
- }
- func BenchmarkLogb(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Logb(.5)
- }
- }
- func BenchmarkLog1p(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Log1p(.5)
- }
- }
- func BenchmarkLog10(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Log10(.5)
- }
- }
- func BenchmarkLog2(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Log2(.5)
- }
- }
- func BenchmarkModf(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Modf(1.5)
- }
- }
- func BenchmarkNextafter32(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Nextafter32(.5, 1)
- }
- }
- func BenchmarkNextafter64(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Nextafter(.5, 1)
- }
- }
- func BenchmarkPowInt(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Pow(2, 2)
- }
- }
- func BenchmarkPowFrac(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Pow(2.5, 1.5)
- }
- }
- func BenchmarkPow10Pos(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Pow10(300)
- }
- }
- func BenchmarkPow10Neg(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Pow10(-300)
- }
- }
- func BenchmarkRemainder(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Remainder(10, 3)
- }
- }
- func BenchmarkSignbit(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Signbit(2.5)
- }
- }
- func BenchmarkSin(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Sin(.5)
- }
- }
- func BenchmarkSincos(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Sincos(.5)
- }
- }
- func BenchmarkSinh(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Sinh(2.5)
- }
- }
- func BenchmarkSqrt(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Sqrt(10)
- }
- }
- func BenchmarkSqrtGo(b *testing.B) {
- for i := 0; i < b.N; i++ {
- SqrtGo(10)
- }
- }
- func BenchmarkTan(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Tan(.5)
- }
- }
- func BenchmarkTanh(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Tanh(2.5)
- }
- }
- func BenchmarkTrunc(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Trunc(.5)
- }
- }
- func BenchmarkY0(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Y0(2.5)
- }
- }
- func BenchmarkY1(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Y1(2.5)
- }
- }
- func BenchmarkYn(b *testing.B) {
- for i := 0; i < b.N; i++ {
- Yn(2, 2.5)
- }
- }
|