OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [math/] [all_test.go] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// 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.
4
 
5
package math_test
6
 
7
import (
8
        "fmt"
9
        . "math"
10
        "testing"
11
)
12
 
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,
24
}
25
 
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,
42
}
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,
54
}
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,
66
}
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,
78
}
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,
90
}
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,
102
}
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,
114
}
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,
126
}
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,
138
}
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,
150
}
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,
162
}
163
 
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,
176
}
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,
188
}
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,
200
}
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,
212
}
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,
224
}
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,
236
}
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,
248
}
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,
260
}
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,
272
}
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,
284
}
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,
296
}
297
 
298
type fi struct {
299
        f float64
300
        i int
301
}
302
 
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},
314
}
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,
326
}
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,
338
}
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,
350
}
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,
362
}
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,
374
}
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},
386
}
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,
398
}
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,
410
}
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,
422
}
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,
434
}
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,
446
}
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},
458
}
459
var nextafter = []float64{
460
        4.97901192488367438926388786e+00,
461
        7.73887247457810545370193722e+00,
462
        -2.7688005719200153853520874e-01,
463
        -5.01060361827107403343006808e+00,
464
        9.63629370719841915615688777e+00,
465
        2.92637723924396508934364647e+00,
466
        5.22908343145930754047867595e+00,
467
        2.72793991043601069534929593e+00,
468
        1.82530809168085528249036997e+00,
469
        -8.68592476857559958602905681e+00,
470
}
471
var pow = []float64{
472
        9.5282232631648411840742957e+04,
473
        5.4811599352999901232411871e+07,
474
        5.2859121715894396531132279e-01,
475
        9.7587991957286474464259698e-06,
476
        4.328064329346044846740467e+09,
477
        8.4406761805034547437659092e+02,
478
        1.6946633276191194947742146e+05,
479
        5.3449040147551939075312879e+02,
480
        6.688182138451414936380374e+01,
481
        2.0609869004248742886827439e-09,
482
}
483
var remainder = []float64{
484
        4.197615023265299782906368e-02,
485
        2.261127525421895434476482e+00,
486
        3.231794108794261433104108e-02,
487
        -2.120723654214984321697556e-02,
488
        3.637062928015826201999516e-01,
489
        1.220868282268106064236690e+00,
490
        -4.581668629186133046005125e-01,
491
        -9.117596417440410050403443e-01,
492
        8.734595415957246977711748e-01,
493
        1.314075231424398637614104e+00,
494
}
495
var signbit = []bool{
496
        false,
497
        false,
498
        true,
499
        true,
500
        false,
501
        false,
502
        false,
503
        false,
504
        false,
505
        true,
506
}
507
var sin = []float64{
508
        -9.6466616586009283766724726e-01,
509
        9.9338225271646545763467022e-01,
510
        -2.7335587039794393342449301e-01,
511
        9.5586257685042792878173752e-01,
512
        -2.099421066779969164496634e-01,
513
        2.135578780799860532750616e-01,
514
        -8.694568971167362743327708e-01,
515
        4.019566681155577786649878e-01,
516
        9.6778633541687993721617774e-01,
517
        -6.734405869050344734943028e-01,
518
}
519
 
520
// Results for 100000 * Pi + vf[i]
521
var sinLarge = []float64{
522
        -9.646661658548936063912e-01,
523
        9.933822527198506903752e-01,
524
        -2.7335587036246899796e-01,
525
        9.55862576853689321268e-01,
526
        -2.099421066862688873691e-01,
527
        2.13557878070308981163e-01,
528
        -8.694568970959221300497e-01,
529
        4.01956668098863248917e-01,
530
        9.67786335404528727927e-01,
531
        -6.7344058693131973066e-01,
532
}
533
var sinh = []float64{
534
        7.2661916084208532301448439e+01,
535
        1.1479409110035194500526446e+03,
536
        -2.8043136512812518927312641e-01,
537
        -7.499429091181587232835164e+01,
538
        7.6552466042906758523925934e+03,
539
        9.3031583421672014313789064e+00,
540
        9.330815755828109072810322e+01,
541
        7.6179893137269146407361477e+00,
542
        3.021769180549615819524392e+00,
543
        -2.95950575724449499189888e+03,
544
}
545
var sqrt = []float64{
546
        2.2313699659365484748756904e+00,
547
        2.7818829009464263511285458e+00,
548
        5.2619393496314796848143251e-01,
549
        2.2384377628763938724244104e+00,
550
        3.1042380236055381099288487e+00,
551
        1.7106657298385224403917771e+00,
552
        2.286718922705479046148059e+00,
553
        1.6516476350711159636222979e+00,
554
        1.3510396336454586262419247e+00,
555
        2.9471892997524949215723329e+00,
556
}
557
var tan = []float64{
558
        -3.661316565040227801781974e+00,
559
        8.64900232648597589369854e+00,
560
        -2.8417941955033612725238097e-01,
561
        3.253290185974728640827156e+00,
562
        2.147275640380293804770778e-01,
563
        -2.18600910711067004921551e-01,
564
        -1.760002817872367935518928e+00,
565
        -4.389808914752818126249079e-01,
566
        -3.843885560201130679995041e+00,
567
        9.10988793377685105753416e-01,
568
}
569
 
570
// Results for 100000 * Pi + vf[i]
571
var tanLarge = []float64{
572
        -3.66131656475596512705e+00,
573
        8.6490023287202547927e+00,
574
        -2.841794195104782406e-01,
575
        3.2532901861033120983e+00,
576
        2.14727564046880001365e-01,
577
        -2.18600910700688062874e-01,
578
        -1.760002817699722747043e+00,
579
        -4.38980891453536115952e-01,
580
        -3.84388555942723509071e+00,
581
        9.1098879344275101051e-01,
582
}
583
var tanh = []float64{
584
        9.9990531206936338549262119e-01,
585
        9.9999962057085294197613294e-01,
586
        -2.7001505097318677233756845e-01,
587
        -9.9991110943061718603541401e-01,
588
        9.9999999146798465745022007e-01,
589
        9.9427249436125236705001048e-01,
590
        9.9994257600983138572705076e-01,
591
        9.9149409509772875982054701e-01,
592
        9.4936501296239685514466577e-01,
593
        -9.9999994291374030946055701e-01,
594
}
595
var trunc = []float64{
596
        4.0000000000000000e+00,
597
        7.0000000000000000e+00,
598
        -0.0000000000000000e+00,
599
        -5.0000000000000000e+00,
600
        9.0000000000000000e+00,
601
        2.0000000000000000e+00,
602
        5.0000000000000000e+00,
603
        2.0000000000000000e+00,
604
        1.0000000000000000e+00,
605
        -8.0000000000000000e+00,
606
}
607
var y0 = []float64{
608
        -3.053399153780788357534855e-01,
609
        1.7437227649515231515503649e-01,
610
        -8.6221781263678836910392572e-01,
611
        -3.100664880987498407872839e-01,
612
        1.422200649300982280645377e-01,
613
        4.000004067997901144239363e-01,
614
        -3.3340749753099352392332536e-01,
615
        4.5399790746668954555205502e-01,
616
        4.8290004112497761007536522e-01,
617
        2.7036697826604756229601611e-01,
618
}
619
var y1 = []float64{
620
        0.15494213737457922210218611,
621
        -0.2165955142081145245075746,
622
        -2.4644949631241895201032829,
623
        0.1442740489541836405154505,
624
        0.2215379960518984777080163,
625
        0.3038800915160754150565448,
626
        0.0691107642452362383808547,
627
        0.2380116417809914424860165,
628
        -0.20849492979459761009678934,
629
        0.0242503179793232308250804,
630
}
631
var y2 = []float64{
632
        0.3675780219390303613394936,
633
        -0.23034826393250119879267257,
634
        -16.939677983817727205631397,
635
        0.367653980523052152867791,
636
        -0.0962401471767804440353136,
637
        -0.1923169356184851105200523,
638
        0.35984072054267882391843766,
639
        -0.2794987252299739821654982,
640
        -0.7113490692587462579757954,
641
        -0.2647831587821263302087457,
642
}
643
var yM3 = []float64{
644
        -0.14035984421094849100895341,
645
        -0.097535139617792072703973,
646
        242.25775994555580176377379,
647
        -0.1492267014802818619511046,
648
        0.26148702629155918694500469,
649
        0.56675383593895176530394248,
650
        -0.206150264009006981070575,
651
        0.64784284687568332737963658,
652
        1.3503631555901938037008443,
653
        0.1461869756579956803341844,
654
}
655
 
656
// arguments and expected results for special cases
657
var vfacosSC = []float64{
658
        -Pi,
659
        1,
660
        Pi,
661
        NaN(),
662
}
663
var acosSC = []float64{
664
        NaN(),
665
        0,
666
        NaN(),
667
        NaN(),
668
}
669
 
670
var vfacoshSC = []float64{
671
        Inf(-1),
672
        0.5,
673
        1,
674
        Inf(1),
675
        NaN(),
676
}
677
var acoshSC = []float64{
678
        NaN(),
679
        NaN(),
680
        0,
681
        Inf(1),
682
        NaN(),
683
}
684
 
685
var vfasinSC = []float64{
686
        -Pi,
687
        Copysign(0, -1),
688
        0,
689
        Pi,
690
        NaN(),
691
}
692
var asinSC = []float64{
693
        NaN(),
694
        Copysign(0, -1),
695
        0,
696
        NaN(),
697
        NaN(),
698
}
699
 
700
var vfasinhSC = []float64{
701
        Inf(-1),
702
        Copysign(0, -1),
703
        0,
704
        Inf(1),
705
        NaN(),
706
}
707
var asinhSC = []float64{
708
        Inf(-1),
709
        Copysign(0, -1),
710
        0,
711
        Inf(1),
712
        NaN(),
713
}
714
 
715
var vfatanSC = []float64{
716
        Inf(-1),
717
        Copysign(0, -1),
718
        0,
719
        Inf(1),
720
        NaN(),
721
}
722
var atanSC = []float64{
723
        -Pi / 2,
724
        Copysign(0, -1),
725
        0,
726
        Pi / 2,
727
        NaN(),
728
}
729
 
