libgo, compiler: Upgrade libgo to Go 1.4, except for runtime.
[official-gcc.git] / libgo / go / math / all_test.go
blob763efb2e647a4d032fd8052ccc83978320cf7f07
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package math_test
7 import (
8 "fmt"
9 . "math"
10 "testing"
13 var vf = []float64{
14 4.9790119248836735e+00,
15 7.7388724745781045e+00,
16 -2.7688005719200159e-01,
17 -5.0106036182710749e+00,
18 9.6362937071984173e+00,
19 2.9263772392439646e+00,
20 5.2290834314593066e+00,
21 2.7279399104360102e+00,
22 1.8253080916808550e+00,
23 -8.6859247685756013e+00,
26 // The expected results below were computed by the high precision calculators
27 // at http://keisan.casio.com/. More exact input values (array vf[], above)
28 // were obtained by printing them with "%.26f". The answers were calculated
29 // to 26 digits (by using the "Digit number" drop-down control of each
30 // calculator).
31 var acos = []float64{
32 1.0496193546107222142571536e+00,
33 6.8584012813664425171660692e-01,
34 1.5984878714577160325521819e+00,
35 2.0956199361475859327461799e+00,
36 2.7053008467824138592616927e-01,
37 1.2738121680361776018155625e+00,
38 1.0205369421140629186287407e+00,
39 1.2945003481781246062157835e+00,
40 1.3872364345374451433846657e+00,
41 2.6231510803970463967294145e+00,
43 var acosh = []float64{
44 2.4743347004159012494457618e+00,
45 2.8576385344292769649802701e+00,
46 7.2796961502981066190593175e-01,
47 2.4796794418831451156471977e+00,
48 3.0552020742306061857212962e+00,
49 2.044238592688586588942468e+00,
50 2.5158701513104513595766636e+00,
51 1.99050839282411638174299e+00,
52 1.6988625798424034227205445e+00,
53 2.9611454842470387925531875e+00,
55 var asin = []float64{
56 5.2117697218417440497416805e-01,
57 8.8495619865825236751471477e-01,
58 -02.769154466281941332086016e-02,
59 -5.2482360935268931351485822e-01,
60 1.3002662421166552333051524e+00,
61 2.9698415875871901741575922e-01,
62 5.5025938468083370060258102e-01,
63 2.7629597861677201301553823e-01,
64 1.83559892257451475846656e-01,
65 -1.0523547536021497774980928e+00,
67 var asinh = []float64{
68 2.3083139124923523427628243e+00,
69 2.743551594301593620039021e+00,
70 -2.7345908534880091229413487e-01,
71 -2.3145157644718338650499085e+00,
72 2.9613652154015058521951083e+00,
73 1.7949041616585821933067568e+00,
74 2.3564032905983506405561554e+00,
75 1.7287118790768438878045346e+00,
76 1.3626658083714826013073193e+00,
77 -2.8581483626513914445234004e+00,
79 var atan = []float64{
80 1.372590262129621651920085e+00,
81 1.442290609645298083020664e+00,
82 -2.7011324359471758245192595e-01,
83 -1.3738077684543379452781531e+00,
84 1.4673921193587666049154681e+00,
85 1.2415173565870168649117764e+00,
86 1.3818396865615168979966498e+00,
87 1.2194305844639670701091426e+00,
88 1.0696031952318783760193244e+00,
89 -1.4561721938838084990898679e+00,
91 var atanh = []float64{
92 5.4651163712251938116878204e-01,
93 1.0299474112843111224914709e+00,
94 -2.7695084420740135145234906e-02,
95 -5.5072096119207195480202529e-01,
96 1.9943940993171843235906642e+00,
97 3.01448604578089708203017e-01,
98 5.8033427206942188834370595e-01,
99 2.7987997499441511013958297e-01,
100 1.8459947964298794318714228e-01,
101 -1.3273186910532645867272502e+00,
103 var atan2 = []float64{
104 1.1088291730037004444527075e+00,
105 9.1218183188715804018797795e-01,
106 1.5984772603216203736068915e+00,
107 2.0352918654092086637227327e+00,
108 8.0391819139044720267356014e-01,
109 1.2861075249894661588866752e+00,
110 1.0889904479131695712182587e+00,
111 1.3044821793397925293797357e+00,
112 1.3902530903455392306872261e+00,
113 2.2859857424479142655411058e+00,
115 var cbrt = []float64{
116 1.7075799841925094446722675e+00,
117 1.9779982212970353936691498e+00,
118 -6.5177429017779910853339447e-01,
119 -1.7111838886544019873338113e+00,
120 2.1279920909827937423960472e+00,
121 1.4303536770460741452312367e+00,
122 1.7357021059106154902341052e+00,
123 1.3972633462554328350552916e+00,
124 1.2221149580905388454977636e+00,
125 -2.0556003730500069110343596e+00,
127 var ceil = []float64{
128 5.0000000000000000e+00,
129 8.0000000000000000e+00,
130 0.0000000000000000e+00,
131 -5.0000000000000000e+00,
132 1.0000000000000000e+01,
133 3.0000000000000000e+00,
134 6.0000000000000000e+00,
135 3.0000000000000000e+00,
136 2.0000000000000000e+00,
137 -8.0000000000000000e+00,
139 var copysign = []float64{
140 -4.9790119248836735e+00,
141 -7.7388724745781045e+00,
142 -2.7688005719200159e-01,
143 -5.0106036182710749e+00,
144 -9.6362937071984173e+00,
145 -2.9263772392439646e+00,
146 -5.2290834314593066e+00,
147 -2.7279399104360102e+00,
148 -1.8253080916808550e+00,
149 -8.6859247685756013e+00,
151 var cos = []float64{
152 2.634752140995199110787593e-01,
153 1.148551260848219865642039e-01,
154 9.6191297325640768154550453e-01,
155 2.938141150061714816890637e-01,
156 -9.777138189897924126294461e-01,
157 -9.7693041344303219127199518e-01,
158 4.940088096948647263961162e-01,
159 -9.1565869021018925545016502e-01,
160 -2.517729313893103197176091e-01,
161 -7.39241351595676573201918e-01,
164 // Results for 100000 * Pi + vf[i]
165 var cosLarge = []float64{
166 2.634752141185559426744e-01,
167 1.14855126055543100712e-01,
168 9.61912973266488928113e-01,
169 2.9381411499556122552e-01,
170 -9.777138189880161924641e-01,
171 -9.76930413445147608049e-01,
172 4.940088097314976789841e-01,
173 -9.15658690217517835002e-01,
174 -2.51772931436786954751e-01,
175 -7.3924135157173099849e-01,
177 var cosh = []float64{
178 7.2668796942212842775517446e+01,
179 1.1479413465659254502011135e+03,
180 1.0385767908766418550935495e+00,
181 7.5000957789658051428857788e+01,
182 7.655246669605357888468613e+03,
183 9.3567491758321272072888257e+00,
184 9.331351599270605471131735e+01,
185 7.6833430994624643209296404e+00,
186 3.1829371625150718153881164e+00,
187 2.9595059261916188501640911e+03,
189 var erf = []float64{
190 5.1865354817738701906913566e-01,
191 7.2623875834137295116929844e-01,
192 -3.123458688281309990629839e-02,
193 -5.2143121110253302920437013e-01,
194 8.2704742671312902508629582e-01,
195 3.2101767558376376743993945e-01,
196 5.403990312223245516066252e-01,
197 3.0034702916738588551174831e-01,
198 2.0369924417882241241559589e-01,
199 -7.8069386968009226729944677e-01,
201 var erfc = []float64{
202 4.8134645182261298093086434e-01,
203 2.7376124165862704883070156e-01,
204 1.0312345868828130999062984e+00,
205 1.5214312111025330292043701e+00,
206 1.7295257328687097491370418e-01,
207 6.7898232441623623256006055e-01,
208 4.596009687776754483933748e-01,
209 6.9965297083261411448825169e-01,
210 7.9630075582117758758440411e-01,
211 1.7806938696800922672994468e+00,
213 var exp = []float64{
214 1.4533071302642137507696589e+02,
215 2.2958822575694449002537581e+03,
216 7.5814542574851666582042306e-01,
217 6.6668778421791005061482264e-03,
218 1.5310493273896033740861206e+04,
219 1.8659907517999328638667732e+01,
220 1.8662167355098714543942057e+02,
221 1.5301332413189378961665788e+01,
222 6.2047063430646876349125085e+00,
223 1.6894712385826521111610438e-04,
225 var expm1 = []float64{
226 5.105047796122957327384770212e-02,
227 8.046199708567344080562675439e-02,
228 -2.764970978891639815187418703e-03,
229 -4.8871434888875355394330300273e-02,
230 1.0115864277221467777117227494e-01,
231 2.969616407795910726014621657e-02,
232 5.368214487944892300914037972e-02,
233 2.765488851131274068067445335e-02,
234 1.842068661871398836913874273e-02,
235 -8.3193870863553801814961137573e-02,
237 var exp2 = []float64{
238 3.1537839463286288034313104e+01,
239 2.1361549283756232296144849e+02,
240 8.2537402562185562902577219e-01,
241 3.1021158628740294833424229e-02,
242 7.9581744110252191462569661e+02,
243 7.6019905892596359262696423e+00,
244 3.7506882048388096973183084e+01,
245 6.6250893439173561733216375e+00,
246 3.5438267900243941544605339e+00,
247 2.4281533133513300984289196e-03,
249 var fabs = []float64{
250 4.9790119248836735e+00,
251 7.7388724745781045e+00,
252 2.7688005719200159e-01,
253 5.0106036182710749e+00,
254 9.6362937071984173e+00,
255 2.9263772392439646e+00,
256 5.2290834314593066e+00,
257 2.7279399104360102e+00,
258 1.8253080916808550e+00,
259 8.6859247685756013e+00,
261 var fdim = []float64{
262 4.9790119248836735e+00,
263 7.7388724745781045e+00,
264 0.0000000000000000e+00,
265 0.0000000000000000e+00,
266 9.6362937071984173e+00,
267 2.9263772392439646e+00,
268 5.2290834314593066e+00,
269 2.7279399104360102e+00,
270 1.8253080916808550e+00,
271 0.0000000000000000e+00,
273 var floor = []float64{
274 4.0000000000000000e+00,
275 7.0000000000000000e+00,
276 -1.0000000000000000e+00,
277 -6.0000000000000000e+00,
278 9.0000000000000000e+00,
279 2.0000000000000000e+00,
280 5.0000000000000000e+00,
281 2.0000000000000000e+00,
282 1.0000000000000000e+00,
283 -9.0000000000000000e+00,
285 var fmod = []float64{
286 4.197615023265299782906368e-02,
287 2.261127525421895434476482e+00,
288 3.231794108794261433104108e-02,
289 4.989396381728925078391512e+00,
290 3.637062928015826201999516e-01,
291 1.220868282268106064236690e+00,
292 4.770916568540693347699744e+00,
293 1.816180268691969246219742e+00,
294 8.734595415957246977711748e-01,
295 1.314075231424398637614104e+00,
298 type fi struct {
299 f float64
300 i int
303 var frexp = []fi{
304 {6.2237649061045918750e-01, 3},
305 {9.6735905932226306250e-01, 3},
306 {-5.5376011438400318000e-01, -1},
307 {-6.2632545228388436250e-01, 3},
308 {6.02268356699901081250e-01, 4},
309 {7.3159430981099115000e-01, 2},
310 {6.5363542893241332500e-01, 3},
311 {6.8198497760900255000e-01, 2},
312 {9.1265404584042750000e-01, 1},
313 {-5.4287029803597508250e-01, 4},
315 var gamma = []float64{
316 2.3254348370739963835386613898e+01,
317 2.991153837155317076427529816e+03,
318 -4.561154336726758060575129109e+00,
319 7.719403468842639065959210984e-01,
320 1.6111876618855418534325755566e+05,
321 1.8706575145216421164173224946e+00,
322 3.4082787447257502836734201635e+01,
323 1.579733951448952054898583387e+00,
324 9.3834586598354592860187267089e-01,
325 -2.093995902923148389186189429e-05,
327 var j0 = []float64{
328 -1.8444682230601672018219338e-01,
329 2.27353668906331975435892e-01,
330 9.809259936157051116270273e-01,
331 -1.741170131426226587841181e-01,
332 -2.1389448451144143352039069e-01,
333 -2.340905848928038763337414e-01,
334 -1.0029099691890912094586326e-01,
335 -1.5466726714884328135358907e-01,
336 3.252650187653420388714693e-01,
337 -8.72218484409407250005360235e-03,
339 var j1 = []float64{
340 -3.251526395295203422162967e-01,
341 1.893581711430515718062564e-01,
342 -1.3711761352467242914491514e-01,
343 3.287486536269617297529617e-01,
344 1.3133899188830978473849215e-01,
345 3.660243417832986825301766e-01,
346 -3.4436769271848174665420672e-01,
347 4.329481396640773768835036e-01,
348 5.8181350531954794639333955e-01,
349 -2.7030574577733036112996607e-01,
351 var j2 = []float64{
352 5.3837518920137802565192769e-02,
353 -1.7841678003393207281244667e-01,
354 9.521746934916464142495821e-03,
355 4.28958355470987397983072e-02,
356 2.4115371837854494725492872e-01,
357 4.842458532394520316844449e-01,
358 -3.142145220618633390125946e-02,
359 4.720849184745124761189957e-01,
360 3.122312022520957042957497e-01,
361 7.096213118930231185707277e-02,
363 var jM3 = []float64{
364 -3.684042080996403091021151e-01,
365 2.8157665936340887268092661e-01,
366 4.401005480841948348343589e-04,
367 3.629926999056814081597135e-01,
368 3.123672198825455192489266e-02,
369 -2.958805510589623607540455e-01,
370 -3.2033177696533233403289416e-01,
371 -2.592737332129663376736604e-01,
372 -1.0241334641061485092351251e-01,
373 -2.3762660886100206491674503e-01,
375 var lgamma = []fi{
376 {3.146492141244545774319734e+00, 1},
377 {8.003414490659126375852113e+00, 1},
378 {1.517575735509779707488106e+00, -1},
379 {-2.588480028182145853558748e-01, 1},
380 {1.1989897050205555002007985e+01, 1},
381 {6.262899811091257519386906e-01, 1},
382 {3.5287924899091566764846037e+00, 1},
383 {4.5725644770161182299423372e-01, 1},
384 {-6.363667087767961257654854e-02, 1},
385 {-1.077385130910300066425564e+01, -1},
387 var log = []float64{
388 1.605231462693062999102599e+00,
389 2.0462560018708770653153909e+00,
390 -1.2841708730962657801275038e+00,
391 1.6115563905281545116286206e+00,
392 2.2655365644872016636317461e+00,
393 1.0737652208918379856272735e+00,
394 1.6542360106073546632707956e+00,
395 1.0035467127723465801264487e+00,
396 6.0174879014578057187016475e-01,
397 2.161703872847352815363655e+00,
399 var logb = []float64{
400 2.0000000000000000e+00,
401 2.0000000000000000e+00,
402 -2.0000000000000000e+00,
403 2.0000000000000000e+00,
404 3.0000000000000000e+00,
405 1.0000000000000000e+00,
406 2.0000000000000000e+00,
407 1.0000000000000000e+00,
408 0.0000000000000000e+00,
409 3.0000000000000000e+00,
411 var log10 = []float64{
412 6.9714316642508290997617083e-01,
413 8.886776901739320576279124e-01,
414 -5.5770832400658929815908236e-01,
415 6.998900476822994346229723e-01,
416 9.8391002850684232013281033e-01,
417 4.6633031029295153334285302e-01,
418 7.1842557117242328821552533e-01,
419 4.3583479968917773161304553e-01,
420 2.6133617905227038228626834e-01,
421 9.3881606348649405716214241e-01,
423 var log1p = []float64{
424 4.8590257759797794104158205e-02,
425 7.4540265965225865330849141e-02,
426 -2.7726407903942672823234024e-03,
427 -5.1404917651627649094953380e-02,
428 9.1998280672258624681335010e-02,
429 2.8843762576593352865894824e-02,
430 5.0969534581863707268992645e-02,
431 2.6913947602193238458458594e-02,
432 1.8088493239630770262045333e-02,
433 -9.0865245631588989681559268e-02,
435 var log2 = []float64{
436 2.3158594707062190618898251e+00,
437 2.9521233862883917703341018e+00,
438 -1.8526669502700329984917062e+00,
439 2.3249844127278861543568029e+00,
440 3.268478366538305087466309e+00,
441 1.5491157592596970278166492e+00,
442 2.3865580889631732407886495e+00,
443 1.447811865817085365540347e+00,
444 8.6813999540425116282815557e-01,
445 3.118679457227342224364709e+00,
447 var modf = [][2]float64{
448 {4.0000000000000000e+00, 9.7901192488367350108546816e-01},
449 {7.0000000000000000e+00, 7.3887247457810456552351752e-01},
450 {0.0000000000000000e+00, -2.7688005719200159404635997e-01},
451 {-5.0000000000000000e+00, -1.060361827107492160848778e-02},
452 {9.0000000000000000e+00, 6.3629370719841737980004837e-01},
453 {2.0000000000000000e+00, 9.2637723924396464525443662e-01},
454 {5.0000000000000000e+00, 2.2908343145930665230025625e-01},
455 {2.0000000000000000e+00, 7.2793991043601025126008608e-01},
456 {1.0000000000000000e+00, 8.2530809168085506044576505e-01},
457 {-8.0000000000000000e+00, -6.8592476857560136238589621e-01},
459 var nextafter32 = []float32{
460 4.979012489318848e+00,
461 7.738873004913330e+00,
462 -2.768800258636475e-01,
463 -5.010602951049805e+00,
464 9.636294364929199e+00,
465 2.926377534866333e+00,
466 5.229084014892578e+00,
467 2.727940082550049e+00,
468 1.825308203697205e+00,
469 -8.685923576354980e+00,
471 var nextafter64 = []float64{
472 4.97901192488367438926388786e+00,
473 7.73887247457810545370193722e+00,
474 -2.7688005719200153853520874e-01,
475 -5.01060361827107403343006808e+00,
476 9.63629370719841915615688777e+00,
477 2.92637723924396508934364647e+00,
478 5.22908343145930754047867595e+00,
479 2.72793991043601069534929593e+00,
480 1.82530809168085528249036997e+00,
481 -8.68592476857559958602905681e+00,
483 var pow = []float64{
484 9.5282232631648411840742957e+04,
485 5.4811599352999901232411871e+07,
486 5.2859121715894396531132279e-01,
487 9.7587991957286474464259698e-06,
488 4.328064329346044846740467e+09,
489 8.4406761805034547437659092e+02,
490 1.6946633276191194947742146e+05,
491 5.3449040147551939075312879e+02,
492 6.688182138451414936380374e+01,
493 2.0609869004248742886827439e-09,
495 var remainder = []float64{
496 4.197615023265299782906368e-02,
497 2.261127525421895434476482e+00,
498 3.231794108794261433104108e-02,
499 -2.120723654214984321697556e-02,
500 3.637062928015826201999516e-01,
501 1.220868282268106064236690e+00,
502 -4.581668629186133046005125e-01,
503 -9.117596417440410050403443e-01,
504 8.734595415957246977711748e-01,
505 1.314075231424398637614104e+00,
507 var signbit = []bool{
508 false,
509 false,
510 true,
511 true,
512 false,
513 false,
514 false,
515 false,
516 false,
517 true,
519 var sin = []float64{
520 -9.6466616586009283766724726e-01,
521 9.9338225271646545763467022e-01,
522 -2.7335587039794393342449301e-01,
523 9.5586257685042792878173752e-01,
524 -2.099421066779969164496634e-01,
525 2.135578780799860532750616e-01,
526 -8.694568971167362743327708e-01,
527 4.019566681155577786649878e-01,
528 9.6778633541687993721617774e-01,
529 -6.734405869050344734943028e-01,
532 // Results for 100000 * Pi + vf[i]
533 var sinLarge = []float64{
534 -9.646661658548936063912e-01,
535 9.933822527198506903752e-01,
536 -2.7335587036246899796e-01,
537 9.55862576853689321268e-01,
538 -2.099421066862688873691e-01,
539 2.13557878070308981163e-01,
540 -8.694568970959221300497e-01,
541 4.01956668098863248917e-01,
542 9.67786335404528727927e-01,
543 -6.7344058693131973066e-01,
545 var sinh = []float64{
546 7.2661916084208532301448439e+01,
547 1.1479409110035194500526446e+03,
548 -2.8043136512812518927312641e-01,
549 -7.499429091181587232835164e+01,
550 7.6552466042906758523925934e+03,
551 9.3031583421672014313789064e+00,
552 9.330815755828109072810322e+01,
553 7.6179893137269146407361477e+00,
554 3.021769180549615819524392e+00,
555 -2.95950575724449499189888e+03,
557 var sqrt = []float64{
558 2.2313699659365484748756904e+00,
559 2.7818829009464263511285458e+00,
560 5.2619393496314796848143251e-01,
561 2.2384377628763938724244104e+00,
562 3.1042380236055381099288487e+00,
563 1.7106657298385224403917771e+00,
564 2.286718922705479046148059e+00,
565 1.6516476350711159636222979e+00,
566 1.3510396336454586262419247e+00,
567 2.9471892997524949215723329e+00,
569 var tan = []float64{
570 -3.661316565040227801781974e+00,
571 8.64900232648597589369854e+00,
572 -2.8417941955033612725238097e-01,
573 3.253290185974728640827156e+00,
574 2.147275640380293804770778e-01,
575 -2.18600910711067004921551e-01,
576 -1.760002817872367935518928e+00,
577 -4.389808914752818126249079e-01,
578 -3.843885560201130679995041e+00,
579 9.10988793377685105753416e-01,
582 // Results for 100000 * Pi + vf[i]
583 var tanLarge = []float64{
584 -3.66131656475596512705e+00,
585 8.6490023287202547927e+00,
586 -2.841794195104782406e-01,
587 3.2532901861033120983e+00,
588 2.14727564046880001365e-01,
589 -2.18600910700688062874e-01,
590 -1.760002817699722747043e+00,
591 -4.38980891453536115952e-01,
592 -3.84388555942723509071e+00,
593 9.1098879344275101051e-01,
595 var tanh = []float64{
596 9.9990531206936338549262119e-01,
597 9.9999962057085294197613294e-01,
598 -2.7001505097318677233756845e-01,
599 -9.9991110943061718603541401e-01,
600 9.9999999146798465745022007e-01,
601 9.9427249436125236705001048e-01,
602 9.9994257600983138572705076e-01,
603 9.9149409509772875982054701e-01,
604 9.4936501296239685514466577e-01,
605 -9.9999994291374030946055701e-01,
607 var trunc = []float64{
608 4.0000000000000000e+00,
609 7.0000000000000000e+00,
610 -0.0000000000000000e+00,
611 -5.0000000000000000e+00,
612 9.0000000000000000e+00,
613 2.0000000000000000e+00,
614 5.0000000000000000e+00,
615 2.0000000000000000e+00,
616 1.0000000000000000e+00,
617 -8.0000000000000000e+00,
619 var y0 = []float64{
620 -3.053399153780788357534855e-01,
621 1.7437227649515231515503649e-01,
622 -8.6221781263678836910392572e-01,
623 -3.100664880987498407872839e-01,
624 1.422200649300982280645377e-01,
625 4.000004067997901144239363e-01,
626 -3.3340749753099352392332536e-01,
627 4.5399790746668954555205502e-01,
628 4.8290004112497761007536522e-01,
629 2.7036697826604756229601611e-01,
631 var y1 = []float64{
632 0.15494213737457922210218611,
633 -0.2165955142081145245075746,
634 -2.4644949631241895201032829,
635 0.1442740489541836405154505,
636 0.2215379960518984777080163,
637 0.3038800915160754150565448,
638 0.0691107642452362383808547,
639 0.2380116417809914424860165,
640 -0.20849492979459761009678934,
641 0.0242503179793232308250804,
643 var y2 = []float64{
644 0.3675780219390303613394936,
645 -0.23034826393250119879267257,
646 -16.939677983817727205631397,
647 0.367653980523052152867791,
648 -0.0962401471767804440353136,
649 -0.1923169356184851105200523,
650 0.35984072054267882391843766,
651 -0.2794987252299739821654982,
652 -0.7113490692587462579757954,
653 -0.2647831587821263302087457,
655 var yM3 = []float64{
656 -0.14035984421094849100895341,
657 -0.097535139617792072703973,
658 242.25775994555580176377379,
659 -0.1492267014802818619511046,
660 0.26148702629155918694500469,
661 0.56675383593895176530394248,
662 -0.206150264009006981070575,
663 0.64784284687568332737963658,
664 1.3503631555901938037008443,
665 0.1461869756579956803341844,
668 // arguments and expected results for special cases
669 var vfacosSC = []float64{
670 -Pi,
673 NaN(),
675 var acosSC = []float64{
676 NaN(),
678 NaN(),
679 NaN(),
682 var vfacoshSC = []float64{
683 Inf(-1),
684 0.5,
686 Inf(1),
687 NaN(),
689 var acoshSC = []float64{
690 NaN(),
691 NaN(),
693 Inf(1),
694 NaN(),
697 var vfasinSC = []float64{
698 -Pi,
699 Copysign(0, -1),
702 NaN(),
704 var asinSC = []float64{
705 NaN(),
706 Copysign(0, -1),
708 NaN(),
709 NaN(),
712 var vfasinhSC = []float64{
713 Inf(-1),
714 Copysign(0, -1),
716 Inf(1),
717 NaN(),
719 var asinhSC = []float64{
720 Inf(-1),
721 Copysign(0, -1),
723 Inf(1),
724 NaN(),
727 var vfatanSC = []float64{
728 Inf(-1),
729 Copysign(0, -1),
731 Inf(1),
732 NaN(),
734 var atanSC = []float64{
735 -Pi / 2,
736 Copysign(0, -1),
738 Pi / 2,
739 NaN(),
742 var vfatanhSC = []float64{
743 Inf(-1),
744 -Pi,
746 Copysign(0, -1),
750 Inf(1),
751 NaN(),
753 var atanhSC = []float64{
754 NaN(),
755 NaN(),
756 Inf(-1),
757 Copysign(0, -1),
759 Inf(1),
760 NaN(),
761 NaN(),
762 NaN(),
764 var vfatan2SC = [][2]float64{
765 {Inf(-1), Inf(-1)},
766 {Inf(-1), -Pi},
767 {Inf(-1), 0},
768 {Inf(-1), +Pi},
769 {Inf(-1), Inf(1)},
770 {Inf(-1), NaN()},
771 {-Pi, Inf(-1)},
772 {-Pi, 0},
773 {-Pi, Inf(1)},
774 {-Pi, NaN()},
775 {Copysign(0, -1), Inf(-1)},
776 {Copysign(0, -1), -Pi},
777 {Copysign(0, -1), Copysign(0, -1)},
778 {Copysign(0, -1), 0},
779 {Copysign(0, -1), +Pi},
780 {Copysign(0, -1), Inf(1)},
781 {Copysign(0, -1), NaN()},
782 {0, Inf(-1)},
783 {0, -Pi},
784 {0, Copysign(0, -1)},
785 {0, 0},
786 {0, +Pi},
787 {0, Inf(1)},
788 {0, NaN()},
789 {+Pi, Inf(-1)},
790 {+Pi, 0},
791 {+Pi, Inf(1)},
792 {+Pi, NaN()},
793 {Inf(1), Inf(-1)},
794 {Inf(1), -Pi},
795 {Inf(1), 0},
796 {Inf(1), +Pi},
797 {Inf(1), Inf(1)},
798 {Inf(1), NaN()},
799 {NaN(), NaN()},
801 var atan2SC = []float64{
802 -3 * Pi / 4, // atan2(-Inf, -Inf)
803 -Pi / 2, // atan2(-Inf, -Pi)
804 -Pi / 2, // atan2(-Inf, +0)
805 -Pi / 2, // atan2(-Inf, +Pi)
806 -Pi / 4, // atan2(-Inf, +Inf)
807 NaN(), // atan2(-Inf, NaN)
808 -Pi, // atan2(-Pi, -Inf)
809 -Pi / 2, // atan2(-Pi, +0)
810 Copysign(0, -1), // atan2(-Pi, Inf)
811 NaN(), // atan2(-Pi, NaN)
812 -Pi, // atan2(-0, -Inf)
813 -Pi, // atan2(-0, -Pi)
814 -Pi, // atan2(-0, -0)
815 Copysign(0, -1), // atan2(-0, +0)
816 Copysign(0, -1), // atan2(-0, +Pi)
817 Copysign(0, -1), // atan2(-0, +Inf)
818 NaN(), // atan2(-0, NaN)
819 Pi, // atan2(+0, -Inf)
820 Pi, // atan2(+0, -Pi)
821 Pi, // atan2(+0, -0)
822 0, // atan2(+0, +0)
823 0, // atan2(+0, +Pi)
824 0, // atan2(+0, +Inf)
825 NaN(), // atan2(+0, NaN)
826 Pi, // atan2(+Pi, -Inf)
827 Pi / 2, // atan2(+Pi, +0)
828 0, // atan2(+Pi, +Inf)
829 NaN(), // atan2(+Pi, NaN)
830 3 * Pi / 4, // atan2(+Inf, -Inf)
831 Pi / 2, // atan2(+Inf, -Pi)
832 Pi / 2, // atan2(+Inf, +0)
833 Pi / 2, // atan2(+Inf, +Pi)
834 Pi / 4, // atan2(+Inf, +Inf)
835 NaN(), // atan2(+Inf, NaN)
836 NaN(), // atan2(NaN, NaN)
839 var vfcbrtSC = []float64{
840 Inf(-1),
841 Copysign(0, -1),
843 Inf(1),
844 NaN(),
846 var cbrtSC = []float64{
847 Inf(-1),
848 Copysign(0, -1),
850 Inf(1),
851 NaN(),
854 var vfceilSC = []float64{
855 Inf(-1),
856 Copysign(0, -1),
858 Inf(1),
859 NaN(),
861 var ceilSC = []float64{
862 Inf(-1),
863 Copysign(0, -1),
865 Inf(1),
866 NaN(),
869 var vfcopysignSC = []float64{
870 Inf(-1),
871 Inf(1),
872 NaN(),
874 var copysignSC = []float64{
875 Inf(-1),
876 Inf(-1),
877 NaN(),
880 var vfcosSC = []float64{
881 Inf(-1),
882 Inf(1),
883 NaN(),
885 var cosSC = []float64{
886 NaN(),
887 NaN(),
888 NaN(),
891 var vfcoshSC = []float64{
892 Inf(-1),
893 Copysign(0, -1),
895 Inf(1),
896 NaN(),
898 var coshSC = []float64{
899 Inf(1),
902 Inf(1),
903 NaN(),
906 var vferfSC = []float64{
907 Inf(-1),
908 Copysign(0, -1),
910 Inf(1),
911 NaN(),
913 var erfSC = []float64{
915 Copysign(0, -1),
918 NaN(),
921 var vferfcSC = []float64{
922 Inf(-1),
923 Inf(1),
924 NaN(),
926 var erfcSC = []float64{
929 NaN(),
932 var vfexpSC = []float64{
933 Inf(-1),
934 -2000,
935 2000,
936 Inf(1),
937 NaN(),
939 var expSC = []float64{
942 Inf(1),
943 Inf(1),
944 NaN(),
947 var vfexpm1SC = []float64{
948 Inf(-1),
949 Copysign(0, -1),
951 Inf(1),
952 NaN(),
954 var expm1SC = []float64{
956 Copysign(0, -1),
958 Inf(1),
959 NaN(),
962 var vffabsSC = []float64{
963 Inf(-1),
964 Copysign(0, -1),
966 Inf(1),
967 NaN(),
969 var fabsSC = []float64{
970 Inf(1),
973 Inf(1),
974 NaN(),
977 var vffdimSC = [][2]float64{
978 {Inf(-1), Inf(-1)},
979 {Inf(-1), Inf(1)},
980 {Inf(-1), NaN()},
981 {Copysign(0, -1), Copysign(0, -1)},
982 {Copysign(0, -1), 0},
983 {0, Copysign(0, -1)},
984 {0, 0},
985 {Inf(1), Inf(-1)},
986 {Inf(1), Inf(1)},
987 {Inf(1), NaN()},
988 {NaN(), Inf(-1)},
989 {NaN(), Copysign(0, -1)},
990 {NaN(), 0},
991 {NaN(), Inf(1)},
992 {NaN(), NaN()},
994 var fdimSC = []float64{
995 NaN(),
997 NaN(),
1002 Inf(1),
1003 NaN(),
1004 NaN(),
1005 NaN(),
1006 NaN(),
1007 NaN(),
1008 NaN(),
1009 NaN(),
1011 var fmaxSC = []float64{
1012 Inf(-1),
1013 Inf(1),
1014 NaN(),
1015 Copysign(0, -1),
1019 Inf(1),
1020 Inf(1),
1021 Inf(1),
1022 NaN(),
1023 NaN(),
1024 NaN(),
1025 Inf(1),
1026 NaN(),
1028 var fminSC = []float64{
1029 Inf(-1),
1030 Inf(-1),
1031 Inf(-1),
1032 Copysign(0, -1),
1033 Copysign(0, -1),
1034 Copysign(0, -1),
1036 Inf(-1),
1037 Inf(1),
1038 NaN(),
1039 Inf(-1),
1040 NaN(),
1041 NaN(),
1042 NaN(),
1043 NaN(),
1046 var vffmodSC = [][2]float64{
1047 {Inf(-1), Inf(-1)},
1048 {Inf(-1), -Pi},
1049 {Inf(-1), 0},
1050 {Inf(-1), Pi},
1051 {Inf(-1), Inf(1)},
1052 {Inf(-1), NaN()},
1053 {-Pi, Inf(-1)},
1054 {-Pi, 0},
1055 {-Pi, Inf(1)},
1056 {-Pi, NaN()},
1057 {Copysign(0, -1), Inf(-1)},
1058 {Copysign(0, -1), 0},
1059 {Copysign(0, -1), Inf(1)},
1060 {Copysign(0, -1), NaN()},
1061 {0, Inf(-1)},
1062 {0, 0},
1063 {0, Inf(1)},
1064 {0, NaN()},
1065 {Pi, Inf(-1)},
1066 {Pi, 0},
1067 {Pi, Inf(1)},
1068 {Pi, NaN()},
1069 {Inf(1), Inf(-1)},
1070 {Inf(1), -Pi},
1071 {Inf(1), 0},
1072 {Inf(1), Pi},
1073 {Inf(1), Inf(1)},
1074 {Inf(1), NaN()},
1075 {NaN(), Inf(-1)},
1076 {NaN(), -Pi},
1077 {NaN(), 0},
1078 {NaN(), Pi},
1079 {NaN(), Inf(1)},
1080 {NaN(), NaN()},
1082 var fmodSC = []float64{
1083 NaN(), // fmod(-Inf, -Inf)
1084 NaN(), // fmod(-Inf, -Pi)
1085 NaN(), // fmod(-Inf, 0)
1086 NaN(), // fmod(-Inf, Pi)
1087 NaN(), // fmod(-Inf, +Inf)
1088 NaN(), // fmod(-Inf, NaN)
1089 -Pi, // fmod(-Pi, -Inf)
1090 NaN(), // fmod(-Pi, 0)
1091 -Pi, // fmod(-Pi, +Inf)
1092 NaN(), // fmod(-Pi, NaN)
1093 Copysign(0, -1), // fmod(-0, -Inf)
1094 NaN(), // fmod(-0, 0)
1095 Copysign(0, -1), // fmod(-0, Inf)
1096 NaN(), // fmod(-0, NaN)
1097 0, // fmod(0, -Inf)
1098 NaN(), // fmod(0, 0)
1099 0, // fmod(0, +Inf)
1100 NaN(), // fmod(0, NaN)
1101 Pi, // fmod(Pi, -Inf)
1102 NaN(), // fmod(Pi, 0)
1103 Pi, // fmod(Pi, +Inf)
1104 NaN(), // fmod(Pi, NaN)
1105 NaN(), // fmod(+Inf, -Inf)
1106 NaN(), // fmod(+Inf, -Pi)
1107 NaN(), // fmod(+Inf, 0)
1108 NaN(), // fmod(+Inf, Pi)
1109 NaN(), // fmod(+Inf, +Inf)
1110 NaN(), // fmod(+Inf, NaN)
1111 NaN(), // fmod(NaN, -Inf)
1112 NaN(), // fmod(NaN, -Pi)
1113 NaN(), // fmod(NaN, 0)
1114 NaN(), // fmod(NaN, Pi)
1115 NaN(), // fmod(NaN, +Inf)
1116 NaN(), // fmod(NaN, NaN)
1119 var vffrexpSC = []float64{
1120 Inf(-1),
1121 Copysign(0, -1),
1123 Inf(1),
1124 NaN(),
1126 var frexpSC = []fi{
1127 {Inf(-1), 0},
1128 {Copysign(0, -1), 0},
1129 {0, 0},
1130 {Inf(1), 0},
1131 {NaN(), 0},
1134 var vfgammaSC = []float64{
1135 Inf(-1),
1137 Copysign(0, -1),
1139 Inf(1),
1140 NaN(),
1142 var gammaSC = []float64{
1143 NaN(),
1144 NaN(),
1145 Inf(-1),
1146 Inf(1),
1147 Inf(1),
1148 NaN(),
1151 var vfhypotSC = [][2]float64{
1152 {Inf(-1), Inf(-1)},
1153 {Inf(-1), 0},
1154 {Inf(-1), Inf(1)},
1155 {Inf(-1), NaN()},
1156 {Copysign(0, -1), Copysign(0, -1)},
1157 {Copysign(0, -1), 0},
1158 {0, Copysign(0, -1)},
1159 {0, 0}, // +0, +0
1160 {0, Inf(-1)},
1161 {0, Inf(1)},
1162 {0, NaN()},
1163 {Inf(1), Inf(-1)},
1164 {Inf(1), 0},
1165 {Inf(1), Inf(1)},
1166 {Inf(1), NaN()},
1167 {NaN(), Inf(-1)},
1168 {NaN(), 0},
1169 {NaN(), Inf(1)},
1170 {NaN(), NaN()},
1172 var hypotSC = []float64{
1173 Inf(1),
1174 Inf(1),
1175 Inf(1),
1176 Inf(1),
1181 Inf(1),
1182 Inf(1),
1183 NaN(),
1184 Inf(1),
1185 Inf(1),
1186 Inf(1),
1187 Inf(1),
1188 Inf(1),
1189 NaN(),
1190 Inf(1),
1191 NaN(),
1194 var vfilogbSC = []float64{
1195 Inf(-1),
1197 Inf(1),
1198 NaN(),
1200 var ilogbSC = []int{
1201 MaxInt32,
1202 MinInt32,
1203 MaxInt32,
1204 MaxInt32,
1207 var vfj0SC = []float64{
1208 Inf(-1),
1210 Inf(1),
1211 NaN(),
1213 var j0SC = []float64{
1217 NaN(),
1219 var j1SC = []float64{
1223 NaN(),
1225 var j2SC = []float64{
1229 NaN(),
1231 var jM3SC = []float64{
1235 NaN(),
1238 var vfldexpSC = []fi{
1239 {0, 0},
1240 {0, -1075},
1241 {0, 1024},
1242 {Copysign(0, -1), 0},
1243 {Copysign(0, -1), -1075},
1244 {Copysign(0, -1), 1024},
1245 {Inf(1), 0},
1246 {Inf(1), -1024},
1247 {Inf(-1), 0},
1248 {Inf(-1), -1024},
1249 {NaN(), -1024},
1251 var ldexpSC = []float64{
1255 Copysign(0, -1),
1256 Copysign(0, -1),
1257 Copysign(0, -1),
1258 Inf(1),
1259 Inf(1),
1260 Inf(-1),
1261 Inf(-1),
1262 NaN(),
1265 var vflgammaSC = []float64{
1266 Inf(-1),
1271 Inf(1),
1272 NaN(),
1274 var lgammaSC = []fi{
1275 {Inf(-1), 1},
1276 {Inf(1), 1},
1277 {Inf(1), 1},
1278 {0, 1},
1279 {0, 1},
1280 {Inf(1), 1},
1281 {NaN(), 1},
1284 var vflogSC = []float64{
1285 Inf(-1),
1286 -Pi,
1287 Copysign(0, -1),
1290 Inf(1),
1291 NaN(),
1293 var logSC = []float64{
1294 NaN(),
1295 NaN(),
1296 Inf(-1),
1297 Inf(-1),
1299 Inf(1),
1300 NaN(),
1303 var vflogbSC = []float64{
1304 Inf(-1),
1306 Inf(1),
1307 NaN(),
1309 var logbSC = []float64{
1310 Inf(1),
1311 Inf(-1),
1312 Inf(1),
1313 NaN(),
1316 var vflog1pSC = []float64{
1317 Inf(-1),
1318 -Pi,
1320 Copysign(0, -1),
1322 Inf(1),
1323 NaN(),
1325 var log1pSC = []float64{
1326 NaN(),
1327 NaN(),
1328 Inf(-1),
1329 Copysign(0, -1),
1331 Inf(1),
1332 NaN(),
1335 var vfmodfSC = []float64{
1336 Inf(-1),
1337 Inf(1),
1338 NaN(),
1340 var modfSC = [][2]float64{
1341 {Inf(-1), NaN()}, // [2]float64{Copysign(0, -1), Inf(-1)},
1342 {Inf(1), NaN()}, // [2]float64{0, Inf(1)},
1343 {NaN(), NaN()},
1346 var vfnextafter32SC = [][2]float32{
1347 {0, 0},
1348 {0, float32(Copysign(0, -1))},
1349 {0, -1},
1350 {0, float32(NaN())},
1351 {float32(Copysign(0, -1)), 1},
1352 {float32(Copysign(0, -1)), 0},
1353 {float32(Copysign(0, -1)), float32(Copysign(0, -1))},
1354 {float32(Copysign(0, -1)), -1},
1355 {float32(NaN()), 0},
1356 {float32(NaN()), float32(NaN())},
1358 var nextafter32SC = []float32{
1361 -1.401298464e-45, // Float32frombits(0x80000001)
1362 float32(NaN()),
1363 1.401298464e-45, // Float32frombits(0x00000001)
1364 float32(Copysign(0, -1)),
1365 float32(Copysign(0, -1)),
1366 -1.401298464e-45, // Float32frombits(0x80000001)
1367 float32(NaN()),
1368 float32(NaN()),
1371 var vfnextafter64SC = [][2]float64{
1372 {0, 0},
1373 {0, Copysign(0, -1)},
1374 {0, -1},
1375 {0, NaN()},
1376 {Copysign(0, -1), 1},
1377 {Copysign(0, -1), 0},
1378 {Copysign(0, -1), Copysign(0, -1)},
1379 {Copysign(0, -1), -1},
1380 {NaN(), 0},
1381 {NaN(), NaN()},
1383 var nextafter64SC = []float64{
1386 -4.9406564584124654418e-324, // Float64frombits(0x8000000000000001)
1387 NaN(),
1388 4.9406564584124654418e-324, // Float64frombits(0x0000000000000001)
1389 Copysign(0, -1),
1390 Copysign(0, -1),
1391 -4.9406564584124654418e-324, // Float64frombits(0x8000000000000001)
1392 NaN(),
1393 NaN(),
1396 var vfpowSC = [][2]float64{
1397 {Inf(-1), -Pi},
1398 {Inf(-1), -3},
1399 {Inf(-1), Copysign(0, -1)},
1400 {Inf(-1), 0},
1401 {Inf(-1), 1},
1402 {Inf(-1), 3},
1403 {Inf(-1), Pi},
1404 {Inf(-1), NaN()},
1406 {-Pi, Inf(-1)},
1407 {-Pi, -Pi},
1408 {-Pi, Copysign(0, -1)},
1409 {-Pi, 0},
1410 {-Pi, 1},
1411 {-Pi, Pi},
1412 {-Pi, Inf(1)},
1413 {-Pi, NaN()},
1415 {-1, Inf(-1)},
1416 {-1, Inf(1)},
1417 {-1, NaN()},
1418 {-1 / 2, Inf(-1)},
1419 {-1 / 2, Inf(1)},
1420 {Copysign(0, -1), Inf(-1)},
1421 {Copysign(0, -1), -Pi},
1422 {Copysign(0, -1), -3},
1423 {Copysign(0, -1), 3},
1424 {Copysign(0, -1), Pi},
1425 {Copysign(0, -1), Inf(1)},
1427 {0, Inf(-1)},
1428 {0, -Pi},
1429 {0, -3},
1430 {0, Copysign(0, -1)},
1431 {0, 0},
1432 {0, 3},
1433 {0, Pi},
1434 {0, Inf(1)},
1435 {0, NaN()},
1437 {1 / 2, Inf(-1)},
1438 {1 / 2, Inf(1)},
1439 {1, Inf(-1)},
1440 {1, Inf(1)},
1441 {1, NaN()},
1443 {Pi, Inf(-1)},
1444 {Pi, Copysign(0, -1)},
1445 {Pi, 0},
1446 {Pi, 1},
1447 {Pi, Inf(1)},
1448 {Pi, NaN()},
1449 {Inf(1), -Pi},
1450 {Inf(1), Copysign(0, -1)},
1451 {Inf(1), 0},
1452 {Inf(1), 1},
1453 {Inf(1), Pi},
1454 {Inf(1), NaN()},
1455 {NaN(), -Pi},
1456 {NaN(), Copysign(0, -1)},
1457 {NaN(), 0},
1458 {NaN(), 1},
1459 {NaN(), Pi},
1460 {NaN(), NaN()},
1462 var powSC = []float64{
1463 0, // pow(-Inf, -Pi)
1464 Copysign(0, -1), // pow(-Inf, -3)
1465 1, // pow(-Inf, -0)
1466 1, // pow(-Inf, +0)
1467 Inf(-1), // pow(-Inf, 1)
1468 Inf(-1), // pow(-Inf, 3)
1469 Inf(1), // pow(-Inf, Pi)
1470 NaN(), // pow(-Inf, NaN)
1471 0, // pow(-Pi, -Inf)
1472 NaN(), // pow(-Pi, -Pi)
1473 1, // pow(-Pi, -0)
1474 1, // pow(-Pi, +0)
1475 -Pi, // pow(-Pi, 1)
1476 NaN(), // pow(-Pi, Pi)
1477 Inf(1), // pow(-Pi, +Inf)
1478 NaN(), // pow(-Pi, NaN)
1479 1, // pow(-1, -Inf) IEEE 754-2008
1480 1, // pow(-1, +Inf) IEEE 754-2008
1481 NaN(), // pow(-1, NaN)
1482 Inf(1), // pow(-1/2, -Inf)
1483 0, // pow(-1/2, +Inf)
1484 Inf(1), // pow(-0, -Inf)
1485 Inf(1), // pow(-0, -Pi)
1486 Inf(-1), // pow(-0, -3) IEEE 754-2008
1487 Copysign(0, -1), // pow(-0, 3) IEEE 754-2008
1488 0, // pow(-0, +Pi)
1489 0, // pow(-0, +Inf)
1490 Inf(1), // pow(+0, -Inf)
1491 Inf(1), // pow(+0, -Pi)
1492 Inf(1), // pow(+0, -3)
1493 1, // pow(+0, -0)
1494 1, // pow(+0, +0)
1495 0, // pow(+0, 3)
1496 0, // pow(+0, +Pi)
1497 0, // pow(+0, +Inf)
1498 NaN(), // pow(+0, NaN)
1499 Inf(1), // pow(1/2, -Inf)
1500 0, // pow(1/2, +Inf)
1501 1, // pow(1, -Inf) IEEE 754-2008
1502 1, // pow(1, +Inf) IEEE 754-2008
1503 1, // pow(1, NaN) IEEE 754-2008
1504 0, // pow(+Pi, -Inf)
1505 1, // pow(+Pi, -0)
1506 1, // pow(+Pi, +0)
1507 Pi, // pow(+Pi, 1)
1508 Inf(1), // pow(+Pi, +Inf)
1509 NaN(), // pow(+Pi, NaN)
1510 0, // pow(+Inf, -Pi)
1511 1, // pow(+Inf, -0)
1512 1, // pow(+Inf, +0)
1513 Inf(1), // pow(+Inf, 1)
1514 Inf(1), // pow(+Inf, Pi)
1515 NaN(), // pow(+Inf, NaN)
1516 NaN(), // pow(NaN, -Pi)
1517 1, // pow(NaN, -0)
1518 1, // pow(NaN, +0)
1519 NaN(), // pow(NaN, 1)
1520 NaN(), // pow(NaN, +Pi)
1521 NaN(), // pow(NaN, NaN)
1524 var vfpow10SC = []int{
1525 MinInt32,
1526 MaxInt32,
1527 -325,
1528 309,
1531 var pow10SC = []float64{
1532 0, // pow10(MinInt32)
1533 Inf(1), // pow10(MaxInt32)
1534 0, // pow10(-325)
1535 Inf(1), // pow10(309)
1538 var vfsignbitSC = []float64{
1539 Inf(-1),
1540 Copysign(0, -1),
1542 Inf(1),
1543 NaN(),
1545 var signbitSC = []bool{
1546 true,
1547 true,
1548 false,
1549 false,
1550 false,
1553 var vfsinSC = []float64{
1554 Inf(-1),
1555 Copysign(0, -1),
1557 Inf(1),
1558 NaN(),
1560 var sinSC = []float64{
1561 NaN(),
1562 Copysign(0, -1),
1564 NaN(),
1565 NaN(),
1568 var vfsinhSC = []float64{
1569 Inf(-1),
1570 Copysign(0, -1),
1572 Inf(1),
1573 NaN(),
1575 var sinhSC = []float64{
1576 Inf(-1),
1577 Copysign(0, -1),
1579 Inf(1),
1580 NaN(),
1583 var vfsqrtSC = []float64{
1584 Inf(-1),
1585 -Pi,
1586 Copysign(0, -1),
1588 Inf(1),
1589 NaN(),
1591 var sqrtSC = []float64{
1592 NaN(),
1593 NaN(),
1594 Copysign(0, -1),
1596 Inf(1),
1597 NaN(),
1600 var vftanhSC = []float64{
1601 Inf(-1),
1602 Copysign(0, -1),
1604 Inf(1),
1605 NaN(),
1607 var tanhSC = []float64{
1609 Copysign(0, -1),
1612 NaN(),
1615 var vfy0SC = []float64{
1616 Inf(-1),
1618 Inf(1),
1619 NaN(),
1621 var y0SC = []float64{
1622 NaN(),
1623 Inf(-1),
1625 NaN(),
1627 var y1SC = []float64{
1628 NaN(),
1629 Inf(-1),
1631 NaN(),
1633 var y2SC = []float64{
1634 NaN(),
1635 Inf(-1),
1637 NaN(),
1639 var yM3SC = []float64{
1640 NaN(),
1641 Inf(1),
1643 NaN(),
1646 // arguments and expected results for boundary cases
1647 const (
1648 SmallestNormalFloat64 = 2.2250738585072014e-308 // 2**-1022
1649 LargestSubnormalFloat64 = SmallestNormalFloat64 - SmallestNonzeroFloat64
1652 var vffrexpBC = []float64{
1653 SmallestNormalFloat64,
1654 LargestSubnormalFloat64,
1655 SmallestNonzeroFloat64,
1656 MaxFloat64,
1657 -SmallestNormalFloat64,
1658 -LargestSubnormalFloat64,
1659 -SmallestNonzeroFloat64,
1660 -MaxFloat64,
1662 var frexpBC = []fi{
1663 {0.5, -1021},
1664 {0.99999999999999978, -1022},
1665 {0.5, -1073},
1666 {0.99999999999999989, 1024},
1667 {-0.5, -1021},
1668 {-0.99999999999999978, -1022},
1669 {-0.5, -1073},
1670 {-0.99999999999999989, 1024},
1673 var vfldexpBC = []fi{
1674 {SmallestNormalFloat64, -52},
1675 {LargestSubnormalFloat64, -51},
1676 {SmallestNonzeroFloat64, 1074},
1677 {MaxFloat64, -(1023 + 1074)},
1678 {1, -1075},
1679 {-1, -1075},
1680 {1, 1024},
1681 {-1, 1024},
1683 var ldexpBC = []float64{
1684 SmallestNonzeroFloat64,
1685 1e-323, // 2**-1073
1687 1e-323, // 2**-1073
1689 Copysign(0, -1),
1690 Inf(1),
1691 Inf(-1),
1694 var logbBC = []float64{
1695 -1022,
1696 -1023,
1697 -1074,
1698 1023,
1699 -1022,
1700 -1023,
1701 -1074,
1702 1023,
1705 func tolerance(a, b, e float64) bool {
1706 d := a - b
1707 if d < 0 {
1708 d = -d
1711 if a != 0 {
1712 e = e * a
1713 if e < 0 {
1714 e = -e
1717 return d < e
1719 func kindaclose(a, b float64) bool { return tolerance(a, b, 1e-8) }
1720 func close(a, b float64) bool { return tolerance(a, b, 1e-14) }
1721 func veryclose(a, b float64) bool { return tolerance(a, b, 4e-16) }
1722 func soclose(a, b, e float64) bool { return tolerance(a, b, e) }
1723 func alike(a, b float64) bool {
1724 switch {
1725 case IsNaN(a) && IsNaN(b):
1726 return true
1727 case a == b:
1728 return Signbit(a) == Signbit(b)
1730 return false
1733 func TestNaN(t *testing.T) {
1734 f64 := NaN()
1735 if f64 == f64 {
1736 t.Fatalf("NaN() returns %g, expected NaN", f64)
1738 f32 := float32(f64)
1739 if f32 == f32 {
1740 t.Fatalf("float32(NaN()) is %g, expected NaN", f32)
1744 func TestAcos(t *testing.T) {
1745 for i := 0; i < len(vf); i++ {
1746 a := vf[i] / 10
1747 if f := Acos(a); !close(acos[i], f) {
1748 t.Errorf("Acos(%g) = %g, want %g", a, f, acos[i])
1751 for i := 0; i < len(vfacosSC); i++ {
1752 if f := Acos(vfacosSC[i]); !alike(acosSC[i], f) {
1753 t.Errorf("Acos(%g) = %g, want %g", vfacosSC[i], f, acosSC[i])
1758 func TestAcosh(t *testing.T) {
1759 for i := 0; i < len(vf); i++ {
1760 a := 1 + Abs(vf[i])
1761 if f := Acosh(a); !veryclose(acosh[i], f) {
1762 t.Errorf("Acosh(%g) = %g, want %g", a, f, acosh[i])
1765 for i := 0; i < len(vfacoshSC); i++ {
1766 if f := Acosh(vfacoshSC[i]); !alike(acoshSC[i], f) {
1767 t.Errorf("Acosh(%g) = %g, want %g", vfacoshSC[i], f, acoshSC[i])
1772 func TestAsin(t *testing.T) {
1773 for i := 0; i < len(vf); i++ {
1774 a := vf[i] / 10
1775 if f := Asin(a); !veryclose(asin[i], f) {
1776 t.Errorf("Asin(%g) = %g, want %g", a, f, asin[i])
1779 for i := 0; i < len(vfasinSC); i++ {
1780 if f := Asin(vfasinSC[i]); !alike(asinSC[i], f) {
1781 t.Errorf("Asin(%g) = %g, want %g", vfasinSC[i], f, asinSC[i])
1786 func TestAsinh(t *testing.T) {
1787 for i := 0; i < len(vf); i++ {
1788 if f := Asinh(vf[i]); !veryclose(asinh[i], f) {
1789 t.Errorf("Asinh(%g) = %g, want %g", vf[i], f, asinh[i])
1792 for i := 0; i < len(vfasinhSC); i++ {
1793 if f := Asinh(vfasinhSC[i]); !alike(asinhSC[i], f) {
1794 t.Errorf("Asinh(%g) = %g, want %g", vfasinhSC[i], f, asinhSC[i])
1799 func TestAtan(t *testing.T) {
1800 for i := 0; i < len(vf); i++ {
1801 if f := Atan(vf[i]); !veryclose(atan[i], f) {
1802 t.Errorf("Atan(%g) = %g, want %g", vf[i], f, atan[i])
1805 for i := 0; i < len(vfatanSC); i++ {
1806 if f := Atan(vfatanSC[i]); !alike(atanSC[i], f) {
1807 t.Errorf("Atan(%g) = %g, want %g", vfatanSC[i], f, atanSC[i])
1812 func TestAtanh(t *testing.T) {
1813 for i := 0; i < len(vf); i++ {
1814 a := vf[i] / 10
1815 if f := Atanh(a); !veryclose(atanh[i], f) {
1816 t.Errorf("Atanh(%g) = %g, want %g", a, f, atanh[i])
1819 for i := 0; i < len(vfatanhSC); i++ {
1820 if f := Atanh(vfatanhSC[i]); !alike(atanhSC[i], f) {
1821 t.Errorf("Atanh(%g) = %g, want %g", vfatanhSC[i], f, atanhSC[i])
1826 func TestAtan2(t *testing.T) {
1827 for i := 0; i < len(vf); i++ {
1828 if f := Atan2(10, vf[i]); !veryclose(atan2[i], f) {
1829 t.Errorf("Atan2(10, %g) = %g, want %g", vf[i], f, atan2[i])
1832 for i := 0; i < len(vfatan2SC); i++ {
1833 if f := Atan2(vfatan2SC[i][0], vfatan2SC[i][1]); !alike(atan2SC[i], f) {
1834 t.Errorf("Atan2(%g, %g) = %g, want %g", vfatan2SC[i][0], vfatan2SC[i][1], f, atan2SC[i])
1839 func TestCbrt(t *testing.T) {
1840 for i := 0; i < len(vf); i++ {
1841 if f := Cbrt(vf[i]); !veryclose(cbrt[i], f) {
1842 t.Errorf("Cbrt(%g) = %g, want %g", vf[i], f, cbrt[i])
1845 for i := 0; i < len(vfcbrtSC); i++ {
1846 if f := Cbrt(vfcbrtSC[i]); !alike(cbrtSC[i], f) {
1847 t.Errorf("Cbrt(%g) = %g, want %g", vfcbrtSC[i], f, cbrtSC[i])
1852 func TestCeil(t *testing.T) {
1853 for i := 0; i < len(vf); i++ {
1854 if f := Ceil(vf[i]); ceil[i] != f {
1855 t.Errorf("Ceil(%g) = %g, want %g", vf[i], f, ceil[i])
1858 for i := 0; i < len(vfceilSC); i++ {
1859 if f := Ceil(vfceilSC[i]); !alike(ceilSC[i], f) {
1860 t.Errorf("Ceil(%g) = %g, want %g", vfceilSC[i], f, ceilSC[i])
1865 func TestCopysign(t *testing.T) {
1866 for i := 0; i < len(vf); i++ {
1867 if f := Copysign(vf[i], -1); copysign[i] != f {
1868 t.Errorf("Copysign(%g, -1) = %g, want %g", vf[i], f, copysign[i])
1871 for i := 0; i < len(vf); i++ {
1872 if f := Copysign(vf[i], 1); -copysign[i] != f {
1873 t.Errorf("Copysign(%g, 1) = %g, want %g", vf[i], f, -copysign[i])
1876 for i := 0; i < len(vfcopysignSC); i++ {
1877 if f := Copysign(vfcopysignSC[i], -1); !alike(copysignSC[i], f) {
1878 t.Errorf("Copysign(%g, -1) = %g, want %g", vfcopysignSC[i], f, copysignSC[i])
1883 func TestCos(t *testing.T) {
1884 for i := 0; i < len(vf); i++ {
1885 if f := Cos(vf[i]); !veryclose(cos[i], f) {
1886 t.Errorf("Cos(%g) = %g, want %g", vf[i], f, cos[i])
1889 for i := 0; i < len(vfcosSC); i++ {
1890 if f := Cos(vfcosSC[i]); !alike(cosSC[i], f) {
1891 t.Errorf("Cos(%g) = %g, want %g", vfcosSC[i], f, cosSC[i])
1896 func TestCosh(t *testing.T) {
1897 for i := 0; i < len(vf); i++ {
1898 if f := Cosh(vf[i]); !close(cosh[i], f) {
1899 t.Errorf("Cosh(%g) = %g, want %g", vf[i], f, cosh[i])
1902 for i := 0; i < len(vfcoshSC); i++ {
1903 if f := Cosh(vfcoshSC[i]); !alike(coshSC[i], f) {
1904 t.Errorf("Cosh(%g) = %g, want %g", vfcoshSC[i], f, coshSC[i])
1909 func TestErf(t *testing.T) {
1910 for i := 0; i < len(vf); i++ {
1911 a := vf[i] / 10
1912 if f := Erf(a); !veryclose(erf[i], f) {
1913 t.Errorf("Erf(%g) = %g, want %g", a, f, erf[i])
1916 for i := 0; i < len(vferfSC); i++ {
1917 if f := Erf(vferfSC[i]); !alike(erfSC[i], f) {
1918 t.Errorf("Erf(%g) = %g, want %g", vferfSC[i], f, erfSC[i])
1923 func TestErfc(t *testing.T) {
1924 for i := 0; i < len(vf); i++ {
1925 a := vf[i] / 10
1926 if f := Erfc(a); !veryclose(erfc[i], f) {
1927 t.Errorf("Erfc(%g) = %g, want %g", a, f, erfc[i])
1930 for i := 0; i < len(vferfcSC); i++ {
1931 if f := Erfc(vferfcSC[i]); !alike(erfcSC[i], f) {
1932 t.Errorf("Erfc(%g) = %g, want %g", vferfcSC[i], f, erfcSC[i])
1937 func TestExp(t *testing.T) {
1938 testExp(t, Exp, "Exp")
1939 testExp(t, ExpGo, "ExpGo")
1942 func testExp(t *testing.T, Exp func(float64) float64, name string) {
1943 for i := 0; i < len(vf); i++ {
1944 if f := Exp(vf[i]); !close(exp[i], f) {
1945 t.Errorf("%s(%g) = %g, want %g", name, vf[i], f, exp[i])
1948 for i := 0; i < len(vfexpSC); i++ {
1949 if f := Exp(vfexpSC[i]); !alike(expSC[i], f) {
1950 t.Errorf("%s(%g) = %g, want %g", name, vfexpSC[i], f, expSC[i])
1955 func TestExpm1(t *testing.T) {
1956 for i := 0; i < len(vf); i++ {
1957 a := vf[i] / 100
1958 if f := Expm1(a); !veryclose(expm1[i], f) {
1959 t.Errorf("Expm1(%g) = %g, want %g", a, f, expm1[i])
1962 for i := 0; i < len(vfexpm1SC); i++ {
1963 if f := Expm1(vfexpm1SC[i]); !alike(expm1SC[i], f) {
1964 t.Errorf("Expm1(%g) = %g, want %g", vfexpm1SC[i], f, expm1SC[i])
1969 func TestExp2(t *testing.T) {
1970 testExp2(t, Exp2, "Exp2")
1971 testExp2(t, Exp2Go, "Exp2Go")
1974 func testExp2(t *testing.T, Exp2 func(float64) float64, name string) {
1975 for i := 0; i < len(vf); i++ {
1976 if f := Exp2(vf[i]); !close(exp2[i], f) {
1977 t.Errorf("%s(%g) = %g, want %g", name, vf[i], f, exp2[i])
1980 for i := 0; i < len(vfexpSC); i++ {
1981 if f := Exp2(vfexpSC[i]); !alike(expSC[i], f) {
1982 t.Errorf("%s(%g) = %g, want %g", name, vfexpSC[i], f, expSC[i])
1985 for n := -1074; n < 1024; n++ {
1986 f := Exp2(float64(n))
1987 vf := Ldexp(1, n)
1988 if f != vf {
1989 t.Errorf("%s(%d) = %g, want %g", name, n, f, vf)
1994 func TestAbs(t *testing.T) {
1995 for i := 0; i < len(vf); i++ {
1996 if f := Abs(vf[i]); fabs[i] != f {
1997 t.Errorf("Abs(%g) = %g, want %g", vf[i], f, fabs[i])
2000 for i := 0; i < len(vffabsSC); i++ {
2001 if f := Abs(vffabsSC[i]); !alike(fabsSC[i], f) {
2002 t.Errorf("Abs(%g) = %g, want %g", vffabsSC[i], f, fabsSC[i])
2007 func TestDim(t *testing.T) {
2008 for i := 0; i < len(vf); i++ {
2009 if f := Dim(vf[i], 0); fdim[i] != f {
2010 t.Errorf("Dim(%g, %g) = %g, want %g", vf[i], 0.0, f, fdim[i])
2013 for i := 0; i < len(vffdimSC); i++ {
2014 if f := Dim(vffdimSC[i][0], vffdimSC[i][1]); !alike(fdimSC[i], f) {
2015 t.Errorf("Dim(%g, %g) = %g, want %g", vffdimSC[i][0], vffdimSC[i][1], f, fdimSC[i])
2020 func TestFloor(t *testing.T) {
2021 for i := 0; i < len(vf); i++ {
2022 if f := Floor(vf[i]); floor[i] != f {
2023 t.Errorf("Floor(%g) = %g, want %g", vf[i], f, floor[i])
2026 for i := 0; i < len(vfceilSC); i++ {
2027 if f := Floor(vfceilSC[i]); !alike(ceilSC[i], f) {
2028 t.Errorf("Floor(%g) = %g, want %g", vfceilSC[i], f, ceilSC[i])
2033 func TestMax(t *testing.T) {
2034 for i := 0; i < len(vf); i++ {
2035 if f := Max(vf[i], ceil[i]); ceil[i] != f {
2036 t.Errorf("Max(%g, %g) = %g, want %g", vf[i], ceil[i], f, ceil[i])
2039 for i := 0; i < len(vffdimSC); i++ {
2040 if f := Max(vffdimSC[i][0], vffdimSC[i][1]); !alike(fmaxSC[i], f) {
2041 t.Errorf("Max(%g, %g) = %g, want %g", vffdimSC[i][0], vffdimSC[i][1], f, fmaxSC[i])
2046 func TestMin(t *testing.T) {
2047 for i := 0; i < len(vf); i++ {
2048 if f := Min(vf[i], floor[i]); floor[i] != f {
2049 t.Errorf("Min(%g, %g) = %g, want %g", vf[i], floor[i], f, floor[i])
2052 for i := 0; i < len(vffdimSC); i++ {
2053 if f := Min(vffdimSC[i][0], vffdimSC[i][1]); !alike(fminSC[i], f) {
2054 t.Errorf("Min(%g, %g) = %g, want %g", vffdimSC[i][0], vffdimSC[i][1], f, fminSC[i])
2059 func TestMod(t *testing.T) {
2060 for i := 0; i < len(vf); i++ {
2061 if f := Mod(10, vf[i]); fmod[i] != f {
2062 t.Errorf("Mod(10, %g) = %g, want %g", vf[i], f, fmod[i])
2065 for i := 0; i < len(vffmodSC); i++ {
2066 if f := Mod(vffmodSC[i][0], vffmodSC[i][1]); !alike(fmodSC[i], f) {
2067 t.Errorf("Mod(%g, %g) = %g, want %g", vffmodSC[i][0], vffmodSC[i][1], f, fmodSC[i])
2072 func TestFrexp(t *testing.T) {
2073 for i := 0; i < len(vf); i++ {
2074 if f, j := Frexp(vf[i]); !veryclose(frexp[i].f, f) || frexp[i].i != j {
2075 t.Errorf("Frexp(%g) = %g, %d, want %g, %d", vf[i], f, j, frexp[i].f, frexp[i].i)
2078 for i := 0; i < len(vffrexpSC); i++ {
2079 if f, j := Frexp(vffrexpSC[i]); !alike(frexpSC[i].f, f) || frexpSC[i].i != j {
2080 t.Errorf("Frexp(%g) = %g, %d, want %g, %d", vffrexpSC[i], f, j, frexpSC[i].f, frexpSC[i].i)
2083 for i := 0; i < len(vffrexpBC); i++ {
2084 if f, j := Frexp(vffrexpBC[i]); !alike(frexpBC[i].f, f) || frexpBC[i].i != j {
2085 t.Errorf("Frexp(%g) = %g, %d, want %g, %d", vffrexpBC[i], f, j, frexpBC[i].f, frexpBC[i].i)
2090 func TestGamma(t *testing.T) {
2091 for i := 0; i < len(vf); i++ {
2092 if f := Gamma(vf[i]); !close(gamma[i], f) {
2093 t.Errorf("Gamma(%g) = %g, want %g", vf[i], f, gamma[i])
2096 for i := 0; i < len(vfgammaSC); i++ {
2097 if f := Gamma(vfgammaSC[i]); !alike(gammaSC[i], f) {
2098 t.Errorf("Gamma(%g) = %g, want %g", vfgammaSC[i], f, gammaSC[i])
2103 func TestHypot(t *testing.T) {
2104 for i := 0; i < len(vf); i++ {
2105 a := Abs(1e200 * tanh[i] * Sqrt(2))
2106 if f := Hypot(1e200*tanh[i], 1e200*tanh[i]); !veryclose(a, f) {
2107 t.Errorf("Hypot(%g, %g) = %g, want %g", 1e200*tanh[i], 1e200*tanh[i], f, a)
2110 for i := 0; i < len(vfhypotSC); i++ {
2111 if f := Hypot(vfhypotSC[i][0], vfhypotSC[i][1]); !alike(hypotSC[i], f) {
2112 t.Errorf("Hypot(%g, %g) = %g, want %g", vfhypotSC[i][0], vfhypotSC[i][1], f, hypotSC[i])
2117 func TestHypotGo(t *testing.T) {
2118 for i := 0; i < len(vf); i++ {
2119 a := Abs(1e200 * tanh[i] * Sqrt(2))
2120 if f := HypotGo(1e200*tanh[i], 1e200*tanh[i]); !veryclose(a, f) {
2121 t.Errorf("HypotGo(%g, %g) = %g, want %g", 1e200*tanh[i], 1e200*tanh[i], f, a)
2124 for i := 0; i < len(vfhypotSC); i++ {
2125 if f := HypotGo(vfhypotSC[i][0], vfhypotSC[i][1]); !alike(hypotSC[i], f) {
2126 t.Errorf("HypotGo(%g, %g) = %g, want %g", vfhypotSC[i][0], vfhypotSC[i][1], f, hypotSC[i])
2131 func TestIlogb(t *testing.T) {
2132 for i := 0; i < len(vf); i++ {
2133 a := frexp[i].i - 1 // adjust because fr in the interval [½, 1)
2134 if e := Ilogb(vf[i]); a != e {
2135 t.Errorf("Ilogb(%g) = %d, want %d", vf[i], e, a)
2138 for i := 0; i < len(vflogbSC); i++ {
2139 if e := Ilogb(vflogbSC[i]); ilogbSC[i] != e {
2140 t.Errorf("Ilogb(%g) = %d, want %d", vflogbSC[i], e, ilogbSC[i])
2143 for i := 0; i < len(vffrexpBC); i++ {
2144 if e := Ilogb(vffrexpBC[i]); int(logbBC[i]) != e {
2145 t.Errorf("Ilogb(%g) = %d, want %d", vffrexpBC[i], e, int(logbBC[i]))
2150 func TestJ0(t *testing.T) {
2151 for i := 0; i < len(vf); i++ {
2152 if f := J0(vf[i]); !soclose(j0[i], f, 4e-14) {
2153 t.Errorf("J0(%g) = %g, want %g", vf[i], f, j0[i])
2156 for i := 0; i < len(vfj0SC); i++ {
2157 if f := J0(vfj0SC[i]); !alike(j0SC[i], f) {
2158 t.Errorf("J0(%g) = %g, want %g", vfj0SC[i], f, j0SC[i])
2163 func TestJ1(t *testing.T) {
2164 for i := 0; i < len(vf); i++ {
2165 if f := J1(vf[i]); !close(j1[i], f) {
2166 t.Errorf("J1(%g) = %g, want %g", vf[i], f, j1[i])
2169 for i := 0; i < len(vfj0SC); i++ {
2170 if f := J1(vfj0SC[i]); !alike(j1SC[i], f) {
2171 t.Errorf("J1(%g) = %g, want %g", vfj0SC[i], f, j1SC[i])
2176 func TestJn(t *testing.T) {
2177 for i := 0; i < len(vf); i++ {
2178 if f := Jn(2, vf[i]); !close(j2[i], f) {
2179 t.Errorf("Jn(2, %g) = %g, want %g", vf[i], f, j2[i])
2181 if f := Jn(-3, vf[i]); !close(jM3[i], f) {
2182 t.Errorf("Jn(-3, %g) = %g, want %g", vf[i], f, jM3[i])
2185 for i := 0; i < len(vfj0SC); i++ {
2186 if f := Jn(2, vfj0SC[i]); !alike(j2SC[i], f) {
2187 t.Errorf("Jn(2, %g) = %g, want %g", vfj0SC[i], f, j2SC[i])
2189 if f := Jn(-3, vfj0SC[i]); !alike(jM3SC[i], f) {
2190 t.Errorf("Jn(-3, %g) = %g, want %g", vfj0SC[i], f, jM3SC[i])
2195 func TestLdexp(t *testing.T) {
2196 for i := 0; i < len(vf); i++ {
2197 if f := Ldexp(frexp[i].f, frexp[i].i); !veryclose(vf[i], f) {
2198 t.Errorf("Ldexp(%g, %d) = %g, want %g", frexp[i].f, frexp[i].i, f, vf[i])
2201 for i := 0; i < len(vffrexpSC); i++ {
2202 if f := Ldexp(frexpSC[i].f, frexpSC[i].i); !alike(vffrexpSC[i], f) {
2203 t.Errorf("Ldexp(%g, %d) = %g, want %g", frexpSC[i].f, frexpSC[i].i, f, vffrexpSC[i])
2206 for i := 0; i < len(vfldexpSC); i++ {
2207 if f := Ldexp(vfldexpSC[i].f, vfldexpSC[i].i); !alike(ldexpSC[i], f) {
2208 t.Errorf("Ldexp(%g, %d) = %g, want %g", vfldexpSC[i].f, vfldexpSC[i].i, f, ldexpSC[i])
2211 for i := 0; i < len(vffrexpBC); i++ {
2212 if f := Ldexp(frexpBC[i].f, frexpBC[i].i); !alike(vffrexpBC[i], f) {
2213 t.Errorf("Ldexp(%g, %d) = %g, want %g", frexpBC[i].f, frexpBC[i].i, f, vffrexpBC[i])
2216 for i := 0; i < len(vfldexpBC); i++ {
2217 if f := Ldexp(vfldexpBC[i].f, vfldexpBC[i].i); !alike(ldexpBC[i], f) {
2218 t.Errorf("Ldexp(%g, %d) = %g, want %g", vfldexpBC[i].f, vfldexpBC[i].i, f, ldexpBC[i])
2223 func TestLgamma(t *testing.T) {
2224 for i := 0; i < len(vf); i++ {
2225 if f, s := Lgamma(vf[i]); !close(lgamma[i].f, f) || lgamma[i].i != s {
2226 t.Errorf("Lgamma(%g) = %g, %d, want %g, %d", vf[i], f, s, lgamma[i].f, lgamma[i].i)
2229 for i := 0; i < len(vflgammaSC); i++ {
2230 if f, s := Lgamma(vflgammaSC[i]); !alike(lgammaSC[i].f, f) || lgammaSC[i].i != s {
2231 t.Errorf("Lgamma(%g) = %g, %d, want %g, %d", vflgammaSC[i], f, s, lgammaSC[i].f, lgammaSC[i].i)
2236 func TestLog(t *testing.T) {
2237 for i := 0; i < len(vf); i++ {
2238 a := Abs(vf[i])
2239 if f := Log(a); log[i] != f {
2240 t.Errorf("Log(%g) = %g, want %g", a, f, log[i])
2243 if f := Log(10); f != Ln10 {
2244 t.Errorf("Log(%g) = %g, want %g", 10.0, f, Ln10)
2246 for i := 0; i < len(vflogSC); i++ {
2247 if f := Log(vflogSC[i]); !alike(logSC[i], f) {
2248 t.Errorf("Log(%g) = %g, want %g", vflogSC[i], f, logSC[i])
2253 func TestLogb(t *testing.T) {
2254 for i := 0; i < len(vf); i++ {
2255 if f := Logb(vf[i]); logb[i] != f {
2256 t.Errorf("Logb(%g) = %g, want %g", vf[i], f, logb[i])
2259 for i := 0; i < len(vflogbSC); i++ {
2260 if f := Logb(vflogbSC[i]); !alike(logbSC[i], f) {
2261 t.Errorf("Logb(%g) = %g, want %g", vflogbSC[i], f, logbSC[i])
2264 for i := 0; i < len(vffrexpBC); i++ {
2265 if f := Logb(vffrexpBC[i]); !alike(logbBC[i], f) {
2266 t.Errorf("Logb(%g) = %g, want %g", vffrexpBC[i], f, logbBC[i])
2271 func TestLog10(t *testing.T) {
2272 for i := 0; i < len(vf); i++ {
2273 a := Abs(vf[i])
2274 if f := Log10(a); !veryclose(log10[i], f) {
2275 t.Errorf("Log10(%g) = %g, want %g", a, f, log10[i])
2278 if f := Log10(E); f != Log10E {
2279 t.Errorf("Log10(%g) = %g, want %g", E, f, Log10E)
2281 for i := 0; i < len(vflogSC); i++ {
2282 if f := Log10(vflogSC[i]); !alike(logSC[i], f) {
2283 t.Errorf("Log10(%g) = %g, want %g", vflogSC[i], f, logSC[i])
2288 func TestLog1p(t *testing.T) {
2289 for i := 0; i < len(vf); i++ {
2290 a := vf[i] / 100
2291 if f := Log1p(a); !veryclose(log1p[i], f) {
2292 t.Errorf("Log1p(%g) = %g, want %g", a, f, log1p[i])
2295 a := 9.0
2296 if f := Log1p(a); f != Ln10 {
2297 t.Errorf("Log1p(%g) = %g, want %g", a, f, Ln10)
2299 for i := 0; i < len(vflogSC); i++ {
2300 if f := Log1p(vflog1pSC[i]); !alike(log1pSC[i], f) {
2301 t.Errorf("Log1p(%g) = %g, want %g", vflog1pSC[i], f, log1pSC[i])
2306 func TestLog2(t *testing.T) {
2307 for i := 0; i < len(vf); i++ {
2308 a := Abs(vf[i])
2309 if f := Log2(a); !veryclose(log2[i], f) {
2310 t.Errorf("Log2(%g) = %g, want %g", a, f, log2[i])
2313 if f := Log2(E); f != Log2E {
2314 t.Errorf("Log2(%g) = %g, want %g", E, f, Log2E)
2316 for i := 0; i < len(vflogSC); i++ {
2317 if f := Log2(vflogSC[i]); !alike(logSC[i], f) {
2318 t.Errorf("Log2(%g) = %g, want %g", vflogSC[i], f, logSC[i])
2321 for i := -1074; i <= 1023; i++ {
2322 f := Ldexp(1, i)
2323 l := Log2(f)
2324 if l != float64(i) {
2325 t.Errorf("Log2(2**%d) = %g, want %d", i, l, i)
2330 func TestModf(t *testing.T) {
2331 for i := 0; i < len(vf); i++ {
2332 if f, g := Modf(vf[i]); !veryclose(modf[i][0], f) || !veryclose(modf[i][1], g) {
2333 t.Errorf("Modf(%g) = %g, %g, want %g, %g", vf[i], f, g, modf[i][0], modf[i][1])
2336 for i := 0; i < len(vfmodfSC); i++ {
2337 if f, g := Modf(vfmodfSC[i]); !alike(modfSC[i][0], f) || !alike(modfSC[i][1], g) {
2338 t.Errorf("Modf(%g) = %g, %g, want %g, %g", vfmodfSC[i], f, g, modfSC[i][0], modfSC[i][1])
2343 func TestNextafter32(t *testing.T) {
2344 for i := 0; i < len(vf); i++ {
2345 vfi := float32(vf[i])
2346 if f := Nextafter32(vfi, 10); nextafter32[i] != f {
2347 t.Errorf("Nextafter32(%g, %g) = %g want %g", vfi, 10.0, f, nextafter32[i])
2350 for i := 0; i < len(vfnextafter32SC); i++ {
2351 if f := Nextafter32(vfnextafter32SC[i][0], vfnextafter32SC[i][1]); !alike(float64(nextafter32SC[i]), float64(f)) {
2352 t.Errorf("Nextafter32(%g, %g) = %g want %g", vfnextafter32SC[i][0], vfnextafter32SC[i][1], f, nextafter32SC[i])
2357 func TestNextafter64(t *testing.T) {
2358 for i := 0; i < len(vf); i++ {
2359 if f := Nextafter(vf[i], 10); nextafter64[i] != f {
2360 t.Errorf("Nextafter64(%g, %g) = %g want %g", vf[i], 10.0, f, nextafter64[i])
2363 for i := 0; i < len(vfnextafter64SC); i++ {
2364 if f := Nextafter(vfnextafter64SC[i][0], vfnextafter64SC[i][1]); !alike(nextafter64SC[i], f) {
2365 t.Errorf("Nextafter64(%g, %g) = %g want %g", vfnextafter64SC[i][0], vfnextafter64SC[i][1], f, nextafter64SC[i])
2370 func TestPow(t *testing.T) {
2371 for i := 0; i < len(vf); i++ {
2372 if f := Pow(10, vf[i]); !close(pow[i], f) {
2373 t.Errorf("Pow(10, %g) = %g, want %g", vf[i], f, pow[i])
2376 for i := 0; i < len(vfpowSC); i++ {
2377 if f := Pow(vfpowSC[i][0], vfpowSC[i][1]); !alike(powSC[i], f) {
2378 t.Errorf("Pow(%g, %g) = %g, want %g", vfpowSC[i][0], vfpowSC[i][1], f, powSC[i])
2383 func TestPow10(t *testing.T) {
2384 for i := 0; i < len(vfpow10SC); i++ {
2385 if f := Pow10(vfpow10SC[i]); !alike(pow10SC[i], f) {
2386 t.Errorf("Pow10(%d) = %g, want %g", vfpow10SC[i], f, pow10SC[i])
2391 func TestRemainder(t *testing.T) {
2392 for i := 0; i < len(vf); i++ {
2393 if f := Remainder(10, vf[i]); remainder[i] != f {
2394 t.Errorf("Remainder(10, %g) = %g, want %g", vf[i], f, remainder[i])
2397 for i := 0; i < len(vffmodSC); i++ {
2398 if f := Remainder(vffmodSC[i][0], vffmodSC[i][1]); !alike(fmodSC[i], f) {
2399 t.Errorf("Remainder(%g, %g) = %g, want %g", vffmodSC[i][0], vffmodSC[i][1], f, fmodSC[i])
2404 func TestSignbit(t *testing.T) {
2405 for i := 0; i < len(vf); i++ {
2406 if f := Signbit(vf[i]); signbit[i] != f {
2407 t.Errorf("Signbit(%g) = %t, want %t", vf[i], f, signbit[i])
2410 for i := 0; i < len(vfsignbitSC); i++ {
2411 if f := Signbit(vfsignbitSC[i]); signbitSC[i] != f {
2412 t.Errorf("Signbit(%g) = %t, want %t", vfsignbitSC[i], f, signbitSC[i])
2416 func TestSin(t *testing.T) {
2417 for i := 0; i < len(vf); i++ {
2418 if f := Sin(vf[i]); !veryclose(sin[i], f) {
2419 t.Errorf("Sin(%g) = %g, want %g", vf[i], f, sin[i])
2422 for i := 0; i < len(vfsinSC); i++ {
2423 if f := Sin(vfsinSC[i]); !alike(sinSC[i], f) {
2424 t.Errorf("Sin(%g) = %g, want %g", vfsinSC[i], f, sinSC[i])
2429 func TestSincos(t *testing.T) {
2430 for i := 0; i < len(vf); i++ {
2431 if s, c := Sincos(vf[i]); !veryclose(sin[i], s) || !veryclose(cos[i], c) {
2432 t.Errorf("Sincos(%g) = %g, %g want %g, %g", vf[i], s, c, sin[i], cos[i])
2437 func TestSinh(t *testing.T) {
2438 for i := 0; i < len(vf); i++ {
2439 if f := Sinh(vf[i]); !close(sinh[i], f) {
2440 t.Errorf("Sinh(%g) = %g, want %g", vf[i], f, sinh[i])
2443 for i := 0; i < len(vfsinhSC); i++ {
2444 if f := Sinh(vfsinhSC[i]); !alike(sinhSC[i], f) {
2445 t.Errorf("Sinh(%g) = %g, want %g", vfsinhSC[i], f, sinhSC[i])
2450 func TestSqrt(t *testing.T) {
2451 for i := 0; i < len(vf); i++ {
2452 a := Abs(vf[i])
2453 if f := SqrtGo(a); sqrt[i] != f {
2454 t.Errorf("SqrtGo(%g) = %g, want %g", a, f, sqrt[i])
2456 a = Abs(vf[i])
2457 if f := Sqrt(a); sqrt[i] != f {
2458 t.Errorf("Sqrt(%g) = %g, want %g", a, f, sqrt[i])
2461 for i := 0; i < len(vfsqrtSC); i++ {
2462 if f := SqrtGo(vfsqrtSC[i]); !alike(sqrtSC[i], f) {
2463 t.Errorf("SqrtGo(%g) = %g, want %g", vfsqrtSC[i], f, sqrtSC[i])
2465 if f := Sqrt(vfsqrtSC[i]); !alike(sqrtSC[i], f) {
2466 t.Errorf("Sqrt(%g) = %g, want %g", vfsqrtSC[i], f, sqrtSC[i])
2471 func TestTan(t *testing.T) {
2472 for i := 0; i < len(vf); i++ {
2473 if f := Tan(vf[i]); !veryclose(tan[i], f) {
2474 t.Errorf("Tan(%g) = %g, want %g", vf[i], f, tan[i])
2477 // same special cases as Sin
2478 for i := 0; i < len(vfsinSC); i++ {
2479 if f := Tan(vfsinSC[i]); !alike(sinSC[i], f) {
2480 t.Errorf("Tan(%g) = %g, want %g", vfsinSC[i], f, sinSC[i])
2485 func TestTanh(t *testing.T) {
2486 for i := 0; i < len(vf); i++ {
2487 if f := Tanh(vf[i]); !veryclose(tanh[i], f) {
2488 t.Errorf("Tanh(%g) = %g, want %g", vf[i], f, tanh[i])
2491 for i := 0; i < len(vftanhSC); i++ {
2492 if f := Tanh(vftanhSC[i]); !alike(tanhSC[i], f) {
2493 t.Errorf("Tanh(%g) = %g, want %g", vftanhSC[i], f, tanhSC[i])
2498 func TestTrunc(t *testing.T) {
2499 for i := 0; i < len(vf); i++ {
2500 if f := Trunc(vf[i]); trunc[i] != f {
2501 t.Errorf("Trunc(%g) = %g, want %g", vf[i], f, trunc[i])
2504 for i := 0; i < len(vfceilSC); i++ {
2505 if f := Trunc(vfceilSC[i]); !alike(ceilSC[i], f) {
2506 t.Errorf("Trunc(%g) = %g, want %g", vfceilSC[i], f, ceilSC[i])
2511 func TestY0(t *testing.T) {
2512 for i := 0; i < len(vf); i++ {
2513 a := Abs(vf[i])
2514 if f := Y0(a); !close(y0[i], f) {
2515 t.Errorf("Y0(%g) = %g, want %g", a, f, y0[i])
2518 for i := 0; i < len(vfy0SC); i++ {
2519 if f := Y0(vfy0SC[i]); !alike(y0SC[i], f) {
2520 t.Errorf("Y0(%g) = %g, want %g", vfy0SC[i], f, y0SC[i])
2525 func TestY1(t *testing.T) {
2526 for i := 0; i < len(vf); i++ {
2527 a := Abs(vf[i])
2528 if f := Y1(a); !soclose(y1[i], f, 2e-14) {
2529 t.Errorf("Y1(%g) = %g, want %g", a, f, y1[i])
2532 for i := 0; i < len(vfy0SC); i++ {
2533 if f := Y1(vfy0SC[i]); !alike(y1SC[i], f) {
2534 t.Errorf("Y1(%g) = %g, want %g", vfy0SC[i], f, y1SC[i])
2539 func TestYn(t *testing.T) {
2540 for i := 0; i < len(vf); i++ {
2541 a := Abs(vf[i])
2542 if f := Yn(2, a); !close(y2[i], f) {
2543 t.Errorf("Yn(2, %g) = %g, want %g", a, f, y2[i])
2545 if f := Yn(-3, a); !close(yM3[i], f) {
2546 t.Errorf("Yn(-3, %g) = %g, want %g", a, f, yM3[i])
2549 for i := 0; i < len(vfy0SC); i++ {
2550 if f := Yn(2, vfy0SC[i]); !alike(y2SC[i], f) {
2551 t.Errorf("Yn(2, %g) = %g, want %g", vfy0SC[i], f, y2SC[i])
2553 if f := Yn(-3, vfy0SC[i]); !alike(yM3SC[i], f) {
2554 t.Errorf("Yn(-3, %g) = %g, want %g", vfy0SC[i], f, yM3SC[i])
2559 // Check that math functions of high angle values
2560 // return accurate results. [Since (vf[i] + large) - large != vf[i],
2561 // testing for Trig(vf[i] + large) == Trig(vf[i]), where large is
2562 // a multiple of 2*Pi, is misleading.]
2563 func TestLargeCos(t *testing.T) {
2564 large := float64(100000 * Pi)
2565 for i := 0; i < len(vf); i++ {
2566 f1 := cosLarge[i]
2567 f2 := Cos(vf[i] + large)
2568 if !close(f1, f2) {
2569 t.Errorf("Cos(%g) = %g, want %g", vf[i]+large, f2, f1)
2574 func TestLargeSin(t *testing.T) {
2575 large := float64(100000 * Pi)
2576 for i := 0; i < len(vf); i++ {
2577 f1 := sinLarge[i]
2578 f2 := Sin(vf[i] + large)
2579 if !close(f1, f2) {
2580 t.Errorf("Sin(%g) = %g, want %g", vf[i]+large, f2, f1)
2585 func TestLargeSincos(t *testing.T) {
2586 large := float64(100000 * Pi)
2587 for i := 0; i < len(vf); i++ {
2588 f1, g1 := sinLarge[i], cosLarge[i]
2589 f2, g2 := Sincos(vf[i] + large)
2590 if !close(f1, f2) || !close(g1, g2) {
2591 t.Errorf("Sincos(%g) = %g, %g, want %g, %g", vf[i]+large, f2, g2, f1, g1)
2596 func TestLargeTan(t *testing.T) {
2597 large := float64(100000 * Pi)
2598 for i := 0; i < len(vf); i++ {
2599 f1 := tanLarge[i]
2600 f2 := Tan(vf[i] + large)
2601 if !close(f1, f2) {
2602 t.Errorf("Tan(%g) = %g, want %g", vf[i]+large, f2, f1)
2607 // Check that math constants are accepted by compiler
2608 // and have right value (assumes strconv.ParseFloat works).
2609 // http://code.google.com/p/go/issues/detail?id=201
2611 type floatTest struct {
2612 val interface{}
2613 name string
2614 str string
2617 var floatTests = []floatTest{
2618 {float64(MaxFloat64), "MaxFloat64", "1.7976931348623157e+308"},
2619 {float64(SmallestNonzeroFloat64), "SmallestNonzeroFloat64", "5e-324"},
2620 {float32(MaxFloat32), "MaxFloat32", "3.4028235e+38"},
2621 {float32(SmallestNonzeroFloat32), "SmallestNonzeroFloat32", "1e-45"},
2624 func TestFloatMinMax(t *testing.T) {
2625 for _, tt := range floatTests {
2626 s := fmt.Sprint(tt.val)
2627 if s != tt.str {
2628 t.Errorf("Sprint(%v) = %s, want %s", tt.name, s, tt.str)
2633 // Benchmarks
2635 func BenchmarkAcos(b *testing.B) {
2636 for i := 0; i < b.N; i++ {
2637 Acos(.5)
2641 func BenchmarkAcosh(b *testing.B) {
2642 for i := 0; i < b.N; i++ {
2643 Acosh(1.5)
2647 func BenchmarkAsin(b *testing.B) {
2648 for i := 0; i < b.N; i++ {
2649 Asin(.5)
2653 func BenchmarkAsinh(b *testing.B) {
2654 for i := 0; i < b.N; i++ {
2655 Asinh(.5)
2659 func BenchmarkAtan(b *testing.B) {
2660 for i := 0; i < b.N; i++ {
2661 Atan(.5)
2665 func BenchmarkAtanh(b *testing.B) {
2666 for i := 0; i < b.N; i++ {
2667 Atanh(.5)
2671 func BenchmarkAtan2(b *testing.B) {
2672 for i := 0; i < b.N; i++ {
2673 Atan2(.5, 1)
2677 func BenchmarkCbrt(b *testing.B) {
2678 for i := 0; i < b.N; i++ {
2679 Cbrt(10)
2683 func BenchmarkCeil(b *testing.B) {
2684 for i := 0; i < b.N; i++ {
2685 Ceil(.5)
2689 func BenchmarkCopysign(b *testing.B) {
2690 for i := 0; i < b.N; i++ {
2691 Copysign(.5, -1)
2695 func BenchmarkCos(b *testing.B) {
2696 for i := 0; i < b.N; i++ {
2697 Cos(.5)
2701 func BenchmarkCosh(b *testing.B) {
2702 for i := 0; i < b.N; i++ {
2703 Cosh(2.5)
2707 func BenchmarkErf(b *testing.B) {
2708 for i := 0; i < b.N; i++ {
2709 Erf(.5)
2713 func BenchmarkErfc(b *testing.B) {
2714 for i := 0; i < b.N; i++ {
2715 Erfc(.5)
2719 func BenchmarkExp(b *testing.B) {
2720 for i := 0; i < b.N; i++ {
2721 Exp(.5)
2725 func BenchmarkExpGo(b *testing.B) {
2726 for i := 0; i < b.N; i++ {
2727 ExpGo(.5)
2731 func BenchmarkExpm1(b *testing.B) {
2732 for i := 0; i < b.N; i++ {
2733 Expm1(.5)
2737 func BenchmarkExp2(b *testing.B) {
2738 for i := 0; i < b.N; i++ {
2739 Exp2(.5)
2743 func BenchmarkExp2Go(b *testing.B) {
2744 for i := 0; i < b.N; i++ {
2745 Exp2Go(.5)
2749 func BenchmarkAbs(b *testing.B) {
2750 for i := 0; i < b.N; i++ {
2751 Abs(.5)
2755 func BenchmarkDim(b *testing.B) {
2756 for i := 0; i < b.N; i++ {
2757 Dim(10, 3)
2761 func BenchmarkFloor(b *testing.B) {
2762 for i := 0; i < b.N; i++ {
2763 Floor(.5)
2767 func BenchmarkMax(b *testing.B) {
2768 for i := 0; i < b.N; i++ {
2769 Max(10, 3)
2773 func BenchmarkMin(b *testing.B) {
2774 for i := 0; i < b.N; i++ {
2775 Min(10, 3)
2779 func BenchmarkMod(b *testing.B) {
2780 for i := 0; i < b.N; i++ {
2781 Mod(10, 3)
2785 func BenchmarkFrexp(b *testing.B) {
2786 for i := 0; i < b.N; i++ {
2787 Frexp(8)
2791 func BenchmarkGamma(b *testing.B) {
2792 for i := 0; i < b.N; i++ {
2793 Gamma(2.5)
2797 func BenchmarkHypot(b *testing.B) {
2798 for i := 0; i < b.N; i++ {
2799 Hypot(3, 4)
2803 func BenchmarkHypotGo(b *testing.B) {
2804 for i := 0; i < b.N; i++ {
2805 HypotGo(3, 4)
2809 func BenchmarkIlogb(b *testing.B) {
2810 for i := 0; i < b.N; i++ {
2811 Ilogb(.5)
2815 func BenchmarkJ0(b *testing.B) {
2816 for i := 0; i < b.N; i++ {
2817 J0(2.5)
2821 func BenchmarkJ1(b *testing.B) {
2822 for i := 0; i < b.N; i++ {
2823 J1(2.5)
2827 func BenchmarkJn(b *testing.B) {
2828 for i := 0; i < b.N; i++ {
2829 Jn(2, 2.5)
2833 func BenchmarkLdexp(b *testing.B) {
2834 for i := 0; i < b.N; i++ {
2835 Ldexp(.5, 2)
2839 func BenchmarkLgamma(b *testing.B) {
2840 for i := 0; i < b.N; i++ {
2841 Lgamma(2.5)
2845 func BenchmarkLog(b *testing.B) {
2846 for i := 0; i < b.N; i++ {
2847 Log(.5)
2851 func BenchmarkLogb(b *testing.B) {
2852 for i := 0; i < b.N; i++ {
2853 Logb(.5)
2857 func BenchmarkLog1p(b *testing.B) {
2858 for i := 0; i < b.N; i++ {
2859 Log1p(.5)
2863 func BenchmarkLog10(b *testing.B) {
2864 for i := 0; i < b.N; i++ {
2865 Log10(.5)
2869 func BenchmarkLog2(b *testing.B) {
2870 for i := 0; i < b.N; i++ {
2871 Log2(.5)
2875 func BenchmarkModf(b *testing.B) {
2876 for i := 0; i < b.N; i++ {
2877 Modf(1.5)
2881 func BenchmarkNextafter32(b *testing.B) {
2882 for i := 0; i < b.N; i++ {
2883 Nextafter32(.5, 1)
2887 func BenchmarkNextafter64(b *testing.B) {
2888 for i := 0; i < b.N; i++ {
2889 Nextafter(.5, 1)
2893 func BenchmarkPowInt(b *testing.B) {
2894 for i := 0; i < b.N; i++ {
2895 Pow(2, 2)
2899 func BenchmarkPowFrac(b *testing.B) {
2900 for i := 0; i < b.N; i++ {
2901 Pow(2.5, 1.5)
2905 func BenchmarkPow10Pos(b *testing.B) {
2906 for i := 0; i < b.N; i++ {
2907 Pow10(300)
2911 func BenchmarkPow10Neg(b *testing.B) {
2912 for i := 0; i < b.N; i++ {
2913 Pow10(-300)
2917 func BenchmarkRemainder(b *testing.B) {
2918 for i := 0; i < b.N; i++ {
2919 Remainder(10, 3)
2923 func BenchmarkSignbit(b *testing.B) {
2924 for i := 0; i < b.N; i++ {
2925 Signbit(2.5)
2929 func BenchmarkSin(b *testing.B) {
2930 for i := 0; i < b.N; i++ {
2931 Sin(.5)
2935 func BenchmarkSincos(b *testing.B) {
2936 for i := 0; i < b.N; i++ {
2937 Sincos(.5)
2941 func BenchmarkSinh(b *testing.B) {
2942 for i := 0; i < b.N; i++ {
2943 Sinh(2.5)
2947 func BenchmarkSqrt(b *testing.B) {
2948 for i := 0; i < b.N; i++ {
2949 Sqrt(10)
2953 func BenchmarkSqrtGo(b *testing.B) {
2954 for i := 0; i < b.N; i++ {
2955 SqrtGo(10)
2959 func BenchmarkTan(b *testing.B) {
2960 for i := 0; i < b.N; i++ {
2961 Tan(.5)
2965 func BenchmarkTanh(b *testing.B) {
2966 for i := 0; i < b.N; i++ {
2967 Tanh(2.5)
2970 func BenchmarkTrunc(b *testing.B) {
2971 for i := 0; i < b.N; i++ {
2972 Trunc(.5)
2976 func BenchmarkY0(b *testing.B) {
2977 for i := 0; i < b.N; i++ {
2978 Y0(2.5)
2982 func BenchmarkY1(b *testing.B) {
2983 for i := 0; i < b.N; i++ {
2984 Y1(2.5)
2988 func BenchmarkYn(b *testing.B) {
2989 for i := 0; i < b.N; i++ {
2990 Yn(2, 2.5)