730
var vfatanhSC = []float64{
731
        Inf(-1),
732
        -Pi,
733
        -1,
734
        Copysign(0, -1),
735
        0,
736
        1,
737
        Pi,
738
        Inf(1),
739
        NaN(),
740
}
741
var atanhSC = []float64{
742
        NaN(),
743
        NaN(),
744
        Inf(-1),
745
        Copysign(0, -1),
746
        0,
747
        Inf(1),
748
        NaN(),
749
        NaN(),
750
        NaN(),
751
}
752
var vfatan2SC = [][2]float64{
753
        {Inf(-1), Inf(-1)},
754
        {Inf(-1), -Pi},
755
        {Inf(-1), 0},
756
        {Inf(-1), +Pi},
757
        {Inf(-1), Inf(1)},
758
        {Inf(-1), NaN()},
759
        {-Pi, Inf(-1)},
760
        {-Pi, 0},
761
        {-Pi, Inf(1)},
762
        {-Pi, NaN()},
763
        {Copysign(0, -1), Inf(-1)},
764
        {Copysign(0, -1), -Pi},
765
        {Copysign(0, -1), Copysign(0, -1)},
766
        {Copysign(0, -1), 0},
767
        {Copysign(0, -1), +Pi},
768
        {Copysign(0, -1), Inf(1)},
769
        {Copysign(0, -1), NaN()},
770
        {0, Inf(-1)},
771
        {0, -Pi},
772
        {0, Copysign(0, -1)},
773
        {0, 0},
774
        {0, +Pi},
775
        {0, Inf(1)},
776
        {0, NaN()},
777
        {+Pi, Inf(-1)},
778
        {+Pi, 0},
779
        {+Pi, Inf(1)},
780
        {+Pi, NaN()},
781
        {Inf(1), Inf(-1)},
782
        {Inf(1), -Pi},
783
        {Inf(1), 0},
784
        {Inf(1), +Pi},
785
        {Inf(1), Inf(1)},
786
        {Inf(1), NaN()},
787
        {NaN(), NaN()},
788
}
789
var atan2SC = []float64{
790
        -3 * Pi / 4,     // atan2(-Inf, -Inf)
791
        -Pi / 2,         // atan2(-Inf, -Pi)
792
        -Pi / 2,         // atan2(-Inf, +0)
793
        -Pi / 2,         // atan2(-Inf, +Pi)
794
        -Pi / 4,         // atan2(-Inf, +Inf)
795
        NaN(),           // atan2(-Inf, NaN)
796
        -Pi,             // atan2(-Pi, -Inf)
797
        -Pi / 2,         // atan2(-Pi, +0)
798
        Copysign(0, -1), // atan2(-Pi, Inf)
799
        NaN(),           // atan2(-Pi, NaN)
800
        -Pi,             // atan2(-0, -Inf)
801
        -Pi,             // atan2(-0, -Pi)
802
        -Pi,             // atan2(-0, -0)
803
        Copysign(0, -1), // atan2(-0, +0)
804
        Copysign(0, -1), // atan2(-0, +Pi)
805
        Copysign(0, -1), // atan2(-0, +Inf)
806
        NaN(),           // atan2(-0, NaN)
807
        Pi,              // atan2(+0, -Inf)
808
        Pi,              // atan2(+0, -Pi)
809
        Pi,              // atan2(+0, -0)
810
        0,               // atan2(+0, +0)
811
        0,               // atan2(+0, +Pi)
812
        0,               // atan2(+0, +Inf)
813
        NaN(),           // atan2(+0, NaN)
814
        Pi,              // atan2(+Pi, -Inf)
815
        Pi / 2,          // atan2(+Pi, +0)
816
        0,               // atan2(+Pi, +Inf)
817
        NaN(),           // atan2(+Pi, NaN)
818
        3 * Pi / 4,      // atan2(+Inf, -Inf)
819
        Pi / 2,          // atan2(+Inf, -Pi)
820
        Pi / 2,          // atan2(+Inf, +0)
821
        Pi / 2,          // atan2(+Inf, +Pi)
822
        Pi / 4,          // atan2(+Inf, +Inf)
823
        NaN(),           // atan2(+Inf, NaN)
824
        NaN(),           // atan2(NaN, NaN)
825
}
826
 
827
var vfcbrtSC = []float64{
828
        Inf(-1),
829
        Copysign(0, -1),
830
        0,
831
        Inf(1),
832
        NaN(),
833
}
834
var cbrtSC = []float64{
835
        Inf(-1),
836
        Copysign(0, -1),
837
        0,
838
        Inf(1),
839
        NaN(),
840
}
841
 
842
var vfceilSC = []float64{
843
        Inf(-1),
844
        Copysign(0, -1),
845
        0,
846
        Inf(1),
847
        NaN(),
848
}
849
var ceilSC = []float64{
850
        Inf(-1),
851
        Copysign(0, -1),
852
        0,
853
        Inf(1),
854
        NaN(),
855
}
856
 
857
var vfcopysignSC = []float64{
858
        Inf(-1),
859
        Inf(1),
860
        NaN(),
861
}
862
var copysignSC = []float64{
863
        Inf(-1),
864
        Inf(-1),
865
        NaN(),
866
}
867
 
868
var vfcosSC = []float64{
869
        Inf(-1),
870
        Inf(1),
871
        NaN(),
872
}
873
var cosSC = []float64{
874
        NaN(),
875
        NaN(),
876
        NaN(),
877
}
878
 
879
var vfcoshSC = []float64{
880
        Inf(-1),
881
        Copysign(0, -1),
882
        0,
883
        Inf(1),
884
        NaN(),
885
}
886
var coshSC = []float64{
887
        Inf(1),
888
        1,
889
        1,
890
        Inf(1),
891
        NaN(),
892
}
893
 
894
var vferfSC = []float64{
895
        Inf(-1),
896
        Copysign(0, -1),
897
        0,
898
        Inf(1),
899
        NaN(),
900
}
901
var erfSC = []float64{
902
        -1,
903
        Copysign(0, -1),
904
        0,
905
        1,
906
        NaN(),
907
}
908
 
909
var vferfcSC = []float64{
910
        Inf(-1),
911
        Inf(1),
912
        NaN(),
913
}
914
var erfcSC = []float64{
915
        2,
916
        0,
917
        NaN(),
918
}
919
 
920
var vfexpSC = []float64{
921
        Inf(-1),
922
        -2000,
923
        2000,
924
        Inf(1),
925
        NaN(),
926
}
927
var expSC = []float64{
928
        0,
929
        0,
930
        Inf(1),
931
        Inf(1),
932
        NaN(),
933
}
934
 
935
var vfexpm1SC = []float64{
936
        Inf(-1),
937
        Copysign(0, -1),
938
        0,
939
        Inf(1),
940
        NaN(),
941
}
942
var expm1SC = []float64{
943
        -1,
944
        Copysign(0, -1),
945
        0,
946
        Inf(1),
947
        NaN(),
948
}
949
 
950
var vffabsSC = []float64{
951
        Inf(-1),
952
        Copysign(0, -1),
953
        0,
954
        Inf(1),
955
        NaN(),
956
}
957
var fabsSC = []float64{
958
        Inf(1),
959
        0,
960
        0,
961
        Inf(1),
962
        NaN(),
963
}
964
 
965
var vffdimSC = [][2]float64{
966
        {Inf(-1), Inf(-1)},
967
        {Inf(-1), Inf(1)},
968
        {Inf(-1), NaN()},
969
        {Copysign(0, -1), Copysign(0, -1)},
970
        {Copysign(0, -1), 0},
971
        {0, Copysign(0, -1)},
972
        {0, 0},
973
        {Inf(1), Inf(-1)},
974
        {Inf(1), Inf(1)},
975
        {Inf(1), NaN()},
976
        {NaN(), Inf(-1)},
977
        {NaN(), Copysign(0, -1)},
978
        {NaN(), 0},
979
        {NaN(), Inf(1)},
980
        {NaN(), NaN()},
981
}
982
var fdimSC = []float64{
983
        NaN(),
984
        0,
985
        NaN(),
986
        0,
987
        0,
988
        0,
989
        0,
990
        Inf(1),
991
        NaN(),
992
        NaN(),
993
        NaN(),
994
        NaN(),
995
        NaN(),
996
        NaN(),
997
        NaN(),
998
}
999
var fmaxSC = []float64{
1000
        Inf(-1),
1001
        Inf(1),
1002
        NaN(),
1003
        Copysign(0, -1),
1004
        0,
1005
        0,
1006
        0,
1007
        Inf(1),
1008
        Inf(1),
1009
        Inf(1),
1010
        NaN(),
1011
        NaN(),
1012
        NaN(),
1013
        Inf(1),
1014
        NaN(),
1015
}
1016
var fminSC = []float64{
1017
        Inf(-1),
1018
        Inf(-1),
1019
        Inf(-1),
1020
        Copysign(0, -1),
1021
        Copysign(0, -1),
1022
        Copysign(0, -1),
1023
        0,
1024
        Inf(-1),
1025
        Inf(1),
1026
        NaN(),
1027
        Inf(-1),
1028
        NaN(),
1029
        NaN(),
1030
        NaN(),
1031
        NaN(),
1032
}
1033
 
1034
var vffmodSC = [][2]float64{
1035
        {Inf(-1), Inf(-1)},
1036
        {Inf(-1), -Pi},
1037
        {Inf(-1), 0},
1038
        {Inf(-1), Pi},
1039
        {Inf(-1), Inf(1)},
1040
        {Inf(-1), NaN()},
1041
        {-Pi, Inf(-1)},
1042
        {-Pi, 0},
1043
        {-Pi, Inf(1)},
1044
        {-Pi, NaN()},
1045
        {Copysign(0, -1), Inf(-1)},
1046
        {Copysign(0, -1), 0},
1047
        {Copysign(0, -1), Inf(1)},
1048
        {Copysign(0, -1), NaN()},
1049
        {0, Inf(-1)},
1050
        {0, 0},
1051
        {0, Inf(1)},
1052
        {0, NaN()},
1053
        {Pi, Inf(-1)},
1054
        {Pi, 0},
1055
        {Pi, Inf(1)},
1056
        {Pi, NaN()},
1057
        {Inf(1), Inf(-1)},
1058
        {Inf(1), -Pi},
1059
        {Inf(1), 0},
1060
        {Inf(1), Pi},
1061
        {Inf(1), Inf(1)},
1062
        {Inf(1), NaN()},
1063
        {NaN(), Inf(-1)},
1064
        {NaN(), -Pi},
1065
        {NaN(), 0},
1066
        {NaN(), Pi},
1067
        {NaN(), Inf(1)},
1068
        {NaN(), NaN()},
1069
}
1070
var fmodSC = []float64{
1071
        NaN(),           // fmod(-Inf, -Inf)
1072
        NaN(),           // fmod(-Inf, -Pi)
1073
        NaN(),           // fmod(-Inf, 0)
1074
        NaN(),           // fmod(-Inf, Pi)
1075
        NaN(),           // fmod(-Inf, +Inf)
1076
        NaN(),           // fmod(-Inf, NaN)
1077
        -Pi,             // fmod(-Pi, -Inf)
1078
        NaN(),           // fmod(-Pi, 0)
1079
        -Pi,             // fmod(-Pi, +Inf)
1080
        NaN(),           // fmod(-Pi, NaN)
1081
        Copysign(0, -1), // fmod(-0, -Inf)
1082
        NaN(),           // fmod(-0, 0)
1083
        Copysign(0, -1), // fmod(-0, Inf)
1084
        NaN(),           // fmod(-0, NaN)
1085
        0,               // fmod(0, -Inf)
1086
        NaN(),           // fmod(0, 0)
1087
        0,               // fmod(0, +Inf)
1088
        NaN(),           // fmod(0, NaN)
1089
        Pi,              // fmod(Pi, -Inf)
1090
        NaN(),           // fmod(Pi, 0)
1091
        Pi,              // fmod(Pi, +Inf)
1092
        NaN(),           // fmod(Pi, NaN)
1093
        NaN(),           // fmod(+Inf, -Inf)
1094
        NaN(),           // fmod(+Inf, -Pi)
1095
        NaN(),           // fmod(+Inf, 0)
1096
        NaN(),           // fmod(+Inf, Pi)
1097
        NaN(),           // fmod(+Inf, +Inf)
1098
        NaN(),           // fmod(+Inf, NaN)
1099
        NaN(),           // fmod(NaN, -Inf)
1100
        NaN(),           // fmod(NaN, -Pi)
1101
        NaN(),           // fmod(NaN, 0)
1102
        NaN(),           // fmod(NaN, Pi)
1103
        NaN(),           // fmod(NaN, +Inf)
1104
        NaN(),           // fmod(NaN, NaN)
1105
}
1106
 
1107
var vffrexpSC = []float64{
1108
        Inf(-1),
1109
        Copysign(0, -1),
1110
        0,
1111
        Inf(1),
1112
        NaN(),
1113
}
1114
var frexpSC = []fi{
1115
        {Inf(-1), 0},
1116
        {Copysign(0, -1), 0},
1117
        {0, 0},
1118
        {Inf(1), 0},
1119
        {NaN(), 0},
1120
}
1121
 
1122
var vfgammaSC = []float64{
1123
        Inf(-1),
1124
        -3,
1125
        Copysign(0, -1),
1126
        0,
1127
        Inf(1),
1128
        NaN(),
1129
}
1130
var gammaSC = []float64{
1131
        Inf(-1),
1132
        Inf(1),
1133
        Inf(1),
1134
        Inf(1),
1135
        Inf(1),
1136
        NaN(),
1137
}
1138
 
1139
var vfhypotSC = [][2]float64{
1140
        {Inf(-1), Inf(-1)},
1141
        {Inf(-1), 0},
1142
        {Inf(-1), Inf(1)},
1143
        {Inf(-1), NaN()},
1144
        {Copysign(0, -1), Copysign(0, -1)},
1145
        {Copysign(0, -1), 0},
1146
        {0, Copysign(0, -1)},
1147
        {0, 0}, // +0, +0
1148
        {0, Inf(-1)},
1149
        {0, Inf(1)},
1150
        {0, NaN()},
1151
        {Inf(1), Inf(-1)},
1152
        {Inf(1), 0},
1153
        {Inf(1), Inf(1)},
1154
        {Inf(1), NaN()},
1155
        {NaN(), Inf(-1)},
1156
        {NaN(), 0},
1157
        {NaN(), Inf(1)},
1158
        {NaN(), NaN()},
1159
}
1160
var hypotSC = []float64{
1161
        Inf(1),
1162
        Inf(1),
1163
        Inf(1),
1164
        Inf(1),
1165
        0,
1166
        0,
1167
        0,
1168
        0,
1169
        Inf(1),
1170
        Inf(1),
1171
        NaN(),
1172
        Inf(1),
1173
        Inf(1),
1174
        Inf(1),
1175
        Inf(1),
1176
        Inf(1),
1177
        NaN(),
1178
        Inf(1),
1179
        NaN(),
1180
}
1181
 
1182
var vfilogbSC = []float64{
1183
        Inf(-1),
1184
        0,
1185
        Inf(1),
1186
        NaN(),
1187
}
1188
var ilogbSC = []int{
1189
        MaxInt32,
1190
        MinInt32,
1191
        MaxInt32,
1192
        MaxInt32,
1193
}
1194
 
1195
var vfj0SC = []float64{
1196
        Inf(-1),
1197
        0,
1198
        Inf(1),
1199
        NaN(),
1200
}
1201
var j0SC = []float64{
1202
        0,
1203
        1,
1204
        0,
1205
        NaN(),
1206
}
1207
var j1SC = []float64{
1208
        0,
1209
        0,
1210
        0,
1211
        NaN(),
1212
}
1213
var j2SC = []float64{
1214
        0,
1215
        0,
1216
        0,
1217
        NaN(),
1218
}
1219
var jM3SC = []float64{
1220
        0,
1221
        0,
1222
        0,
1223
        NaN(),
1224
}
1225
 
1226
var vfldexpSC = []fi{
1227
        {0, 0},
1228
        {0, -1075},
1229
        {0, 1024},
1230
        {Copysign(0, -1), 0},
1231
        {Copysign(0, -1), -1075},
1232
        {Copysign(0, -1), 1024},
1233
        {Inf(1), 0},
1234
        {Inf(1), -1024},
1235
        {Inf(-1), 0},
1236
        {Inf(-1), -1024},
1237
        {NaN(), -1024},
1238
}
1239
var ldexpSC = []float64{
1240
        0,
1241
        0,
1242
        0,
1243
        Copysign(0, -1),
1244
        Copysign(0, -1),
1245
        Copysign(0, -1),
1246
        Inf(1),
1247
        Inf(1),
1248
        Inf(-1),
1249
        Inf(-1),
1250
        NaN(),
1251
}
1252
 
1253
var vflgammaSC = []float64{
1254
        Inf(-1),
1255
        -3,
1256
        0,
1257
        1,
1258
        2,
1259
        Inf(1),
1260
        NaN(),
1261
}
1262
var lgammaSC = []fi{
1263
        {Inf(-1), 1},
1264
        {Inf(1), 1},
1265
        {Inf(1), 1},
1266
        {0, 1},
1267
        {0, 1},
1268
        {Inf(1), 1},
1269
        {NaN(), 1},
1270
}
1271
 
1272
var vflogSC = []float64{
1273
        Inf(-1),
1274
        -Pi,
1275
        Copysign(0, -1),
1276
        0,
1277
        1,
1278
        Inf(1),
1279
        NaN(),
1280
}
1281
var logSC = []float64{
1282
        NaN(),
1283
        NaN(),
1284
        Inf(-1),
1285
        Inf(-1),
1286
        0,
1287
        Inf(1),
1288
        NaN(),
1289
}
1290
 
1291
var vflogbSC = []float64{
1292
        Inf(-1),
1293
        0,
1294
        Inf(1),
1295
        NaN(),
1296
}
1297
var logbSC = []float64{
1298
        Inf(1),
1299
        Inf(-1),
1300
        Inf(1),
1301
        NaN(),
1302
}
1303
 
1304
var vflog1pSC = []float64{
1305
        Inf(-1),
1306
        -Pi,
1307
        -1,
1308
        Copysign(0, -1),
1309
        0,
1310
        Inf(1),
1311
        NaN(),
1312
}
1313
var log1pSC = []float64{
1314
        NaN(),
1315
        NaN(),
1316
        Inf(-1),
1317
        Copysign(0, -1),
1318
        0,
1319
        Inf(1),
1320
        NaN(),
1321
}
1322
 
1323
var vfmodfSC = []float64{
1324
        Inf(-1),
1325
        Inf(1),
1326
        NaN(),
1327
}
1328
var modfSC = [][2]float64{
1329
        {Inf(-1), NaN()}, // [2]float64{Copysign(0, -1), Inf(-1)},
1330
        {Inf(1), NaN()},  // [2]float64{0, Inf(1)},
1331
        {NaN(), NaN()},
1332
}
1333
 
1334
var vfnextafterSC = [][2]float64{
1335
        {0, 0},
1336
        {0, Copysign(0, -1)},
1337
        {0, -1},
1338
        {0, NaN()},
1339
        {Copysign(0, -1), 1},
1340
        {Copysign(0, -1), 0},
1341
        {Copysign(0, -1), Copysign(0, -1)},
1342
        {Copysign(0, -1), -1},
1343
        {NaN(), 0},
1344
        {NaN(), NaN()},
1345
}
1346
var nextafterSC = []float64{
1347
        0,
1348
        0,
1349
        -4.9406564584124654418e-324, // Float64frombits(0x8000000000000001)
1350
        NaN(),
1351
        4.9406564584124654418e-324, // Float64frombits(0x0000000000000001)
1352
        Copysign(0, -1),
1353
        Copysign(0, -1),
1354
        -4.9406564584124654418e-324, // Float64frombits(0x8000000000000001)
1355
        NaN(),
1356
        NaN(),
1357
}
1358
 
1359
var vfpowSC = [][2]float64{
1360
        {Inf(-1), -Pi},
1361
        {Inf(-1), -3},
1362
        {Inf(-1), Copysign(0, -1)},
1363
        {Inf(-1), 0},
1364
        {Inf(-1), 1},
1365
        {Inf(-1), 3},
1366
        {Inf(-1), Pi},
1367
        {Inf(-1), NaN()},
1368
 
1369
        {-Pi, Inf(-1)},
1370
        {-Pi, -Pi},
1371
        {-Pi, Copysign(0, -1)},
1372
        {-Pi, 0},
1373
        {-Pi, 1},
1374
        {-Pi, Pi},
1375
        {-Pi, Inf(1)},
1376
        {-Pi, NaN()},
1377
 
1378
        {-1, Inf(-1)},
1379
        {-1, Inf(1)},
1380
        {-1, NaN()},
1381
        {-1 / 2, Inf(-1)},
1382
        {-1 / 2, Inf(1)},
1383
        {Copysign(0, -1), Inf(-1)},
1384
        {Copysign(0, -1), -Pi},
1385
        {Copysign(0, -1), -3},
1386
        {Copysign(0, -1), 3},
1387
        {Copysign(0, -1), Pi},
1388
        {Copysign(0, -1), Inf(1)},
1389
 
1390
        {0, Inf(-1)},
1391
        {0, -Pi},
1392
        {0, -3},
1393
        {0, Copysign(0, -1)},
1394
        {0, 0},
1395
        {0, 3},
1396
        {0, Pi},
1397
        {0, Inf(1)},
1398
        {0, NaN()},
1399
 
1400
        {1 / 2, Inf(-1)},
1401
        {1 / 2, Inf(1)},
1402
        {1, Inf(-1)},
1403
        {1, Inf(1)},
1404
        {1, NaN()},
1405
 
1406
        {Pi, Inf(-1)},
1407
        {Pi, Copysign(0, -1)},
1408
        {Pi, 0},
1409
        {Pi, 1},
1410
        {Pi, Inf(1)},
1411
        {Pi, NaN()},
1412
        {Inf(1), -Pi},
1413
        {Inf(1), Copysign(0, -1)},
1414
        {Inf(1), 0},
1415
        {Inf(1), 1},
1416
        {Inf(1), Pi},
1417
        {Inf(1), NaN()},
1418
        {NaN(), -Pi},
1419
        {NaN(), Copysign(0, -1)},
1420
        {NaN(), 0},
1421
        {NaN(), 1},
1422
        {NaN(), Pi},
1423
        {NaN(), NaN()},
1424
}
1425
var powSC = []float64{
1426
        0,               // pow(-Inf, -Pi)
1427
        Copysign(0, -1), // pow(-Inf, -3)
1428
        1,               // pow(-Inf, -0)
1429
        1,               // pow(-Inf, +0)
1430
        Inf(-1),         // pow(-Inf, 1)
1431
        Inf(-1),         // pow(-Inf, 3)
1432
        Inf(1),          // pow(-Inf, Pi)
1433
        NaN(),           // pow(-Inf, NaN)
1434
        0,               // pow(-Pi, -Inf)
1435
        NaN(),           // pow(-Pi, -Pi)
1436
        1,               // pow(-Pi, -0)
1437
        1,               // pow(-Pi, +0)
1438
        -Pi,             // pow(-Pi, 1)
1439
        NaN(),           // pow(-Pi, Pi)
1440
        Inf(1),          // pow(-Pi, +Inf)
1441
        NaN(),           // pow(-Pi, NaN)
1442
        1,               // pow(-1, -Inf) IEEE 754-2008
1443
        1,               // pow(-1, +Inf) IEEE 754-2008
1444
        NaN(),           // pow(-1, NaN)
1445
        Inf(1),          // pow(-1/2, -Inf)
1446
        0,               // pow(-1/2, +Inf)
1447
        Inf(1),          // pow(-0, -Inf)
1448
        Inf(1),          // pow(-0, -Pi)
1449
        Inf(-1),         // pow(-0, -3) IEEE 754-2008
1450
        Copysign(0, -1), // pow(-0, 3) IEEE 754-2008
1451
        0,               // pow(-0, +Pi)
1452
        0,               // pow(-0, +Inf)
1453
        Inf(1),          // pow(+0, -Inf)
1454
        Inf(1),          // pow(+0, -Pi)
1455
        Inf(1),          // pow(+0, -3)
1456
        1,               // pow(+0, -0)
1457
        1,               // pow(+0, +0)
1458
        0,               // pow(+0, 3)
1459
        0,               // pow(+0, +Pi)
1460
        0,               // pow(+0, +Inf)
1461
        NaN(),           // pow(+0, NaN)
1462
        Inf(1),          // pow(1/2, -Inf)
1463
        0,               // pow(1/2, +Inf)
1464
        1,               // pow(1, -Inf) IEEE 754-2008
1465
        1,               // pow(1, +Inf) IEEE 754-2008
1466
        1,               // pow(1, NaN) IEEE 754-2008
1467
        0,               // pow(+Pi, -Inf)
1468
        1,               // pow(+Pi, -0)
1469
        1,               // pow(+Pi, +0)
1470
        Pi,              // pow(+Pi, 1)
1471
        Inf(1),          // pow(+Pi, +Inf)
1472
        NaN(),           // pow(+Pi, NaN)
1473
        0,               // pow(+Inf, -Pi)
1474
        1,               // pow(+Inf, -0)
1475
        1,               // pow(+Inf, +0)
1476
        Inf(1),          // pow(+Inf, 1)
1477
        Inf(1),          // pow(+Inf, Pi)
1478
        NaN(),           // pow(+Inf, NaN)
1479
        NaN(),           // pow(NaN, -Pi)
1480
        1,               // pow(NaN, -0)
1481
        1,               // pow(NaN, +0)
1482
        NaN(),           // pow(NaN, 1)
1483
        NaN(),           // pow(NaN, +Pi)
1484
        NaN(),           // pow(NaN, NaN)
1485
}
1486
 
1487
var vfpow10SC = []int{
1488
        MinInt32,
1489
        MaxInt32,
1490
        -325,
1491
        309,
1492
}
1493
 
1494
var pow10SC = []float64{
1495
        0,      // pow10(MinInt32)
1496
        Inf(1), // pow10(MaxInt32)
1497
        0,      // pow10(-325)
1498
        Inf(1), // pow10(309)
1499
}
1500
 
1501
var vfsignbitSC = []float64{
1502
        Inf(-1),
1503
        Copysign(0, -1),
1504
        0,
1505
        Inf(1),
1506
        NaN(),
1507
}
1508
var signbitSC = []bool{
1509
        true,
1510
        true,
1511
        false,
1512
        false,
1513
        false,
1514
}
1515
 
1516
var vfsinSC = []float64{
1517
        Inf(-1),
1518
        Copysign(0, -1),
1519
        0,
1520
        Inf(1),
1521
        NaN(),
1522
}
1523
var sinSC = []float64{
1524
        NaN(),
1525
        Copysign(0, -1),
1526
        0,
1527
        NaN(),
1528
        NaN(),
1529
}
1530
 
1531
var vfsinhSC = []float64{
1532
        Inf(-1),
1533
        Copysign(0, -1),
1534
        0,
1535
        Inf(1),
1536
        NaN(),
1537
}
1538
var sinhSC = []float64{
1539
        Inf(-1),
1540
        Copysign(0, -1),
1541
        0,
1542
        Inf(1),
1543
        NaN(),
1544
}
1545
 
1546
var vfsqrtSC = []float64{
1547
        Inf(-1),
1548
        -Pi,
1549
        Copysign(0, -1),
1550
        0,
1551
        Inf(1),
1552
        NaN(),
1553
}
1554
var sqrtSC = []float64{
1555
        NaN(),
1556
        NaN(),
1557
        Copysign(0, -1),
1558
        0,
1559
        Inf(1),
1560
        NaN(),
1561
}
1562
 
1563
var vftanhSC = []float64{
1564
        Inf(-1),
1565
        Copysign(0, -1),
1566
        0,
1567
        Inf(1),
1568
        NaN(),
1569
}
1570
var tanhSC = []float64{
1571
        -1,
1572
        Copysign(0, -1),
1573
        0,
1574
        1,
1575
        NaN(),
1576
}
1577
 
1578
var vfy0SC = []float64{
1579
        Inf(-1),
1580
        0,
1581
        Inf(1),
1582
        NaN(),
1583
}
1584
var y0SC = []float64{
1585
        NaN(),
1586
        Inf(-1),
1587
        0,
1588
        NaN(),
1589
}
1590
var y1SC = []float64{
1591
        NaN(),
1592
        Inf(-1),
1593
        0,
1594
        NaN(),
1595
}
1596
var y2SC = []float64{
1597
        NaN(),
1598
        Inf(-1),
1599
        0,
1600
        NaN(),
1601
}
1602
var yM3SC = []float64{
1603
        NaN(),
1604
        Inf(1),
1605
        0,
1606
        NaN(),
1607
}
1608
 
1609
// arguments and expected results for boundary cases
1610
const (
1611
        SmallestNormalFloat64   = 2.2250738585072014e-308 // 2**-1022
1612
        LargestSubnormalFloat64 = SmallestNormalFloat64 - SmallestNonzeroFloat64
1613
)
1614
 
1615
var vffrexpBC = []float64{
1616
        SmallestNormalFloat64,
1617
        LargestSubnormalFloat64,
1618
        SmallestNonzeroFloat64,
1619
        MaxFloat64,
1620
        -SmallestNormalFloat64,
1621
        -LargestSubnormalFloat64,
1622
        -SmallestNonzeroFloat64,
1623
        -MaxFloat64,
1624
}
1625
var frexpBC = []fi{
1626
        {0.5, -1021},
1627
        {0.99999999999999978, -1022},
1628
        {0.5, -1073},
1629
        {0.99999999999999989, 1024},
1630
        {-0.5, -1021},
1631
        {-0.99999999999999978, -1022},
1632
        {-0.5, -1073},
1633
        {-0.99999999999999989, 1024},
1634
}
1635
 
1636
var vfldexpBC = []fi{
1637
        {SmallestNormalFloat64, -52},
1638
        {LargestSubnormalFloat64, -51},
1639
        {SmallestNonzeroFloat64, 1074},
1640
        {MaxFloat64, -(1023 + 1074)},
1641
        {1, -1075},
1642
        {-1, -1075},
1643
        {1, 1024},
1644
        {-1, 1024},
1645
}
1646
var ldexpBC = []float64{
1647
        SmallestNonzeroFloat64,
1648
        1e-323, // 2**-1073
1649
        1,
1650
        1e-323, // 2**-1073
1651
        0,
1652
        Copysign(0, -1),
1653
        Inf(1),
1654
        Inf(-1),
1655
}
1656
 
1657
var logbBC = []float64{
1658
        -1022,
1659
        -1023,
1660
        -1074,
1661
        1023,
1662
        -1022,
1663
        -1023,
1664
        -1074,
1665
        1023,
1666
}
1667
 
1668
func tolerance(a, b, e float64) bool {
1669
        d := a - b
1670
        if d < 0 {
1671
                d = -d
1672
        }
1673
 
1674
        if a != 0 {
1675
                e = e * a
1676
                if e < 0 {
1677
                        e = -e
1678
                }
1679
        }
1680
        return d < e
1681
}
1682
func kindaclose(a, b float64) bool { return tolerance(a, b, 1e-8) }
1683
func close(a, b float64) bool      { return tolerance(a, b, 1e-14) }
1684
func veryclose(a, b float64) bool  { return tolerance(a, b, 4e-16) }
1685
func soclose(a, b, e float64) bool { return tolerance(a, b, e) }
1686
func alike(a, b float64) bool {
1687
        switch {
1688
        case IsNaN(a) && IsNaN(b):
1689
                return true
1690
        case a == b:
1691
                return Signbit(a) == Signbit(b)
1692
        }
1693
        return false
1694
}
1695
 
1696
func TestAcos(t *testing.T) {
1697
        for i := 0; i < len(vf); i++ {
1698
                a := vf[i] / 10
1699
                if f := Acos(a); !close(acos[i], f) {
1700
                        t.Errorf("Acos(%g) = %g, want %g", a, f, acos[i])
1701
                }
1702
        }
1703
        for i := 0; i < len(vfacosSC); i++ {
1704
                if f := Acos(vfacosSC[i]); !alike(acosSC[i], f) {
1705
                        t.Errorf("Acos(%g) = %g, want %g", vfacosSC[i], f, acosSC[i])
1706
                }
1707
        }
1708
}
1709
 
1710
func TestAcosh(t *testing.T) {
1711
        for i := 0; i < len(vf); i++ {
1712
                a := 1 + Abs(vf[i])
1713
                if f := Acosh(a); !veryclose(acosh[i], f) {
1714
                        t.Errorf("Acosh(%g) = %g, want %g", a, f, acosh[i])
1715
                }
1716
        }
1717
        for i := 0; i < len(vfacoshSC); i++ {
1718
                if f := Acosh(vfacoshSC[i]); !alike(acoshSC[i], f) {
1719
                        t.Errorf("Acosh(%g) = %g, want %g", vfacoshSC[i], f, acoshSC[i])
1720
                }
1721
        }
1722
}
1723
 
1724
func TestAsin(t *testing.T) {
1725
        for i := 0; i < len(vf); i++ {
1726
                a := vf[i] / 10
1727
                if f := Asin(a); !veryclose(asin[i], f) {
1728
                        t.Errorf("Asin(%g) = %g, want %g", a, f, asin[i])
1729
                }
1730
        }
1731
        for i := 0; i < len(vfasinSC); i++ {
1732
                if f := Asin(vfasinSC[i]); !alike(asinSC[i], f) {
1733
                        t.Errorf("Asin(%g) = %g, want %g", vfasinSC[i], f, asinSC[i])
1734
                }
1735
        }
1736
}
1737
 
1738
func TestAsinh(t *testing.T) {
1739
        for i := 0; i < len(vf); i++ {
1740
                if f := Asinh(vf[i]); !veryclose(asinh[i], f) {
1741
                        t.Errorf("Asinh(%g) = %g, want %g", vf[i], f, asinh[i])
1742
                }
1743
        }
1744
        for i := 0; i < len(vfasinhSC); i++ {
1745
                if f := Asinh(vfasinhSC[i]); !alike(asinhSC[i], f) {
1746
                        t.Errorf("Asinh(%g) = %g, want %g", vfasinhSC[i], f, asinhSC[i])
1747
                }
1748
        }
1749
}
1750
 
1751
func TestAtan(t *testing.T) {
1752
        for i := 0; i < len(vf); i++ {
1753
                if f := Atan(vf[i]); !veryclose(atan[i], f) {
1754
                        t.Errorf("Atan(%g) = %g, want %g", vf[i], f, atan[i])
1755
                }
1756
        }
1757
        for i := 0; i < len(vfatanSC); i++ {
1758
                if f := Atan(vfatanSC[i]); !alike(atanSC[i], f) {
1759
                        t.Errorf("Atan(%g) = %g, want %g", vfatanSC[i], f, atanSC[i])
1760
                }
1761
        }
1762
}
1763
 
1764
func TestAtanh(t *testing.T) {
1765
        for i := 0; i < len(vf); i++ {
1766
                a := vf[i] / 10
1767
                if f := Atanh(a); !veryclose(atanh[i], f) {
1768
                        t.Errorf("Atanh(%g) = %g, want %g", a, f, atanh[i])
1769
                }
1770
        }
1771
        for i := 0; i < len(vfatanhSC); i++ {
1772
                if f := Atanh(vfatanhSC[i]); !alike(atanhSC[i], f) {
1773
                        t.Errorf("Atanh(%g) = %g, want %g", vfatanhSC[i], f, atanhSC[i])
1774
                }
1775
        }
1776
}
1777
 
1778
func TestAtan2(t *testing.T) {
1779
        for i := 0; i < len(vf); i++ {
1780
                if f := Atan2(10, vf[i]); !veryclose(atan2[i], f) {
1781
                        t.Errorf("Atan2(10, %g) = %g, want %g", vf[i], f, atan2[i])
1782
                }
1783
        }
1784
        for i := 0; i < len(vfatan2SC); i++ {
1785
                if f := Atan2(vfatan2SC[i][0], vfatan2SC[i][1]); !alike(atan2SC[i], f) {
1786
                        t.Errorf("Atan2(%g, %g) = %g, want %g", vfatan2SC[i][0], vfatan2SC[i][1], f, atan2SC[i])
1787
                }
1788
        }
1789
}
1790
 
1791
func TestCbrt(t *testing.T) {
1792
        for i := 0; i < len(vf); i++ {
1793
                if f := Cbrt(vf[i]); !veryclose(cbrt[i], f) {
1794
                        t.Errorf("Cbrt(%g) = %g, want %g", vf[i], f, cbrt[i])
1795
                }
1796
        }
1797
        for i := 0; i < len(vfcbrtSC); i++ {
1798
                if f := Cbrt(vfcbrtSC[i]); !alike(cbrtSC[i], f) {
1799
                        t.Errorf("Cbrt(%g) = %g, want %g", vfcbrtSC[i], f, cbrtSC[i])
1800
                }
1801
        }
1802
}
1803
 
1804
func TestCeil(t *testing.T) {
1805
        for i := 0; i < len(vf); i++ {
1806
                if f := Ceil(vf[i]); ceil[i] != f {
1807
                        t.Errorf("Ceil(%g) = %g, want %g", vf[i], f, ceil[i])
1808
                }
1809
        }
1810
        for i := 0; i < len(vfceilSC); i++ {
1811
                if f := Ceil(vfceilSC[i]); !alike(ceilSC[i], f) {
1812
                        t.Errorf("Ceil(%g) = %g, want %g", vfceilSC[i], f, ceilSC[i])
1813
                }
1814
        }
1815
}
1816
 
1817
func TestCopysign(t *testing.T) {
1818
        for i := 0; i < len(vf); i++ {
1819
                if f := Copysign(vf[i], -1); copysign[i] != f {
1820
                        t.Errorf("Copysign(%g, -1) = %g, want %g", vf[i], f, copysign[i])
1821
                }
1822
        }
1823
        for i := 0; i < len(vf); i++ {
1824
                if f := Copysign(vf[i], 1); -copysign[i] != f {
1825
                        t.Errorf("Copysign(%g, 1) = %g, want %g", vf[i], f, -copysign[i])
1826
                }
1827
        }
1828
        for i := 0; i < len(vfcopysignSC); i++ {
1829
                if f := Copysign(vfcopysignSC[i], -1); !alike(copysignSC[i], f) {
1830
                        t.Errorf("Copysign(%g, -1) = %g, want %g", vfcopysignSC[i], f, copysignSC[i])
1831
                }
1832
        }
1833
}
1834
 
1835
func TestCos(t *testing.T) {
1836
        for i := 0; i < len(vf); i++ {
1837
                if f := Cos(vf[i]); !veryclose(cos[i], f) {
1838
                        t.Errorf("Cos(%g) = %g, want %g", vf[i], f, cos[i])
1839
                }
1840
        }
1841
        for i := 0; i < len(vfcosSC); i++ {
1842
                if f := Cos(vfcosSC[i]); !alike(cosSC[i], f) {
1843
                        t.Errorf("Cos(%g) = %g, want %g", vfcosSC[i], f, cosSC[i])
1844
                }
1845
        }
1846
}
1847
 
1848
func TestCosh(t *testing.T) {
1849
        for i := 0; i < len(vf); i++ {
1850
                if f := Cosh(vf[i]); !close(cosh[i], f) {
1851
                        t.Errorf("Cosh(%g) = %g, want %g", vf[i], f, cosh[i])
1852
                }
1853
        }
1854
        for i := 0; i < len(vfcoshSC); i++ {
1855
                if f := Cosh(vfcoshSC[i]); !alike(coshSC[i], f) {
1856
                        t.Errorf("Cosh(%g) = %g, want %g", vfcoshSC[i], f, coshSC[i])
1857
                }
1858
        }
1859
}
1860
 
1861
func TestErf(t *testing.T) {
1862
        for i := 0; i < len(vf); i++ {
1863
                a := vf[i] / 10
1864
                if f := Erf(a); !veryclose(erf[i], f) {
1865
                        t.Errorf("Erf(%g) = %g, want %g", a, f, erf[i])
1866
                }
1867
        }
1868
        for i := 0; i < len(vferfSC); i++ {
1869
                if f := Erf(vferfSC[i]); !alike(erfSC[i], f) {
1870
                        t.Errorf("Erf(%g) = %g, want %g", vferfSC[i], f, erfSC[i])
1871
                }
1872
        }
1873
}
1874
 
1875
func TestErfc(t *testing.T) {
1876
        for i := 0; i < len(vf); i++ {
1877
                a := vf[i] / 10
1878
                if f := Erfc(a); !veryclose(erfc[i], f) {
1879
                        t.Errorf("Erfc(%g) = %g, want %g", a, f, erfc[i])
1880
                }
1881
        }
1882
        for i := 0; i < len(vferfcSC); i++ {
1883
                if f := Erfc(vferfcSC[i]); !alike(erfcSC[i], f) {
1884
                        t.Errorf("Erfc(%g) = %g, want %g", vferfcSC[i], f, erfcSC[i])
1885
                }
1886
        }
1887
}
1888
 
1889
func TestExp(t *testing.T) {
1890
        testExp(t, Exp, "Exp")
1891
        testExp(t, ExpGo, "ExpGo")
1892
}
1893
 
1894
func testExp(t *testing.T, Exp func(float64) float64, name string) {
1895
        for i := 0; i < len(vf); i++ {
1896
                if f := Exp(vf[i]); !close(exp[i], f) {
1897
                        t.Errorf("%s(%g) = %g, want %g", name, vf[i], f, exp[i])
1898
                }
1899
        }
1900
        for i := 0; i < len(vfexpSC); i++ {
1901
                if f := Exp(vfexpSC[i]); !alike(expSC[i], f) {
1902
                        t.Errorf("%s(%g) = %g, want %g", name, vfexpSC[i], f, expSC[i])
1903
                }
1904
        }
1905
}
1906
 
1907
func TestExpm1(t *testing.T) {
1908
        for i := 0; i < len(vf); i++ {
1909
                a := vf[i] / 100
1910
                if f := Expm1(a); !veryclose(expm1[i], f) {
1911
                        t.Errorf("Expm1(%g) = %g, want %g", a, f, expm1[i])
1912
                }
1913
        }
1914
        for i := 0; i < len(vfexpm1SC); i++ {
1915
                if f := Expm1(vfexpm1SC[i]); !alike(expm1SC[i], f) {
1916
                        t.Errorf("Expm1(%g) = %g, want %g", vfexpm1SC[i], f, expm1SC[i])
1917
                }
1918
        }
1919
}
1920
 
1921
func TestExp2(t *testing.T) {
1922
        testExp2(t, Exp2, "Exp2")
1923
        testExp2(t, Exp2Go, "Exp2Go")
1924
}
1925
 
1926
func testExp2(t *testing.T, Exp2 func(float64) float64, name string) {
1927
        for i := 0; i < len(vf); i++ {
1928
                if f := Exp2(vf[i]); !close(exp2[i], f) {
1929
                        t.Errorf("%s(%g) = %g, want %g", name, vf[i], f, exp2[i])
1930
                }
1931
        }
1932
        for i := 0; i < len(vfexpSC); i++ {
1933
                if f := Exp2(vfexpSC[i]); !alike(expSC[i], f) {
1934
                        t.Errorf("%s(%g) = %g, want %g", name, vfexpSC[i], f, expSC[i])
1935
                }
1936
        }
1937
        for n := -1074; n < 1024; n++ {
1938
                f := Exp2(float64(n))
1939
                vf := Ldexp(1, n)
1940
                if f != vf {
1941
                        t.Errorf("%s(%d) = %g, want %g", name, n, f, vf)
1942
                }
1943
        }
1944
}
1945
 
1946
func TestAbs(t *testing.T) {
1947
        for i := 0; i < len(vf); i++ {
1948
                if f := Abs(vf[i]); fabs[i] != f {
1949
                        t.Errorf("Abs(%g) = %g, want %g", vf[i], f, fabs[i])
1950
                }
1951
        }
1952
        for i := 0; i < len(vffabsSC); i++ {
1953
                if f := Abs(vffabsSC[i]); !alike(fabsSC[i], f) {
1954
                        t.Errorf("Abs(%g) = %g, want %g", vffabsSC[i], f, fabsSC[i])
1955
                }
1956
        }
1957
}
1958
 
1959
func TestDim(t *testing.T) {
1960
        for i := 0; i < len(vf); i++ {
1961
                if f := Dim(vf[i], 0); fdim[i] != f {
1962
                        t.Errorf("Dim(%g, %g) = %g, want %g", vf[i], 0.0, f, fdim[i])
1963
                }
1964
        }
1965
        for i := 0; i < len(vffdimSC); i++ {
1966
                if f := Dim(vffdimSC[i][0], vffdimSC[i][1]); !alike(fdimSC[i], f) {
1967
                        t.Errorf("Dim(%g, %g) = %g, want %g", vffdimSC[i][0], vffdimSC[i][1], f, fdimSC[i])
1968
                }
1969
        }
1970
}
1971
 
1972
func TestFloor(t *testing.T) {
1973
        for i := 0; i < len(vf); i++ {
1974
                if f := Floor(vf[i]); floor[i] != f {
1975
                        t.Errorf("Floor(%g) = %g, want %g", vf[i], f, floor[i])
1976
                }
1977
        }
1978
        for i := 0; i < len(vfceilSC); i++ {
1979
                if f := Floor(vfceilSC[i]); !alike(ceilSC[i], f) {
1980
                        t.Errorf("Floor(%g) = %g, want %g", vfceilSC[i], f, ceilSC[i])
1981
                }
1982
        }
1983
}
1984
 
1985
func TestMax(t *testing.T) {
1986
        for i := 0; i < len(vf); i++ {
1987
                if f := Max(vf[i], ceil[i]); ceil[i] != f {
1988
                        t.Errorf("Max(%g, %g) = %g, want %g", vf[i], ceil[i], f, ceil[i])
1989
                }
1990
        }
1991
        for i := 0; i < len(vffdimSC); i++ {
1992
                if f := Max(vffdimSC[i][0], vffdimSC[i][1]); !alike(fmaxSC[i], f) {
1993
                        t.Errorf("Max(%g, %g) = %g, want %g", vffdimSC[i][0], vffdimSC[i][1], f, fmaxSC[i])
1994
                }
1995
        }
1996
}
1997
 
1998
func TestMin(t *testing.T) {
1999
        for i := 0; i < len(vf); i++ {
2000
                if f := Min(vf[i], floor[i]); floor[i] != f {
2001
                        t.Errorf("Min(%g, %g) = %g, want %g", vf[i], floor[i], f, floor[i])
2002
                }
2003
        }
2004
        for i := 0; i < len(vffdimSC); i++ {
2005
                if f := Min(vffdimSC[i][0], vffdimSC[i][1]); !alike(fminSC[i], f) {
2006
                        t.Errorf("Min(%g, %g) = %g, want %g", vffdimSC[i][0], vffdimSC[i][1], f, fminSC[i])
2007
                }
2008
        }
2009
}
2010
 
2011
func TestMod(t *testing.T) {
2012
        for i := 0; i < len(vf); i++ {
2013
                if f := Mod(10, vf[i]); fmod[i] != f {
2014
                        t.Errorf("Mod(10, %g) = %g, want %g", vf[i], f, fmod[i])
2015
                }
2016
        }
2017
        for i := 0; i < len(vffmodSC); i++ {
2018
                if f := Mod(vffmodSC[i][0], vffmodSC[i][1]); !alike(fmodSC[i], f) {
2019
                        t.Errorf("Mod(%g, %g) = %g, want %g", vffmodSC[i][0], vffmodSC[i][1], f, fmodSC[i])
2020
                }
2021
        }
2022
}
2023
 
2024
func TestFrexp(t *testing.T) {
2025
        for i := 0; i < len(vf); i++ {
2026
                if f, j := Frexp(vf[i]); !veryclose(frexp[i].f, f) || frexp[i].i != j {
2027
                        t.Errorf("Frexp(%g) = %g, %d, want %g, %d", vf[i], f, j, frexp[i].f, frexp[i].i)
2028
                }
2029
        }
2030
        for i := 0; i < len(vffrexpSC); i++ {
2031
                if f, j := Frexp(vffrexpSC[i]); !alike(frexpSC[i].f, f) || frexpSC[i].i != j {
2032
                        t.Errorf("Frexp(%g) = %g, %d, want %g, %d", vffrexpSC[i], f, j, frexpSC[i].f, frexpSC[i].i)
2033
                }
2034
        }
2035
        for i := 0; i < len(vffrexpBC); i++ {
2036
                if f, j := Frexp(vffrexpBC[i]); !alike(frexpBC[i].f, f) || frexpBC[i].i != j {
2037
                        t.Errorf("Frexp(%g) = %g, %d, want %g, %d", vffrexpBC[i], f, j, frexpBC[i].f, frexpBC[i].i)
2038
                }
2039
        }
2040
}
2041
 
2042
func TestGamma(t *testing.T) {
2043
        for i := 0; i < len(vf); i++ {
2044
                if f := Gamma(vf[i]); !close(gamma[i], f) {
2045
                        t.Errorf("Gamma(%g) = %g, want %g", vf[i], f, gamma[i])
2046
                }
2047
        }
2048
        for i := 0; i < len(vfgammaSC); i++ {
2049
                if f := Gamma(vfgammaSC[i]); !alike(gammaSC[i], f) {
2050
                        t.Errorf("Gamma(%g) = %g, want %g", vfgammaSC[i], f, gammaSC[i])
2051
                }
2052
        }
2053
}
2054
 
2055
func TestHypot(t *testing.T) {
2056
        for i := 0; i < len(vf); i++ {
2057
                a := Abs(1e200 * tanh[i] * Sqrt(2))
2058
                if f := Hypot(1e200*tanh[i], 1e200*tanh[i]); !veryclose(a, f) {
2059
                        t.Errorf("Hypot(%g, %g) = %g, want %g", 1e200*tanh[i], 1e200*tanh[i], f, a)
2060
                }
2061
        }
2062
        for i := 0; i < len(vfhypotSC); i++ {
2063
                if f := Hypot(vfhypotSC[i][0], vfhypotSC[i][1]); !alike(hypotSC[i], f) {
2064
                        t.Errorf("Hypot(%g, %g) = %g, want %g", vfhypotSC[i][0], vfhypotSC[i][1], f, hypotSC[i])
2065
                }
2066
        }
2067
}
2068
 
2069
func TestHypotGo(t *testing.T) {
2070
        for i := 0; i < len(vf); i++ {
2071
                a := Abs(1e200 * tanh[i] * Sqrt(2))
2072
                if f := HypotGo(1e200*tanh[i], 1e200*tanh[i]); !veryclose(a, f) {
2073
                        t.Errorf("HypotGo(%g, %g) = %g, want %g", 1e200*tanh[i], 1e200*tanh[i], f, a)
2074
                }
2075
        }
2076
        for i := 0; i < len(vfhypotSC); i++ {
2077
                if f := HypotGo(vfhypotSC[i][0], vfhypotSC[i][1]); !alike(hypotSC[i], f) {
2078
                        t.Errorf("HypotGo(%g, %g) = %g, want %g", vfhypotSC[i][0], vfhypotSC[i][1], f, hypotSC[i])
2079
                }
2080
        }
2081
}
2082
 
2083
func TestIlogb(t *testing.T) {
2084
        for i := 0; i < len(vf); i++ {
2085
                a := frexp[i].i - 1 // adjust because fr in the interval [½, 1)
2086
                if e := Ilogb(vf[i]); a != e {
2087
                        t.Errorf("Ilogb(%g) = %d, want %d", vf[i], e, a)
2088
                }
2089
        }
2090
        for i := 0; i < len(vflogbSC); i++ {
2091
                if e := Ilogb(vflogbSC[i]); ilogbSC[i] != e {
2092
                        t.Errorf("Ilogb(%g) = %d, want %d", vflogbSC[i], e, ilogbSC[i])
2093
                }
2094
        }
2095
        for i := 0; i < len(vffrexpBC); i++ {
2096
                if e := Ilogb(vffrexpBC[i]); int(logbBC[i]) != e {
2097
                        t.Errorf("Ilogb(%g) = %d, want %d", vffrexpBC[i], e, int(logbBC[i]))
2098
                }
2099
        }
2100
}
2101
 
2102
func TestJ0(t *testing.T) {
2103
        for i := 0; i < len(vf); i++ {
2104
                if f := J0(vf[i]); !soclose(j0[i], f, 4e-14) {
2105
                        t.Errorf("J0(%g) = %g, want %g", vf[i], f, j0[i])
2106
                }
2107
        }
2108
        for i := 0; i < len(vfj0SC); i++ {
2109
                if f := J0(vfj0SC[i]); !alike(j0SC[i], f) {
2110
                        t.Errorf("J0(%g) = %g, want %g", vfj0SC[i], f, j0SC[i])
2111
                }
2112
        }
2113
}
2114
 
2115
func TestJ1(t *testing.T) {
2116
        for i := 0; i < len(vf); i++ {
2117
                if f := J1(vf[i]); !close(j1[i], f) {
2118
                        t.Errorf("J1(%g) = %g, want %g", vf[i], f, j1[i])
2119
                }
2120
        }
2121
        for i := 0; i < len(vfj0SC); i++ {
2122
                if f := J1(vfj0SC[i]); !alike(j1SC[i], f) {
2123
                        t.Errorf("J1(%g) = %g, want %g", vfj0SC[i], f, j1SC[i])
2124
                }
2125
        }
2126
}
2127
 
2128
func TestJn(t *testing.T) {
2129
        for i := 0; i < len(vf); i++ {
2130
                if f := Jn(2, vf[i]); !close(j2[i], f) {
2131
                        t.Errorf("Jn(2, %g) = %g, want %g", vf[i], f, j2[i])
2132
                }
2133
                if f := Jn(-3, vf[i]); !close(jM3[i], f) {
2134
                        t.Errorf("Jn(-3, %g) = %g, want %g", vf[i], f, jM3[i])
2135
                }
2136
        }
2137
        for i := 0; i < len(vfj0SC); i++ {
2138
                if f := Jn(2, vfj0SC[i]); !alike(j2SC[i], f) {
2139
                        t.Errorf("Jn(2, %g) = %g, want %g", vfj0SC[i], f, j2SC[i])
2140
                }
2141
                if f := Jn(-3, vfj0SC[i]); !alike(jM3SC[i], f) {
2142
                        t.Errorf("Jn(-3, %g) = %g, want %g", vfj0SC[i], f, jM3SC[i])
2143
                }
2144
        }
2145
}
2146
 
2147
func TestLdexp(t *testing.T) {
2148
        for i := 0; i < len(vf); i++ {
2149
                if f := Ldexp(frexp[i].f, frexp[i].i); !veryclose(vf[i], f) {
2150
                        t.Errorf("Ldexp(%g, %d) = %g, want %g", frexp[i].f, frexp[i].i, f, vf[i])
2151
                }
2152
        }
2153
        for i := 0; i < len(vffrexpSC); i++ {
2154
                if f := Ldexp(frexpSC[i].f, frexpSC[i].i); !alike(vffrexpSC[i], f) {
2155
                        t.Errorf("Ldexp(%g, %d) = %g, want %g", frexpSC[i].f, frexpSC[i].i, f, vffrexpSC[i])
2156
                }
2157
        }
2158
        for i := 0; i < len(vfldexpSC); i++ {
2159
                if f := Ldexp(vfldexpSC[i].f, vfldexpSC[i].i); !alike(ldexpSC[i], f) {
2160
                        t.Errorf("Ldexp(%g, %d) = %g, want %g", vfldexpSC[i].f, vfldexpSC[i].i, f, ldexpSC[i])
2161
                }
2162
        }
2163
        for i := 0; i < len(vffrexpBC); i++ {
2164
                if f := Ldexp(frexpBC[i].f, frexpBC[i].i); !alike(vffrexpBC[i], f) {
2165
                        t.Errorf("Ldexp(%g, %d) = %g, want %g", frexpBC[i].f, frexpBC[i].i, f, vffrexpBC[i])
2166
                }
2167
        }
2168
        for i := 0; i < len(vfldexpBC); i++ {
2169
                if f := Ldexp(vfldexpBC[i].f, vfldexpBC[i].i); !alike(ldexpBC[i], f) {
2170
                        t.Errorf("Ldexp(%g, %d) = %g, want %g", vfldexpBC[i].f, vfldexpBC[i].i, f, ldexpBC[i])
2171
                }
2172
        }
2173
}
2174
 
2175
func TestLgamma(t *testing.T) {
2176
        for i := 0; i < len(vf); i++ {
2177
                if f, s := Lgamma(vf[i]); !close(lgamma[i].f, f) || lgamma[i].i != s {
2178
                        t.Errorf("Lgamma(%g) = %g, %d, want %g, %d", vf[i], f, s, lgamma[i].f, lgamma[i].i)
2179
                }
2180
        }
2181
        for i := 0; i < len(vflgammaSC); i++ {
2182
                if f, s := Lgamma(vflgammaSC[i]); !alike(lgammaSC[i].f, f) || lgammaSC[i].i != s {
2183
                        t.Errorf("Lgamma(%g) = %g, %d, want %g, %d", vflgammaSC[i], f, s, lgammaSC[i].f, lgammaSC[i].i)
2184
                }
2185
        }
2186
}
2187
 
2188
func TestLog(t *testing.T) {
2189
        for i := 0; i < len(vf); i++ {
2190
                a := Abs(vf[i])
2191
                if f := Log(a); log[i] != f {
2192
                        t.Errorf("Log(%g) = %g, want %g", a, f, log[i])
2193
                }
2194
        }
2195
        if f := Log(10); f != Ln10 {
2196
                t.Errorf("Log(%g) = %g, want %g", 10.0, f, Ln10)
2197
        }
2198
        for i := 0; i < len(vflogSC); i++ {
2199
                if f := Log(vflogSC[i]); !alike(logSC[i], f) {
2200
                        t.Errorf("Log(%g) = %g, want %g", vflogSC[i], f, logSC[i])
2201
                }
2202
        }
2203
}
2204
 
2205
func TestLogb(t *testing.T) {
2206
        for i := 0; i < len(vf); i++ {
2207
                if f := Logb(vf[i]); logb[i] != f {
2208
                        t.Errorf("Logb(%g) = %g, want %g", vf[i], f, logb[i])
2209
                }
2210
        }
2211
        for i := 0; i < len(vflogbSC); i++ {
2212
                if f := Logb(vflogbSC[i]); !alike(logbSC[i], f) {
2213
                        t.Errorf("Logb(%g) = %g, want %g", vflogbSC[i], f, logbSC[i])
2214
                }
2215
        }
2216
        for i := 0; i < len(vffrexpBC); i++ {
2217
                if f := Logb(vffrexpBC[i]); !alike(logbBC[i], f) {
2218
                        t.Errorf("Logb(%g) = %g, want %g", vffrexpBC[i], f, logbBC[i])
2219
                }
2220
        }
2221
}
2222
 
2223
func TestLog10(t *testing.T) {
2224
        for i := 0; i < len(vf); i++ {
2225
                a := Abs(vf[i])
2226
                if f := Log10(a); !veryclose(log10[i], f) {
2227
                        t.Errorf("Log10(%g) = %g, want %g", a, f, log10[i])
2228
                }
2229
        }
2230
        if f := Log10(E); f != Log10E {
2231
                t.Errorf("Log10(%g) = %g, want %g", E, f, Log10E)
2232
        }
2233
        for i := 0; i < len(vflogSC); i++ {
2234
                if f := Log10(vflogSC[i]); !alike(logSC[i], f) {
2235
                        t.Errorf("Log10(%g) = %g, want %g", vflogSC[i], f, logSC[i])
2236
                }
2237
        }
2238
}
2239
 
2240
func TestLog1p(t *testing.T) {
2241
        for i := 0; i < len(vf); i++ {
2242
                a := vf[i] / 100
2243
                if f := Log1p(a); !veryclose(log1p[i], f) {
2244
                        t.Errorf("Log1p(%g) = %g, want %g", a, f, log1p[i])
2245
                }
2246
        }
2247
        a := 9.0
2248
        if f := Log1p(a); f != Ln10 {
2249
                t.Errorf("Log1p(%g) = %g, want %g", a, f, Ln10)
2250
        }
2251
        for i := 0; i < len(vflogSC); i++ {
2252
                if f := Log1p(vflog1pSC[i]); !alike(log1pSC[i], f) {
2253
                        t.Errorf("Log1p(%g) = %g, want %g", vflog1pSC[i], f, log1pSC[i])
2254
                }
2255
        }
2256
}
2257
 
2258
func TestLog2(t *testing.T) {
2259
        for i := 0; i < len(vf); i++ {
2260
                a := Abs(vf[i])
2261
                if f := Log2(a); !veryclose(log2[i], f) {
2262
                        t.Errorf("Log2(%g) = %g, want %g", a, f, log2[i])
2263
                }
2264
        }
2265
        if f := Log2(E); f != Log2E {
2266
                t.Errorf("Log2(%g) = %g, want %g", E, f, Log2E)
2267
        }
2268
        for i := 0; i < len(vflogSC); i++ {
2269
                if f := Log2(vflogSC[i]); !alike(logSC[i], f) {
2270
                        t.Errorf("Log2(%g) = %g, want %g", vflogSC[i], f, logSC[i])
2271
                }
2272
        }
2273
}
2274
 
2275
func TestModf(t *testing.T) {
2276
        for i := 0; i < len(vf); i++ {
2277
                if f, g := Modf(vf[i]); !veryclose(modf[i][0], f) || !veryclose(modf[i][1], g) {
2278
                        t.Errorf("Modf(%g) = %g, %g, want %g, %g", vf[i], f, g, modf[i][0], modf[i][1])
2279
                }
2280
        }
2281
        for i := 0; i < len(vfmodfSC); i++ {
2282
                if f, g := Modf(vfmodfSC[i]); !alike(modfSC[i][0], f) || !alike(modfSC[i][1], g) {
2283
                        t.Errorf("Modf(%g) = %g, %g, want %g, %g", vfmodfSC[i], f, g, modfSC[i][0], modfSC[i][1])
2284
                }
2285
        }
2286
}
2287
 
2288
func TestNextafter(t *testing.T) {
2289
        for i := 0; i < len(vf); i++ {
2290
                if f := Nextafter(vf[i], 10); nextafter[i] != f {
2291
                        t.Errorf("Nextafter(%g, %g) = %g want %g", vf[i], 10.0, f, nextafter[i])
2292
                }
2293
        }
2294
        for i := 0; i < len(vfnextafterSC); i++ {
2295
                if f := Nextafter(vfnextafterSC[i][0], vfnextafterSC[i][1]); !alike(nextafterSC[i], f) {
2296
                        t.Errorf("Nextafter(%g, %g) = %g want %g", vfnextafterSC[i][0], vfnextafterSC[i][1], f, nextafterSC[i])
2297
                }
2298
        }
2299
}
2300
 
2301
func TestPow(t *testing.T) {
2302
        for i := 0; i < len(vf); i++ {
2303
                if f := Pow(10, vf[i]); !close(pow[i], f) {
2304
                        t.Errorf("Pow(10, %g) = %g, want %g", vf[i], f, pow[i])
2305
                }
2306
        }
2307
        for i := 0; i < len(vfpowSC); i++ {
2308
                if f := Pow(vfpowSC[i][0], vfpowSC[i][1]); !alike(powSC[i], f) {
2309
                        t.Errorf("Pow(%g, %g) = %g, want %g", vfpowSC[i][0], vfpowSC[i][1], f, powSC[i])
2310
                }
2311
        }
2312
}
2313
 
2314
func TestPow10(t *testing.T) {
2315
        for i := 0; i < len(vfpow10SC); i++ {
2316
                if f := Pow10(vfpow10SC[i]); !alike(pow10SC[i], f) {
2317
                        t.Errorf("Pow10(%d) = %g, want %g", vfpow10SC[i], f, pow10SC[i])
2318
                }
2319
        }
2320
}
2321
 
2322
func TestRemainder(t *testing.T) {
2323
        for i := 0; i < len(vf); i++ {
2324
                if f := Remainder(10, vf[i]); remainder[i] != f {
2325
                        t.Errorf("Remainder(10, %g) = %g, want %g", vf[i], f, remainder[i])
2326
                }
2327
        }
2328
        for i := 0; i < len(vffmodSC); i++ {
2329
                if f := Remainder(vffmodSC[i][0], vffmodSC[i][1]); !alike(fmodSC[i], f) {
2330
                        t.Errorf("Remainder(%g, %g) = %g, want %g", vffmodSC[i][0], vffmodSC[i][1], f, fmodSC[i])
2331
                }
2332
        }
2333
}
2334
 
2335
func TestSignbit(t *testing.T) {
2336
        for i := 0; i < len(vf); i++ {
2337
                if f := Signbit(vf[i]); signbit[i] != f {
2338
                        t.Errorf("Signbit(%g) = %t, want %t", vf[i], f, signbit[i])
2339
                }
2340
        }
2341
        for i := 0; i < len(vfsignbitSC); i++ {
2342
                if f := Signbit(vfsignbitSC[i]); signbitSC[i] != f {
2343
                        t.Errorf("Signbit(%g) = %t, want %t", vfsignbitSC[i], f, signbitSC[i])
2344
                }
2345
        }
2346
}
2347
func TestSin(t *testing.T) {
2348
        for i := 0; i < len(vf); i++ {
2349
                if f := Sin(vf[i]); !veryclose(sin[i], f) {
2350
                        t.Errorf("Sin(%g) = %g, want %g", vf[i], f, sin[i])
2351
                }
2352
        }
2353
        for i := 0; i < len(vfsinSC); i++ {
2354
                if f := Sin(vfsinSC[i]); !alike(sinSC[i], f) {
2355
                        t.Errorf("Sin(%g) = %g, want %g", vfsinSC[i], f, sinSC[i])
2356
                }
2357
        }
2358
}
2359
 
2360
func TestSincos(t *testing.T) {
2361
        for i := 0; i < len(vf); i++ {
2362
                if s, c := Sincos(vf[i]); !veryclose(sin[i], s) || !veryclose(cos[i], c) {
2363
                        t.Errorf("Sincos(%g) = %g, %g want %g, %g", vf[i], s, c, sin[i], cos[i])
2364
                }
2365
        }
2366
}
2367
 
2368
func TestSinh(t *testing.T) {
2369
        for i := 0; i < len(vf); i++ {
2370
                if f := Sinh(vf[i]); !close(sinh[i], f) {
2371
                        t.Errorf("Sinh(%g) = %g, want %g", vf[i], f, sinh[i])
2372
                }
2373
        }
2374
        for i := 0; i < len(vfsinhSC); i++ {
2375
                if f := Sinh(vfsinhSC[i]); !alike(sinhSC[i], f) {
2376
                        t.Errorf("Sinh(%g) = %g, want %g", vfsinhSC[i], f, sinhSC[i])
2377
                }
2378
        }
2379
}
2380
 
2381
func TestSqrt(t *testing.T) {
2382
        for i := 0; i < len(vf); i++ {
2383
                a := Abs(vf[i])
2384
                if f := SqrtGo(a); sqrt[i] != f {
2385
                        t.Errorf("SqrtGo(%g) = %g, want %g", a, f, sqrt[i])
2386
                }
2387
                a = Abs(vf[i])
2388
                if f := Sqrt(a); sqrt[i] != f {
2389
                        t.Errorf("Sqrt(%g) = %g, want %g", a, f, sqrt[i])
2390
                }
2391
        }
2392
        for i := 0; i < len(vfsqrtSC); i++ {
2393
                if f := SqrtGo(vfsqrtSC[i]); !alike(sqrtSC[i], f) {
2394
                        t.Errorf("SqrtGo(%g) = %g, want %g", vfsqrtSC[i], f, sqrtSC[i])
2395
                }
2396
                if f := Sqrt(vfsqrtSC[i]); !alike(sqrtSC[i], f) {
2397
                        t.Errorf("Sqrt(%g) = %g, want %g", vfsqrtSC[i], f, sqrtSC[i])
2398
                }
2399
        }
2400
}
2401
 
2402
func TestTan(t *testing.T) {
2403
        for i := 0; i < len(vf); i++ {
2404
                if f := Tan(vf[i]); !veryclose(tan[i], f) {
2405
                        t.Errorf("Tan(%g) = %g, want %g", vf[i], f, tan[i])
2406
                }
2407
        }
2408
        // same special cases as Sin
2409
        for i := 0; i < len(vfsinSC); i++ {
2410
                if f := Tan(vfsinSC[i]); !alike(sinSC[i], f) {
2411
                        t.Errorf("Tan(%g) = %g, want %g", vfsinSC[i], f, sinSC[i])
2412
                }
2413
        }
2414
}
2415
 
2416
func TestTanh(t *testing.T) {
2417
        for i := 0; i < len(vf); i++ {
2418
                if f := Tanh(vf[i]); !veryclose(tanh[i], f) {
2419
                        t.Errorf("Tanh(%g) = %g, want %g", vf[i], f, tanh[i])
2420
                }
2421
        }
2422
        for i := 0; i < len(vftanhSC); i++ {
2423
                if f := Tanh(vftanhSC[i]); !alike(tanhSC[i], f) {
2424
                        t.Errorf("Tanh(%g) = %g, want %g", vftanhSC[i], f, tanhSC[i])
2425
                }
2426
        }
2427
}
2428
 
2429
func TestTrunc(t *testing.T) {
2430
        for i := 0; i < len(vf); i++ {
2431
                if f := Trunc(vf[i]); trunc[i] != f {
2432
                        t.Errorf("Trunc(%g) = %g, want %g", vf[i], f, trunc[i])
2433
                }
2434
        }
2435
        for i := 0; i < len(vfceilSC); i++ {
2436
                if f := Trunc(vfceilSC[i]); !alike(ceilSC[i], f) {
2437
                        t.Errorf("Trunc(%g) = %g, want %g", vfceilSC[i], f, ceilSC[i])
2438
                }
2439
        }
2440
}
2441
 
2442
func TestY0(t *testing.T) {
2443
        for i := 0; i < len(vf); i++ {
2444
                a := Abs(vf[i])
2445
                if f := Y0(a); !close(y0[i], f) {
2446
                        t.Errorf("Y0(%g) = %g, want %g", a, f, y0[i])
2447
                }
2448
        }
2449
        for i := 0; i < len(vfy0SC); i++ {
2450
                if f := Y0(vfy0SC[i]); !alike(y0SC[i], f) {
2451
                        t.Errorf("Y0(%g) = %g, want %g", vfy0SC[i], f, y0SC[i])
2452
                }
2453
        }
2454
}
2455
 
2456
func TestY1(t *testing.T) {
2457
        for i := 0; i < len(vf); i++ {
2458
                a := Abs(vf[i])
2459
                if f := Y1(a); !soclose(y1[i], f, 2e-14) {
2460
                        t.Errorf("Y1(%g) = %g, want %g", a, f, y1[i])
2461
                }
2462
        }
2463
        for i := 0; i < len(vfy0SC); i++ {
2464
                if f := Y1(vfy0SC[i]); !alike(y1SC[i], f) {
2465
                        t.Errorf("Y1(%g) = %g, want %g", vfy0SC[i], f, y1SC[i])
2466
                }
2467
        }
2468
}
2469
 
2470
func TestYn(t *testing.T) {
2471
        for i := 0; i < len(vf); i++ {
2472
                a := Abs(vf[i])
2473
                if f := Yn(2, a); !close(y2[i], f) {
2474
                        t.Errorf("Yn(2, %g) = %g, want %g", a, f, y2[i])
2475
                }
2476
                if f := Yn(-3, a); !close(yM3[i], f) {
2477
                        t.Errorf("Yn(-3, %g) = %g, want %g", a, f, yM3[i])
2478
                }
2479
        }
2480
        for i := 0; i < len(vfy0SC); i++ {
2481
                if f := Yn(2, vfy0SC[i]); !alike(y2SC[i], f) {
2482
                        t.Errorf("Yn(2, %g) = %g, want %g", vfy0SC[i], f, y2SC[i])
2483
                }
2484
                if f := Yn(-3, vfy0SC[i]); !alike(yM3SC[i], f) {
2485
                        t.Errorf("Yn(-3, %g) = %g, want %g", vfy0SC[i], f, yM3SC[i])
2486
                }
2487
        }
2488
}
2489
 
2490
// Check that math functions of high angle values
2491
// return accurate results. [Since (vf[i] + large) - large != vf[i],
2492
// testing for Trig(vf[i] + large) == Trig(vf[i]), where large is
2493
// a multiple of 2*Pi, is misleading.]
2494
func TestLargeCos(t *testing.T) {
2495
        large := float64(100000 * Pi)
2496
        for i := 0; i < len(vf); i++ {
2497
                f1 := cosLarge[i]
2498
                f2 := Cos(vf[i] + large)
2499
                if !close(f1, f2) {
2500
                        t.Errorf("Cos(%g) = %g, want %g", vf[i]+large, f2, f1)
2501
                }
2502
        }
2503
}
2504
 
2505
func TestLargeSin(t *testing.T) {
2506
        large := float64(100000 * Pi)
2507
        for i := 0; i < len(vf); i++ {
2508
                f1 := sinLarge[i]
2509
                f2 := Sin(vf[i] + large)
2510
                if !close(f1, f2) {
2511
                        t.Errorf("Sin(%g) = %g, want %g", vf[i]+large, f2, f1)
2512
                }
2513
        }
2514
}
2515
 
2516
func TestLargeSincos(t *testing.T) {
2517
        large := float64(100000 * Pi)
2518
        for i := 0; i < len(vf); i++ {
2519
                f1, g1 := sinLarge[i], cosLarge[i]
2520
                f2, g2 := Sincos(vf[i] + large)
2521
                if !close(f1, f2) || !close(g1, g2) {
2522
                        t.Errorf("Sincos(%g) = %g, %g, want %g, %g", vf[i]+large, f2, g2, f1, g1)
2523
                }
2524
        }
2525
}
2526
 
2527
func TestLargeTan(t *testing.T) {
2528
        large := float64(100000 * Pi)
2529
        for i := 0; i < len(vf); i++ {
2530
                f1 := tanLarge[i]
2531
                f2 := Tan(vf[i] + large)
2532
                if !close(f1, f2) {
2533
                        t.Errorf("Tan(%g) = %g, want %g", vf[i]+large, f2, f1)
2534
                }
2535
        }
2536
}
2537
 
2538
// Check that math constants are accepted by compiler
2539
// and have right value (assumes strconv.ParseFloat works).
2540
// http://code.google.com/p/go/issues/detail?id=201
2541
 
2542
type floatTest struct {
2543
        val  interface{}
2544
        name string
2545
        str  string
2546
}
2547
 
2548
var floatTests = []floatTest{
2549
        {float64(MaxFloat64), "MaxFloat64", "1.7976931348623157e+308"},
2550
        {float64(SmallestNonzeroFloat64), "SmallestNonzeroFloat64", "5e-324"},
2551
        {float32(MaxFloat32), "MaxFloat32", "3.4028235e+38"},
2552
        {float32(SmallestNonzeroFloat32), "SmallestNonzeroFloat32", "1e-45"},
2553
}
2554
 
2555
func TestFloatMinMax(t *testing.T) {
2556
        for _, tt := range floatTests {
2557
                s := fmt.Sprint(tt.val)
2558
                if s != tt.str {
2559
                        t.Errorf("Sprint(%v) = %s, want %s", tt.name, s, tt.str)
2560
                }
2561
        }
2562
}
2563
 
2564
// Benchmarks
2565
 
2566
func BenchmarkAcos(b *testing.B) {
2567
        for i := 0; i < b.N; i++ {
2568
                Acos(.5)
2569
        }
2570
}
2571
 
2572
func BenchmarkAcosh(b *testing.B) {
2573
        for i := 0; i < b.N; i++ {
2574
                Acosh(1.5)
2575
        }
2576
}
2577
 
2578
func BenchmarkAsin(b *testing.B) {
2579
        for i := 0; i < b.N; i++ {
2580
                Asin(.5)
2581
        }
2582
}
2583
 
2584
func BenchmarkAsinh(b *testing.B) {
2585
        for i := 0; i < b.N; i++ {
2586
                Asinh(.5)
2587
        }
2588
}
2589
 
2590
func BenchmarkAtan(b *testing.B) {
2591
        for i := 0; i < b.N; i++ {
2592
                Atan(.5)
2593
        }
2594
}
2595
 
2596
func BenchmarkAtanh(b *testing.B) {
2597
        for i := 0; i < b.N; i++ {
2598
                Atanh(.5)
2599
        }
2600
}
2601
 
2602
func BenchmarkAtan2(b *testing.B) {
2603
        for i := 0; i < b.N; i++ {
2604
                Atan2(.5, 1)
2605
        }
2606
}
2607
 
2608
func BenchmarkCbrt(b *testing.B) {
2609
        for i := 0; i < b.N; i++ {
2610
                Cbrt(10)
2611
        }
2612
}
2613
 
2614
func BenchmarkCeil(b *testing.B) {
2615
        for i := 0; i < b.N; i++ {
2616
                Ceil(.5)
2617
        }
2618
}
2619
 
2620
func BenchmarkCopysign(b *testing.B) {
2621
        for i := 0; i < b.N; i++ {
2622
                Copysign(.5, -1)
2623
        }
2624
}
2625
 
2626
func BenchmarkCos(b *testing.B) {
2627
        for i := 0; i < b.N; i++ {
2628
                Cos(.5)
2629
        }
2630
}
2631
 
2632
func BenchmarkCosh(b *testing.B) {
2633
        for i := 0; i < b.N; i++ {
2634
                Cosh(2.5)
2635
        }
2636
}
2637
 
2638
func BenchmarkErf(b *testing.B) {
2639
        for i := 0; i < b.N; i++ {
2640
                Erf(.5)
2641
        }
2642
}
2643
 
2644
func BenchmarkErfc(b *testing.B) {
2645
        for i := 0; i < b.N; i++ {
2646
                Erfc(.5)
2647
        }
2648
}
2649
 
2650
func BenchmarkExp(b *testing.B) {
2651
        for i := 0; i < b.N; i++ {
2652
                Exp(.5)
2653
        }
2654
}
2655
 
2656
func BenchmarkExpGo(b *testing.B) {
2657
        for i := 0; i < b.N; i++ {
2658
                ExpGo(.5)
2659
        }
2660
}
2661
 
2662
func BenchmarkExpm1(b *testing.B) {
2663
        for i := 0; i < b.N; i++ {
2664
                Expm1(.5)
2665
        }
2666
}
2667
 
2668
func BenchmarkExp2(b *testing.B) {
2669
        for i := 0; i < b.N; i++ {
2670
                Exp2(.5)
2671
        }
2672
}
2673
 
2674
func BenchmarkExp2Go(b *testing.B) {
2675
        for i := 0; i < b.N; i++ {
2676
                Exp2Go(.5)
2677
        }
2678
}
2679
 
2680
func BenchmarkAbs(b *testing.B) {
2681
        for i := 0; i < b.N; i++ {
2682
                Abs(.5)
2683
        }
2684
}
2685
 
2686
func BenchmarkDim(b *testing.B) {
2687
        for i := 0; i < b.N; i++ {
2688
                Dim(10, 3)
2689
        }
2690
}
2691
 
2692
func BenchmarkFloor(b *testing.B) {
2693
        for i := 0; i < b.N; i++ {
2694
                Floor(.5)
2695
        }
2696
}
2697
 
2698
func BenchmarkMax(b *testing.B) {
2699
        for i := 0; i < b.N; i++ {
2700
                Max(10, 3)
2701
        }
2702
}
2703
 
2704
func BenchmarkMin(b *testing.B) {
2705
        for i := 0; i < b.N; i++ {
2706
                Min(10, 3)
2707
        }
2708
}
2709
 
2710
func BenchmarkMod(b *testing.B) {
2711
        for i := 0; i < b.N; i++ {
2712
                Mod(10, 3)
2713
        }
2714
}
2715
 
2716
func BenchmarkFrexp(b *testing.B) {
2717
        for i := 0; i < b.N; i++ {
2718
                Frexp(8)
2719
        }
2720
}
2721
 
2722
func BenchmarkGamma(b *testing.B) {
2723
        for i := 0; i < b.N; i++ {
2724
                Gamma(2.5)
2725
        }
2726
}
2727
 
2728
func BenchmarkHypot(b *testing.B) {
2729
        for i := 0; i < b.N; i++ {
2730
                Hypot(3, 4)
2731
        }
2732
}
2733
 
2734
func BenchmarkHypotGo(b *testing.B) {
2735
        for i := 0; i < b.N; i++ {
2736
                HypotGo(3, 4)
2737
        }
2738
}
2739
 
2740
func BenchmarkIlogb(b *testing.B) {
2741
        for i := 0; i < b.N; i++ {
2742
                Ilogb(.5)
2743
        }
2744
}
2745
 
2746
func BenchmarkJ0(b *testing.B) {
2747
        for i := 0; i < b.N; i++ {
2748
                J0(2.5)
2749
        }
2750
}
2751
 
2752
func BenchmarkJ1(b *testing.B) {
2753
        for i := 0; i < b.N; i++ {
2754
                J1(2.5)
2755
        }
2756
}
2757
 
2758
func BenchmarkJn(b *testing.B) {
2759
        for i := 0; i < b.N; i++ {
2760
                Jn(2, 2.5)
2761
        }
2762
}
2763
 
2764
func BenchmarkLdexp(b *testing.B) {
2765
        for i := 0; i < b.N; i++ {
2766
                Ldexp(.5, 2)
2767
        }
2768
}
2769
 
2770
func BenchmarkLgamma(b *testing.B) {
2771
        for i := 0; i < b.N; i++ {
2772
                Lgamma(2.5)
2773
        }
2774
}
2775
 
2776
func BenchmarkLog(b *testing.B) {
2777
        for i := 0; i < b.N; i++ {
2778
                Log(.5)
2779
        }
2780
}
2781
 
2782
func BenchmarkLogb(b *testing.B) {
2783
        for i := 0; i < b.N; i++ {
2784
                Logb(.5)
2785
        }
2786
}
2787
 
2788
func BenchmarkLog1p(b *testing.B) {
2789
        for i := 0; i < b.N; i++ {
2790
                Log1p(.5)
2791
        }
2792
}
2793
 
2794
func BenchmarkLog10(b *testing.B) {
2795
        for i := 0; i < b.N; i++ {
2796
                Log10(.5)
2797
        }
2798
}
2799
 
2800
func BenchmarkLog2(b *testing.B) {
2801
        for i := 0; i < b.N; i++ {
2802
                Log2(.5)
2803
        }
2804
}
2805
 
2806
func BenchmarkModf(b *testing.B) {
2807
        for i := 0; i < b.N; i++ {
2808
                Modf(1.5)
2809
        }
2810
}
2811
 
2812
func BenchmarkNextafter(b *testing.B) {
2813
        for i := 0; i < b.N; i++ {
2814
                Nextafter(.5, 1)
2815
        }
2816
}
2817
 
2818
func BenchmarkPowInt(b *testing.B) {
2819
        for i := 0; i < b.N; i++ {
2820
                Pow(2, 2)
2821
        }
2822
}
2823
 
2824
func BenchmarkPowFrac(b *testing.B) {
2825
        for i := 0; i < b.N; i++ {
2826
                Pow(2.5, 1.5)
2827
        }
2828
}
2829
 
2830
func BenchmarkPow10Pos(b *testing.B) {
2831
        for i := 0; i < b.N; i++ {
2832
                Pow10(300)
2833
        }
2834
}
2835
 
2836
func BenchmarkPow10Neg(b *testing.B) {
2837
        for i := 0; i < b.N; i++ {
2838
                Pow10(-300)
2839
        }
2840
}
2841
 
2842
func BenchmarkRemainder(b *testing.B) {
2843
        for i := 0; i < b.N; i++ {
2844
                Remainder(10, 3)
2845
        }
2846
}
2847
 
2848
func BenchmarkSignbit(b *testing.B) {
2849
        for i := 0; i < b.N; i++ {
2850
                Signbit(2.5)
2851
        }
2852
}
2853
 
2854
func BenchmarkSin(b *testing.B) {
2855
        for i := 0; i < b.N; i++ {
2856
                Sin(.5)
2857
        }
2858
}
2859
 
2860
func BenchmarkSincos(b *testing.B) {
2861
        for i := 0; i < b.N; i++ {
2862
                Sincos(.5)
2863
        }
2864
}
2865
 
2866
func BenchmarkSinh(b *testing.B) {
2867
        for i := 0; i < b.N; i++ {
2868
                Sinh(2.5)
2869
        }
2870
}
2871
 
2872
func BenchmarkSqrt(b *testing.B) {
2873
        for i := 0; i < b.N; i++ {
2874
                Sqrt(10)
2875
        }
2876
}
2877
 
2878
func BenchmarkSqrtGo(b *testing.B) {
2879
        for i := 0; i < b.N; i++ {
2880
                SqrtGo(10)
2881
        }
2882
}
2883
 
2884
func BenchmarkTan(b *testing.B) {
2885
        for i := 0; i < b.N; i++ {
2886
                Tan(.5)
2887
        }
2888
}
2889
 
2890
func BenchmarkTanh(b *testing.B) {
2891
        for i := 0; i < b.N; i++ {
2892
                Tanh(2.5)
2893
        }
2894
}
2895
func BenchmarkTrunc(b *testing.B) {
2896
        for i := 0; i < b.N; i++ {
2897
                Trunc(.5)
2898
        }
2899
}
2900
 
2901
func BenchmarkY0(b *testing.B) {
2902
        for i := 0; i < b.N; i++ {
2903
                Y0(2.5)
2904
        }
2905
}
2906
 
2907
func BenchmarkY1(b *testing.B) {
2908
        for i := 0; i < b.N; i++ {
2909
                Y1(2.5)
2910
        }
2911
}
2912
 
2913
func BenchmarkYn(b *testing.B) {
2914
        for i := 0; i < b.N; i++ {
2915
                Yn(2, 2.5)
2916
        }
2917
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.