github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/stdlibs/math/all_test.gno (about)

     1  // Copyright 2009 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package math_test
     6  
     7  import (
     8  	"fmt"
     9  	"math"
    10  	"testing"
    11  )
    12  
    13  // XXX: The dot import for "math" is replaced to a normal import.
    14  // As such, all calls to export math functions are prefixed with math (as opposed
    15  // to the original all_test.gno).
    16  
    17  var vf = []float64{
    18  	4.9790119248836735e+00,
    19  	7.7388724745781045e+00,
    20  	-2.7688005719200159e-01,
    21  	-5.0106036182710749e+00,
    22  	9.6362937071984173e+00,
    23  	2.9263772392439646e+00,
    24  	5.2290834314593066e+00,
    25  	2.7279399104360102e+00,
    26  	1.8253080916808550e+00,
    27  	-8.6859247685756013e+00,
    28  }
    29  
    30  // The expected results below were computed by the high precision calculators
    31  // at https://keisan.casio.com/.  More exact input values (array vf[], above)
    32  // were obtained by printing them with "%.26f".  The answers were calculated
    33  // to 26 digits (by using the "Digit number" drop-down control of each
    34  // calculator).
    35  var acos = []float64{
    36  	1.0496193546107222142571536e+00,
    37  	6.8584012813664425171660692e-01,
    38  	1.5984878714577160325521819e+00,
    39  	2.0956199361475859327461799e+00,
    40  	2.7053008467824138592616927e-01,
    41  	1.2738121680361776018155625e+00,
    42  	1.0205369421140629186287407e+00,
    43  	1.2945003481781246062157835e+00,
    44  	1.3872364345374451433846657e+00,
    45  	2.6231510803970463967294145e+00,
    46  }
    47  
    48  var acosh = []float64{
    49  	2.4743347004159012494457618e+00,
    50  	2.8576385344292769649802701e+00,
    51  	7.2796961502981066190593175e-01,
    52  	2.4796794418831451156471977e+00,
    53  	3.0552020742306061857212962e+00,
    54  	2.044238592688586588942468e+00,
    55  	2.5158701513104513595766636e+00,
    56  	1.99050839282411638174299e+00,
    57  	1.6988625798424034227205445e+00,
    58  	2.9611454842470387925531875e+00,
    59  }
    60  
    61  var asin = []float64{
    62  	5.2117697218417440497416805e-01,
    63  	8.8495619865825236751471477e-01,
    64  	-02.769154466281941332086016e-02,
    65  	-5.2482360935268931351485822e-01,
    66  	1.3002662421166552333051524e+00,
    67  	2.9698415875871901741575922e-01,
    68  	5.5025938468083370060258102e-01,
    69  	2.7629597861677201301553823e-01,
    70  	1.83559892257451475846656e-01,
    71  	-1.0523547536021497774980928e+00,
    72  }
    73  
    74  var asinh = []float64{
    75  	2.3083139124923523427628243e+00,
    76  	2.743551594301593620039021e+00,
    77  	-2.7345908534880091229413487e-01,
    78  	-2.3145157644718338650499085e+00,
    79  	2.9613652154015058521951083e+00,
    80  	1.7949041616585821933067568e+00,
    81  	2.3564032905983506405561554e+00,
    82  	1.7287118790768438878045346e+00,
    83  	1.3626658083714826013073193e+00,
    84  	-2.8581483626513914445234004e+00,
    85  }
    86  
    87  var atan = []float64{
    88  	1.372590262129621651920085e+00,
    89  	1.442290609645298083020664e+00,
    90  	-2.7011324359471758245192595e-01,
    91  	-1.3738077684543379452781531e+00,
    92  	1.4673921193587666049154681e+00,
    93  	1.2415173565870168649117764e+00,
    94  	1.3818396865615168979966498e+00,
    95  	1.2194305844639670701091426e+00,
    96  	1.0696031952318783760193244e+00,
    97  	-1.4561721938838084990898679e+00,
    98  }
    99  
   100  var atanh = []float64{
   101  	5.4651163712251938116878204e-01,
   102  	1.0299474112843111224914709e+00,
   103  	-2.7695084420740135145234906e-02,
   104  	-5.5072096119207195480202529e-01,
   105  	1.9943940993171843235906642e+00,
   106  	3.01448604578089708203017e-01,
   107  	5.8033427206942188834370595e-01,
   108  	2.7987997499441511013958297e-01,
   109  	1.8459947964298794318714228e-01,
   110  	-1.3273186910532645867272502e+00,
   111  }
   112  
   113  var atan2 = []float64{
   114  	1.1088291730037004444527075e+00,
   115  	9.1218183188715804018797795e-01,
   116  	1.5984772603216203736068915e+00,
   117  	2.0352918654092086637227327e+00,
   118  	8.0391819139044720267356014e-01,
   119  	1.2861075249894661588866752e+00,
   120  	1.0889904479131695712182587e+00,
   121  	1.3044821793397925293797357e+00,
   122  	1.3902530903455392306872261e+00,
   123  	2.2859857424479142655411058e+00,
   124  }
   125  
   126  var cbrt = []float64{
   127  	1.7075799841925094446722675e+00,
   128  	1.9779982212970353936691498e+00,
   129  	-6.5177429017779910853339447e-01,
   130  	-1.7111838886544019873338113e+00,
   131  	2.1279920909827937423960472e+00,
   132  	1.4303536770460741452312367e+00,
   133  	1.7357021059106154902341052e+00,
   134  	1.3972633462554328350552916e+00,
   135  	1.2221149580905388454977636e+00,
   136  	-2.0556003730500069110343596e+00,
   137  }
   138  
   139  var ceil = []float64{
   140  	5.0000000000000000e+00,
   141  	8.0000000000000000e+00,
   142  	math.Copysign(0, -1),
   143  	-5.0000000000000000e+00,
   144  	1.0000000000000000e+01,
   145  	3.0000000000000000e+00,
   146  	6.0000000000000000e+00,
   147  	3.0000000000000000e+00,
   148  	2.0000000000000000e+00,
   149  	-8.0000000000000000e+00,
   150  }
   151  
   152  var copysign = []float64{
   153  	-4.9790119248836735e+00,
   154  	-7.7388724745781045e+00,
   155  	-2.7688005719200159e-01,
   156  	-5.0106036182710749e+00,
   157  	-9.6362937071984173e+00,
   158  	-2.9263772392439646e+00,
   159  	-5.2290834314593066e+00,
   160  	-2.7279399104360102e+00,
   161  	-1.8253080916808550e+00,
   162  	-8.6859247685756013e+00,
   163  }
   164  
   165  var cos = []float64{
   166  	2.634752140995199110787593e-01,
   167  	1.148551260848219865642039e-01,
   168  	9.6191297325640768154550453e-01,
   169  	2.938141150061714816890637e-01,
   170  	-9.777138189897924126294461e-01,
   171  	-9.7693041344303219127199518e-01,
   172  	4.940088096948647263961162e-01,
   173  	-9.1565869021018925545016502e-01,
   174  	-2.517729313893103197176091e-01,
   175  	-7.39241351595676573201918e-01,
   176  }
   177  
   178  // Results for 100000 * math.Pi + vf[i]
   179  var cosLarge = []float64{
   180  	2.634752141185559426744e-01,
   181  	1.14855126055543100712e-01,
   182  	9.61912973266488928113e-01,
   183  	2.9381411499556122552e-01,
   184  	-9.777138189880161924641e-01,
   185  	-9.76930413445147608049e-01,
   186  	4.940088097314976789841e-01,
   187  	-9.15658690217517835002e-01,
   188  	-2.51772931436786954751e-01,
   189  	-7.3924135157173099849e-01,
   190  }
   191  
   192  var cosh = []float64{
   193  	7.2668796942212842775517446e+01,
   194  	1.1479413465659254502011135e+03,
   195  	1.0385767908766418550935495e+00,
   196  	7.5000957789658051428857788e+01,
   197  	7.655246669605357888468613e+03,
   198  	9.3567491758321272072888257e+00,
   199  	9.331351599270605471131735e+01,
   200  	7.6833430994624643209296404e+00,
   201  	3.1829371625150718153881164e+00,
   202  	2.9595059261916188501640911e+03,
   203  }
   204  
   205  var erf = []float64{
   206  	5.1865354817738701906913566e-01,
   207  	7.2623875834137295116929844e-01,
   208  	-3.123458688281309990629839e-02,
   209  	-5.2143121110253302920437013e-01,
   210  	8.2704742671312902508629582e-01,
   211  	3.2101767558376376743993945e-01,
   212  	5.403990312223245516066252e-01,
   213  	3.0034702916738588551174831e-01,
   214  	2.0369924417882241241559589e-01,
   215  	-7.8069386968009226729944677e-01,
   216  }
   217  
   218  var erfc = []float64{
   219  	4.8134645182261298093086434e-01,
   220  	2.7376124165862704883070156e-01,
   221  	1.0312345868828130999062984e+00,
   222  	1.5214312111025330292043701e+00,
   223  	1.7295257328687097491370418e-01,
   224  	6.7898232441623623256006055e-01,
   225  	4.596009687776754483933748e-01,
   226  	6.9965297083261411448825169e-01,
   227  	7.9630075582117758758440411e-01,
   228  	1.7806938696800922672994468e+00,
   229  }
   230  
   231  var erfinv = []float64{
   232  	4.746037673358033586786350696e-01,
   233  	8.559054432692110956388764172e-01,
   234  	-2.45427830571707336251331946e-02,
   235  	-4.78116683518973366268905506e-01,
   236  	1.479804430319470983648120853e+00,
   237  	2.654485787128896161882650211e-01,
   238  	5.027444534221520197823192493e-01,
   239  	2.466703532707627818954585670e-01,
   240  	1.632011465103005426240343116e-01,
   241  	-1.06672334642196900710000389e+00,
   242  }
   243  
   244  var exp = []float64{
   245  	1.4533071302642137507696589e+02,
   246  	2.2958822575694449002537581e+03,
   247  	7.5814542574851666582042306e-01,
   248  	6.6668778421791005061482264e-03,
   249  	1.5310493273896033740861206e+04,
   250  	1.8659907517999328638667732e+01,
   251  	1.8662167355098714543942057e+02,
   252  	1.5301332413189378961665788e+01,
   253  	6.2047063430646876349125085e+00,
   254  	1.6894712385826521111610438e-04,
   255  }
   256  
   257  var expm1 = []float64{
   258  	5.105047796122957327384770212e-02,
   259  	8.046199708567344080562675439e-02,
   260  	-2.764970978891639815187418703e-03,
   261  	-4.8871434888875355394330300273e-02,
   262  	1.0115864277221467777117227494e-01,
   263  	2.969616407795910726014621657e-02,
   264  	5.368214487944892300914037972e-02,
   265  	2.765488851131274068067445335e-02,
   266  	1.842068661871398836913874273e-02,
   267  	-8.3193870863553801814961137573e-02,
   268  }
   269  
   270  var expm1Large = []float64{
   271  	4.2031418113550844e+21,
   272  	4.0690789717473863e+33,
   273  	-0.9372627915981363e+00,
   274  	-1.0,
   275  	7.077694784145933e+41,
   276  	5.117936223839153e+12,
   277  	5.124137759001189e+22,
   278  	7.03546003972584e+11,
   279  	8.456921800389698e+07,
   280  	-1.0,
   281  }
   282  
   283  var exp2 = []float64{
   284  	3.1537839463286288034313104e+01,
   285  	2.1361549283756232296144849e+02,
   286  	8.2537402562185562902577219e-01,
   287  	3.1021158628740294833424229e-02,
   288  	7.9581744110252191462569661e+02,
   289  	7.6019905892596359262696423e+00,
   290  	3.7506882048388096973183084e+01,
   291  	6.6250893439173561733216375e+00,
   292  	3.5438267900243941544605339e+00,
   293  	2.4281533133513300984289196e-03,
   294  }
   295  
   296  var fabs = []float64{
   297  	4.9790119248836735e+00,
   298  	7.7388724745781045e+00,
   299  	2.7688005719200159e-01,
   300  	5.0106036182710749e+00,
   301  	9.6362937071984173e+00,
   302  	2.9263772392439646e+00,
   303  	5.2290834314593066e+00,
   304  	2.7279399104360102e+00,
   305  	1.8253080916808550e+00,
   306  	8.6859247685756013e+00,
   307  }
   308  
   309  var fdim = []float64{
   310  	4.9790119248836735e+00,
   311  	7.7388724745781045e+00,
   312  	0.0000000000000000e+00,
   313  	0.0000000000000000e+00,
   314  	9.6362937071984173e+00,
   315  	2.9263772392439646e+00,
   316  	5.2290834314593066e+00,
   317  	2.7279399104360102e+00,
   318  	1.8253080916808550e+00,
   319  	0.0000000000000000e+00,
   320  }
   321  
   322  var floor = []float64{
   323  	4.0000000000000000e+00,
   324  	7.0000000000000000e+00,
   325  	-1.0000000000000000e+00,
   326  	-6.0000000000000000e+00,
   327  	9.0000000000000000e+00,
   328  	2.0000000000000000e+00,
   329  	5.0000000000000000e+00,
   330  	2.0000000000000000e+00,
   331  	1.0000000000000000e+00,
   332  	-9.0000000000000000e+00,
   333  }
   334  
   335  var fmod = []float64{
   336  	4.197615023265299782906368e-02,
   337  	2.261127525421895434476482e+00,
   338  	3.231794108794261433104108e-02,
   339  	4.989396381728925078391512e+00,
   340  	3.637062928015826201999516e-01,
   341  	1.220868282268106064236690e+00,
   342  	4.770916568540693347699744e+00,
   343  	1.816180268691969246219742e+00,
   344  	8.734595415957246977711748e-01,
   345  	1.314075231424398637614104e+00,
   346  }
   347  
   348  type fi struct {
   349  	f float64
   350  	i int
   351  }
   352  
   353  var frexp = []fi{
   354  	{6.2237649061045918750e-01, 3},
   355  	{9.6735905932226306250e-01, 3},
   356  	{-5.5376011438400318000e-01, -1},
   357  	{-6.2632545228388436250e-01, 3},
   358  	{6.02268356699901081250e-01, 4},
   359  	{7.3159430981099115000e-01, 2},
   360  	{6.5363542893241332500e-01, 3},
   361  	{6.8198497760900255000e-01, 2},
   362  	{9.1265404584042750000e-01, 1},
   363  	{-5.4287029803597508250e-01, 4},
   364  }
   365  
   366  var gamma = []float64{
   367  	2.3254348370739963835386613898e+01,
   368  	2.991153837155317076427529816e+03,
   369  	-4.561154336726758060575129109e+00,
   370  	7.719403468842639065959210984e-01,
   371  	1.6111876618855418534325755566e+05,
   372  	1.8706575145216421164173224946e+00,
   373  	3.4082787447257502836734201635e+01,
   374  	1.579733951448952054898583387e+00,
   375  	9.3834586598354592860187267089e-01,
   376  	-2.093995902923148389186189429e-05,
   377  }
   378  
   379  var j0 = []float64{
   380  	-1.8444682230601672018219338e-01,
   381  	2.27353668906331975435892e-01,
   382  	9.809259936157051116270273e-01,
   383  	-1.741170131426226587841181e-01,
   384  	-2.1389448451144143352039069e-01,
   385  	-2.340905848928038763337414e-01,
   386  	-1.0029099691890912094586326e-01,
   387  	-1.5466726714884328135358907e-01,
   388  	3.252650187653420388714693e-01,
   389  	-8.72218484409407250005360235e-03,
   390  }
   391  
   392  var j1 = []float64{
   393  	-3.251526395295203422162967e-01,
   394  	1.893581711430515718062564e-01,
   395  	-1.3711761352467242914491514e-01,
   396  	3.287486536269617297529617e-01,
   397  	1.3133899188830978473849215e-01,
   398  	3.660243417832986825301766e-01,
   399  	-3.4436769271848174665420672e-01,
   400  	4.329481396640773768835036e-01,
   401  	5.8181350531954794639333955e-01,
   402  	-2.7030574577733036112996607e-01,
   403  }
   404  
   405  var j2 = []float64{
   406  	5.3837518920137802565192769e-02,
   407  	-1.7841678003393207281244667e-01,
   408  	9.521746934916464142495821e-03,
   409  	4.28958355470987397983072e-02,
   410  	2.4115371837854494725492872e-01,
   411  	4.842458532394520316844449e-01,
   412  	-3.142145220618633390125946e-02,
   413  	4.720849184745124761189957e-01,
   414  	3.122312022520957042957497e-01,
   415  	7.096213118930231185707277e-02,
   416  }
   417  
   418  var jM3 = []float64{
   419  	-3.684042080996403091021151e-01,
   420  	2.8157665936340887268092661e-01,
   421  	4.401005480841948348343589e-04,
   422  	3.629926999056814081597135e-01,
   423  	3.123672198825455192489266e-02,
   424  	-2.958805510589623607540455e-01,
   425  	-3.2033177696533233403289416e-01,
   426  	-2.592737332129663376736604e-01,
   427  	-1.0241334641061485092351251e-01,
   428  	-2.3762660886100206491674503e-01,
   429  }
   430  
   431  var lgamma = []fi{
   432  	{3.146492141244545774319734e+00, 1},
   433  	{8.003414490659126375852113e+00, 1},
   434  	{1.517575735509779707488106e+00, -1},
   435  	{-2.588480028182145853558748e-01, 1},
   436  	{1.1989897050205555002007985e+01, 1},
   437  	{6.262899811091257519386906e-01, 1},
   438  	{3.5287924899091566764846037e+00, 1},
   439  	{4.5725644770161182299423372e-01, 1},
   440  	{-6.363667087767961257654854e-02, 1},
   441  	{-1.077385130910300066425564e+01, -1},
   442  }
   443  
   444  var log = []float64{
   445  	1.605231462693062999102599e+00,
   446  	2.0462560018708770653153909e+00,
   447  	-1.2841708730962657801275038e+00,
   448  	1.6115563905281545116286206e+00,
   449  	2.2655365644872016636317461e+00,
   450  	1.0737652208918379856272735e+00,
   451  	1.6542360106073546632707956e+00,
   452  	1.0035467127723465801264487e+00,
   453  	6.0174879014578057187016475e-01,
   454  	2.161703872847352815363655e+00,
   455  }
   456  
   457  var logb = []float64{
   458  	2.0000000000000000e+00,
   459  	2.0000000000000000e+00,
   460  	-2.0000000000000000e+00,
   461  	2.0000000000000000e+00,
   462  	3.0000000000000000e+00,
   463  	1.0000000000000000e+00,
   464  	2.0000000000000000e+00,
   465  	1.0000000000000000e+00,
   466  	0.0000000000000000e+00,
   467  	3.0000000000000000e+00,
   468  }
   469  
   470  var log10 = []float64{
   471  	6.9714316642508290997617083e-01,
   472  	8.886776901739320576279124e-01,
   473  	-5.5770832400658929815908236e-01,
   474  	6.998900476822994346229723e-01,
   475  	9.8391002850684232013281033e-01,
   476  	4.6633031029295153334285302e-01,
   477  	7.1842557117242328821552533e-01,
   478  	4.3583479968917773161304553e-01,
   479  	2.6133617905227038228626834e-01,
   480  	9.3881606348649405716214241e-01,
   481  }
   482  
   483  var log1p = []float64{
   484  	4.8590257759797794104158205e-02,
   485  	7.4540265965225865330849141e-02,
   486  	-2.7726407903942672823234024e-03,
   487  	-5.1404917651627649094953380e-02,
   488  	9.1998280672258624681335010e-02,
   489  	2.8843762576593352865894824e-02,
   490  	5.0969534581863707268992645e-02,
   491  	2.6913947602193238458458594e-02,
   492  	1.8088493239630770262045333e-02,
   493  	-9.0865245631588989681559268e-02,
   494  }
   495  
   496  var log2 = []float64{
   497  	2.3158594707062190618898251e+00,
   498  	2.9521233862883917703341018e+00,
   499  	-1.8526669502700329984917062e+00,
   500  	2.3249844127278861543568029e+00,
   501  	3.268478366538305087466309e+00,
   502  	1.5491157592596970278166492e+00,
   503  	2.3865580889631732407886495e+00,
   504  	1.447811865817085365540347e+00,
   505  	8.6813999540425116282815557e-01,
   506  	3.118679457227342224364709e+00,
   507  }
   508  
   509  var modf = [][2]float64{
   510  	{4.0000000000000000e+00, 9.7901192488367350108546816e-01},
   511  	{7.0000000000000000e+00, 7.3887247457810456552351752e-01},
   512  	{math.Copysign(0, -1), -2.7688005719200159404635997e-01},
   513  	{-5.0000000000000000e+00, -1.060361827107492160848778e-02},
   514  	{9.0000000000000000e+00, 6.3629370719841737980004837e-01},
   515  	{2.0000000000000000e+00, 9.2637723924396464525443662e-01},
   516  	{5.0000000000000000e+00, 2.2908343145930665230025625e-01},
   517  	{2.0000000000000000e+00, 7.2793991043601025126008608e-01},
   518  	{1.0000000000000000e+00, 8.2530809168085506044576505e-01},
   519  	{-8.0000000000000000e+00, -6.8592476857560136238589621e-01},
   520  }
   521  
   522  var nextafter32 = []float32{
   523  	4.979012489318848e+00,
   524  	7.738873004913330e+00,
   525  	-2.768800258636475e-01,
   526  	-5.010602951049805e+00,
   527  	9.636294364929199e+00,
   528  	2.926377534866333e+00,
   529  	5.229084014892578e+00,
   530  	2.727940082550049e+00,
   531  	1.825308203697205e+00,
   532  	-8.685923576354980e+00,
   533  }
   534  
   535  var nextafter64 = []float64{
   536  	4.97901192488367438926388786e+00,
   537  	7.73887247457810545370193722e+00,
   538  	-2.7688005719200153853520874e-01,
   539  	-5.01060361827107403343006808e+00,
   540  	9.63629370719841915615688777e+00,
   541  	2.92637723924396508934364647e+00,
   542  	5.22908343145930754047867595e+00,
   543  	2.72793991043601069534929593e+00,
   544  	1.82530809168085528249036997e+00,
   545  	-8.68592476857559958602905681e+00,
   546  }
   547  
   548  var pow = []float64{
   549  	9.5282232631648411840742957e+04,
   550  	5.4811599352999901232411871e+07,
   551  	5.2859121715894396531132279e-01,
   552  	9.7587991957286474464259698e-06,
   553  	4.328064329346044846740467e+09,
   554  	8.4406761805034547437659092e+02,
   555  	1.6946633276191194947742146e+05,
   556  	5.3449040147551939075312879e+02,
   557  	6.688182138451414936380374e+01,
   558  	2.0609869004248742886827439e-09,
   559  }
   560  
   561  var remainder = []float64{
   562  	4.197615023265299782906368e-02,
   563  	2.261127525421895434476482e+00,
   564  	3.231794108794261433104108e-02,
   565  	-2.120723654214984321697556e-02,
   566  	3.637062928015826201999516e-01,
   567  	1.220868282268106064236690e+00,
   568  	-4.581668629186133046005125e-01,
   569  	-9.117596417440410050403443e-01,
   570  	8.734595415957246977711748e-01,
   571  	1.314075231424398637614104e+00,
   572  }
   573  
   574  var round = []float64{
   575  	5,
   576  	8,
   577  	math.Copysign(0, -1),
   578  	-5,
   579  	10,
   580  	3,
   581  	5,
   582  	3,
   583  	2,
   584  	-9,
   585  }
   586  
   587  var signbit = []bool{
   588  	false,
   589  	false,
   590  	true,
   591  	true,
   592  	false,
   593  	false,
   594  	false,
   595  	false,
   596  	false,
   597  	true,
   598  }
   599  
   600  var sin = []float64{
   601  	-9.6466616586009283766724726e-01,
   602  	9.9338225271646545763467022e-01,
   603  	-2.7335587039794393342449301e-01,
   604  	9.5586257685042792878173752e-01,
   605  	-2.099421066779969164496634e-01,
   606  	2.135578780799860532750616e-01,
   607  	-8.694568971167362743327708e-01,
   608  	4.019566681155577786649878e-01,
   609  	9.6778633541687993721617774e-01,
   610  	-6.734405869050344734943028e-01,
   611  }
   612  
   613  // Results for 100000 * math.Pi + vf[i]
   614  var sinLarge = []float64{
   615  	-9.646661658548936063912e-01,
   616  	9.933822527198506903752e-01,
   617  	-2.7335587036246899796e-01,
   618  	9.55862576853689321268e-01,
   619  	-2.099421066862688873691e-01,
   620  	2.13557878070308981163e-01,
   621  	-8.694568970959221300497e-01,
   622  	4.01956668098863248917e-01,
   623  	9.67786335404528727927e-01,
   624  	-6.7344058693131973066e-01,
   625  }
   626  
   627  var sinh = []float64{
   628  	7.2661916084208532301448439e+01,
   629  	1.1479409110035194500526446e+03,
   630  	-2.8043136512812518927312641e-01,
   631  	-7.499429091181587232835164e+01,
   632  	7.6552466042906758523925934e+03,
   633  	9.3031583421672014313789064e+00,
   634  	9.330815755828109072810322e+01,
   635  	7.6179893137269146407361477e+00,
   636  	3.021769180549615819524392e+00,
   637  	-2.95950575724449499189888e+03,
   638  }
   639  
   640  var sqrt = []float64{
   641  	2.2313699659365484748756904e+00,
   642  	2.7818829009464263511285458e+00,
   643  	5.2619393496314796848143251e-01,
   644  	2.2384377628763938724244104e+00,
   645  	3.1042380236055381099288487e+00,
   646  	1.7106657298385224403917771e+00,
   647  	2.286718922705479046148059e+00,
   648  	1.6516476350711159636222979e+00,
   649  	1.3510396336454586262419247e+00,
   650  	2.9471892997524949215723329e+00,
   651  }
   652  
   653  var tan = []float64{
   654  	-3.661316565040227801781974e+00,
   655  	8.64900232648597589369854e+00,
   656  	-2.8417941955033612725238097e-01,
   657  	3.253290185974728640827156e+00,
   658  	2.147275640380293804770778e-01,
   659  	-2.18600910711067004921551e-01,
   660  	-1.760002817872367935518928e+00,
   661  	-4.389808914752818126249079e-01,
   662  	-3.843885560201130679995041e+00,
   663  	9.10988793377685105753416e-01,
   664  }
   665  
   666  // Results for 100000 * math.Pi + vf[i]
   667  var tanLarge = []float64{
   668  	-3.66131656475596512705e+00,
   669  	8.6490023287202547927e+00,
   670  	-2.841794195104782406e-01,
   671  	3.2532901861033120983e+00,
   672  	2.14727564046880001365e-01,
   673  	-2.18600910700688062874e-01,
   674  	-1.760002817699722747043e+00,
   675  	-4.38980891453536115952e-01,
   676  	-3.84388555942723509071e+00,
   677  	9.1098879344275101051e-01,
   678  }
   679  
   680  var tanh = []float64{
   681  	9.9990531206936338549262119e-01,
   682  	9.9999962057085294197613294e-01,
   683  	-2.7001505097318677233756845e-01,
   684  	-9.9991110943061718603541401e-01,
   685  	9.9999999146798465745022007e-01,
   686  	9.9427249436125236705001048e-01,
   687  	9.9994257600983138572705076e-01,
   688  	9.9149409509772875982054701e-01,
   689  	9.4936501296239685514466577e-01,
   690  	-9.9999994291374030946055701e-01,
   691  }
   692  
   693  var trunc = []float64{
   694  	4.0000000000000000e+00,
   695  	7.0000000000000000e+00,
   696  	math.Copysign(0, -1),
   697  	-5.0000000000000000e+00,
   698  	9.0000000000000000e+00,
   699  	2.0000000000000000e+00,
   700  	5.0000000000000000e+00,
   701  	2.0000000000000000e+00,
   702  	1.0000000000000000e+00,
   703  	-8.0000000000000000e+00,
   704  }
   705  
   706  var y0 = []float64{
   707  	-3.053399153780788357534855e-01,
   708  	1.7437227649515231515503649e-01,
   709  	-8.6221781263678836910392572e-01,
   710  	-3.100664880987498407872839e-01,
   711  	1.422200649300982280645377e-01,
   712  	4.000004067997901144239363e-01,
   713  	-3.3340749753099352392332536e-01,
   714  	4.5399790746668954555205502e-01,
   715  	4.8290004112497761007536522e-01,
   716  	2.7036697826604756229601611e-01,
   717  }
   718  
   719  var y1 = []float64{
   720  	0.15494213737457922210218611,
   721  	-0.2165955142081145245075746,
   722  	-2.4644949631241895201032829,
   723  	0.1442740489541836405154505,
   724  	0.2215379960518984777080163,
   725  	0.3038800915160754150565448,
   726  	0.0691107642452362383808547,
   727  	0.2380116417809914424860165,
   728  	-0.20849492979459761009678934,
   729  	0.0242503179793232308250804,
   730  }
   731  
   732  var y2 = []float64{
   733  	0.3675780219390303613394936,
   734  	-0.23034826393250119879267257,
   735  	-16.939677983817727205631397,
   736  	0.367653980523052152867791,
   737  	-0.0962401471767804440353136,
   738  	-0.1923169356184851105200523,
   739  	0.35984072054267882391843766,
   740  	-0.2794987252299739821654982,
   741  	-0.7113490692587462579757954,
   742  	-0.2647831587821263302087457,
   743  }
   744  
   745  var yM3 = []float64{
   746  	-0.14035984421094849100895341,
   747  	-0.097535139617792072703973,
   748  	242.25775994555580176377379,
   749  	-0.1492267014802818619511046,
   750  	0.26148702629155918694500469,
   751  	0.56675383593895176530394248,
   752  	-0.206150264009006981070575,
   753  	0.64784284687568332737963658,
   754  	1.3503631555901938037008443,
   755  	0.1461869756579956803341844,
   756  }
   757  
   758  // arguments and expected results for special cases
   759  var vfacosSC = []float64{
   760  	-math.Pi,
   761  	1,
   762  	math.Pi,
   763  	math.NaN(),
   764  }
   765  
   766  var acosSC = []float64{
   767  	math.NaN(),
   768  	0,
   769  	math.NaN(),
   770  	math.NaN(),
   771  }
   772  
   773  var vfacoshSC = []float64{
   774  	math.Inf(-1),
   775  	0.5,
   776  	1,
   777  	math.Inf(1),
   778  	math.NaN(),
   779  }
   780  
   781  var acoshSC = []float64{
   782  	math.NaN(),
   783  	math.NaN(),
   784  	0,
   785  	math.Inf(1),
   786  	math.NaN(),
   787  }
   788  
   789  var vfasinSC = []float64{
   790  	-math.Pi,
   791  	math.Copysign(0, -1),
   792  	0,
   793  	math.Pi,
   794  	math.NaN(),
   795  }
   796  
   797  var asinSC = []float64{
   798  	math.NaN(),
   799  	math.Copysign(0, -1),
   800  	0,
   801  	math.NaN(),
   802  	math.NaN(),
   803  }
   804  
   805  var vfasinhSC = []float64{
   806  	math.Inf(-1),
   807  	math.Copysign(0, -1),
   808  	0,
   809  	math.Inf(1),
   810  	math.NaN(),
   811  }
   812  
   813  var asinhSC = []float64{
   814  	math.Inf(-1),
   815  	math.Copysign(0, -1),
   816  	0,
   817  	math.Inf(1),
   818  	math.NaN(),
   819  }
   820  
   821  var vfatanSC = []float64{
   822  	math.Inf(-1),
   823  	math.Copysign(0, -1),
   824  	0,
   825  	math.Inf(1),
   826  	math.NaN(),
   827  }
   828  
   829  var atanSC = []float64{
   830  	-math.Pi / 2,
   831  	math.Copysign(0, -1),
   832  	0,
   833  	math.Pi / 2,
   834  	math.NaN(),
   835  }
   836  
   837  var vfatanhSC = []float64{
   838  	math.Inf(-1),
   839  	-math.Pi,
   840  	-1,
   841  	math.Copysign(0, -1),
   842  	0,
   843  	1,
   844  	math.Pi,
   845  	math.Inf(1),
   846  	math.NaN(),
   847  }
   848  
   849  var atanhSC = []float64{
   850  	math.NaN(),
   851  	math.NaN(),
   852  	math.Inf(-1),
   853  	math.Copysign(0, -1),
   854  	0,
   855  	math.Inf(1),
   856  	math.NaN(),
   857  	math.NaN(),
   858  	math.NaN(),
   859  }
   860  
   861  var vfatan2SC = [][2]float64{
   862  	{math.Inf(-1), math.Inf(-1)},
   863  	{math.Inf(-1), -math.Pi},
   864  	{math.Inf(-1), 0},
   865  	{math.Inf(-1), +math.Pi},
   866  	{math.Inf(-1), math.Inf(1)},
   867  	{math.Inf(-1), math.NaN()},
   868  	{-math.Pi, math.Inf(-1)},
   869  	{-math.Pi, 0},
   870  	{-math.Pi, math.Inf(1)},
   871  	{-math.Pi, math.NaN()},
   872  	{math.Copysign(0, -1), math.Inf(-1)},
   873  	{math.Copysign(0, -1), -math.Pi},
   874  	{math.Copysign(0, -1), math.Copysign(0, -1)},
   875  	{math.Copysign(0, -1), 0},
   876  	{math.Copysign(0, -1), +math.Pi},
   877  	{math.Copysign(0, -1), math.Inf(1)},
   878  	{math.Copysign(0, -1), math.NaN()},
   879  	{0, math.Inf(-1)},
   880  	{0, -math.Pi},
   881  	{0, math.Copysign(0, -1)},
   882  	{0, 0},
   883  	{0, +math.Pi},
   884  	{0, math.Inf(1)},
   885  	{0, math.NaN()},
   886  	{+math.Pi, math.Inf(-1)},
   887  	{+math.Pi, 0},
   888  	{+math.Pi, math.Inf(1)},
   889  	{1.0, math.Inf(1)},
   890  	{-1.0, math.Inf(1)},
   891  	{+math.Pi, math.NaN()},
   892  	{math.Inf(1), math.Inf(-1)},
   893  	{math.Inf(1), -math.Pi},
   894  	{math.Inf(1), 0},
   895  	{math.Inf(1), +math.Pi},
   896  	{math.Inf(1), math.Inf(1)},
   897  	{math.Inf(1), math.NaN()},
   898  	{math.NaN(), math.NaN()},
   899  }
   900  
   901  var atan2SC = []float64{
   902  	// https://github.com/gnolang/gno/issues/1152
   903  	-3.0 * math.Pi / 4,   // atan2(-Inf, -Inf)
   904  	-math.Pi / 2,         // atan2(-Inf, -math.Pi)
   905  	-math.Pi / 2,         // atan2(-Inf, +0)
   906  	-math.Pi / 2,         // atan2(-Inf, +math.Pi)
   907  	-math.Pi / 4,         // atan2(-Inf, +Inf)
   908  	math.NaN(),           // atan2(-Inf, NaN)
   909  	-math.Pi,             // atan2(-math.Pi, -Inf)
   910  	-math.Pi / 2,         // atan2(-math.Pi, +0)
   911  	math.Copysign(0, -1), // atan2(-math.Pi, Inf)
   912  	math.NaN(),           // atan2(-math.Pi, NaN)
   913  	-math.Pi,             // atan2(-0, -Inf)
   914  	-math.Pi,             // atan2(-0, -math.Pi)
   915  	-math.Pi,             // atan2(-0, -0)
   916  	math.Copysign(0, -1), // atan2(-0, +0)
   917  	math.Copysign(0, -1), // atan2(-0, +math.Pi)
   918  	math.Copysign(0, -1), // atan2(-0, +Inf)
   919  	math.NaN(),           // atan2(-0, NaN)
   920  	math.Pi,              // atan2(+0, -Inf)
   921  	math.Pi,              // atan2(+0, -math.Pi)
   922  	math.Pi,              // atan2(+0, -0)
   923  	0,                    // atan2(+0, +0)
   924  	0,                    // atan2(+0, +math.Pi)
   925  	0,                    // atan2(+0, +Inf)
   926  	math.NaN(),           // atan2(+0, NaN)
   927  	math.Pi,              // atan2(+math.Pi, -Inf)
   928  	math.Pi / 2,          // atan2(+math.Pi, +0)
   929  	0,                    // atan2(+math.Pi, +Inf)
   930  	0,                    // atan2(+1, +Inf)
   931  	math.Copysign(0, -1), // atan2(-1, +Inf)
   932  	math.NaN(),           // atan2(+math.Pi, NaN)
   933  	3 * math.Pi / 4,      // atan2(+Inf, -Inf)
   934  	math.Pi / 2,          // atan2(+Inf, -math.Pi)
   935  	math.Pi / 2,          // atan2(+Inf, +0)
   936  	math.Pi / 2,          // atan2(+Inf, +math.Pi)
   937  	math.Pi / 4,          // atan2(+Inf, +Inf)
   938  	math.NaN(),           // atan2(+Inf, NaN)
   939  	math.NaN(),           // atan2(NaN, NaN)
   940  }
   941  
   942  var vfcbrtSC = []float64{
   943  	math.Inf(-1),
   944  	math.Copysign(0, -1),
   945  	0,
   946  	math.Inf(1),
   947  	math.NaN(),
   948  }
   949  
   950  var cbrtSC = []float64{
   951  	math.Inf(-1),
   952  	math.Copysign(0, -1),
   953  	0,
   954  	math.Inf(1),
   955  	math.NaN(),
   956  }
   957  
   958  var vfceilSC = []float64{
   959  	math.Inf(-1),
   960  	math.Copysign(0, -1),
   961  	0,
   962  	math.Inf(1),
   963  	math.NaN(),
   964  }
   965  
   966  var ceilSC = []float64{
   967  	math.Inf(-1),
   968  	math.Copysign(0, -1),
   969  	0,
   970  	math.Inf(1),
   971  	math.NaN(),
   972  }
   973  
   974  var vfcopysignSC = []float64{
   975  	math.Inf(-1),
   976  	math.Inf(1),
   977  	math.NaN(),
   978  }
   979  
   980  var copysignSC = []float64{
   981  	math.Inf(-1),
   982  	math.Inf(-1),
   983  	math.NaN(),
   984  }
   985  
   986  var vfcosSC = []float64{
   987  	math.Inf(-1),
   988  	math.Inf(1),
   989  	math.NaN(),
   990  }
   991  
   992  var cosSC = []float64{
   993  	math.NaN(),
   994  	math.NaN(),
   995  	math.NaN(),
   996  }
   997  
   998  var vfcoshSC = []float64{
   999  	math.Inf(-1),
  1000  	math.Copysign(0, -1),
  1001  	0,
  1002  	math.Inf(1),
  1003  	math.NaN(),
  1004  }
  1005  
  1006  var coshSC = []float64{
  1007  	math.Inf(1),
  1008  	1,
  1009  	1,
  1010  	math.Inf(1),
  1011  	math.NaN(),
  1012  }
  1013  
  1014  var vferfSC = []float64{
  1015  	math.Inf(-1),
  1016  	math.Copysign(0, -1),
  1017  	0,
  1018  	math.Inf(1),
  1019  	math.NaN(),
  1020  	-1000,
  1021  	1000,
  1022  }
  1023  
  1024  var erfSC = []float64{
  1025  	-1,
  1026  	math.Copysign(0, -1),
  1027  	0,
  1028  	1,
  1029  	math.NaN(),
  1030  	-1,
  1031  	1,
  1032  }
  1033  
  1034  var vferfcSC = []float64{
  1035  	math.Inf(-1),
  1036  	math.Inf(1),
  1037  	math.NaN(),
  1038  	-1000,
  1039  	1000,
  1040  }
  1041  
  1042  var erfcSC = []float64{
  1043  	2,
  1044  	0,
  1045  	math.NaN(),
  1046  	2,
  1047  	0,
  1048  }
  1049  
  1050  var vferfinvSC = []float64{
  1051  	1,
  1052  	-1,
  1053  	0,
  1054  	math.Inf(-1),
  1055  	math.Inf(1),
  1056  	math.NaN(),
  1057  }
  1058  
  1059  var erfinvSC = []float64{
  1060  	math.Inf(+1),
  1061  	math.Inf(-1),
  1062  	0,
  1063  	math.NaN(),
  1064  	math.NaN(),
  1065  	math.NaN(),
  1066  }
  1067  
  1068  var vferfcinvSC = []float64{
  1069  	0,
  1070  	2,
  1071  	1,
  1072  	math.Inf(1),
  1073  	math.Inf(-1),
  1074  	math.NaN(),
  1075  }
  1076  
  1077  var erfcinvSC = []float64{
  1078  	math.Inf(+1),
  1079  	math.Inf(-1),
  1080  	0,
  1081  	math.NaN(),
  1082  	math.NaN(),
  1083  	math.NaN(),
  1084  }
  1085  
  1086  var vfexpSC = []float64{
  1087  	math.Inf(-1),
  1088  	-2000,
  1089  	2000,
  1090  	math.Inf(1),
  1091  	math.NaN(),
  1092  	// smallest float64 that overflows math.Exp(x)
  1093  	7.097827128933841e+02,
  1094  	// Issue 18912
  1095  	1.48852223e+09,
  1096  	1.4885222e+09,
  1097  	1,
  1098  	// near zero
  1099  	3.725290298461915e-09,
  1100  	// denormal
  1101  	-740,
  1102  }
  1103  
  1104  var expSC = []float64{
  1105  	0,
  1106  	0,
  1107  	math.Inf(1),
  1108  	math.Inf(1),
  1109  	math.NaN(),
  1110  	math.Inf(1),
  1111  	math.Inf(1),
  1112  	math.Inf(1),
  1113  	2.718281828459045,
  1114  	1.0000000037252903,
  1115  	4.2e-322,
  1116  }
  1117  
  1118  var vfexp2SC = []float64{
  1119  	math.Inf(-1),
  1120  	-2000,
  1121  	2000,
  1122  	math.Inf(1),
  1123  	math.NaN(),
  1124  	// smallest float64 that overflows math.Exp2(x)
  1125  	1024,
  1126  	// near underflow
  1127  	-1.07399999999999e+03,
  1128  	// near zero
  1129  	3.725290298461915e-09,
  1130  }
  1131  
  1132  var exp2SC = []float64{
  1133  	0,
  1134  	0,
  1135  	math.Inf(1),
  1136  	math.Inf(1),
  1137  	math.NaN(),
  1138  	math.Inf(1),
  1139  	5e-324,
  1140  	1.0000000025821745,
  1141  }
  1142  
  1143  var vfexpm1SC = []float64{
  1144  	math.Inf(-1),
  1145  	-710,
  1146  	math.Copysign(0, -1),
  1147  	0,
  1148  	710,
  1149  	math.Inf(1),
  1150  	math.NaN(),
  1151  }
  1152  
  1153  var expm1SC = []float64{
  1154  	-1,
  1155  	-1,
  1156  	math.Copysign(0, -1),
  1157  	0,
  1158  	math.Inf(1),
  1159  	math.Inf(1),
  1160  	math.NaN(),
  1161  }
  1162  
  1163  var vffabsSC = []float64{
  1164  	math.Inf(-1),
  1165  	math.Copysign(0, -1),
  1166  	0,
  1167  	math.Inf(1),
  1168  	math.NaN(),
  1169  }
  1170  
  1171  var fabsSC = []float64{
  1172  	math.Inf(1),
  1173  	0,
  1174  	0,
  1175  	math.Inf(1),
  1176  	math.NaN(),
  1177  }
  1178  
  1179  var vffdimSC = [][2]float64{
  1180  	{math.Inf(-1), math.Inf(-1)},
  1181  	{math.Inf(-1), math.Inf(1)},
  1182  	{math.Inf(-1), math.NaN()},
  1183  	{math.Copysign(0, -1), math.Copysign(0, -1)},
  1184  	{math.Copysign(0, -1), 0},
  1185  	{0, math.Copysign(0, -1)},
  1186  	{0, 0},
  1187  	{math.Inf(1), math.Inf(-1)},
  1188  	{math.Inf(1), math.Inf(1)},
  1189  	{math.Inf(1), math.NaN()},
  1190  	{math.NaN(), math.Inf(-1)},
  1191  	{math.NaN(), math.Copysign(0, -1)},
  1192  	{math.NaN(), 0},
  1193  	{math.NaN(), math.Inf(1)},
  1194  	{math.NaN(), math.NaN()},
  1195  }
  1196  
  1197  var (
  1198  	nan       = math.Float64frombits(0xFFF8000000000000) // SSE2 DIVSD 0/0
  1199  	vffdim2SC = [][2]float64{
  1200  		{math.Inf(-1), math.Inf(-1)},
  1201  		{math.Inf(-1), math.Inf(1)},
  1202  		{math.Inf(-1), nan},
  1203  		{math.Copysign(0, -1), math.Copysign(0, -1)},
  1204  		{math.Copysign(0, -1), 0},
  1205  		{0, math.Copysign(0, -1)},
  1206  		{0, 0},
  1207  		{math.Inf(1), math.Inf(-1)},
  1208  		{math.Inf(1), math.Inf(1)},
  1209  		{math.Inf(1), nan},
  1210  		{nan, math.Inf(-1)},
  1211  		{nan, math.Copysign(0, -1)},
  1212  		{nan, 0},
  1213  		{nan, math.Inf(1)},
  1214  		{nan, nan},
  1215  	}
  1216  )
  1217  
  1218  var fdimSC = []float64{
  1219  	math.NaN(),
  1220  	0,
  1221  	math.NaN(),
  1222  	0,
  1223  	0,
  1224  	0,
  1225  	0,
  1226  	math.Inf(1),
  1227  	math.NaN(),
  1228  	math.NaN(),
  1229  	math.NaN(),
  1230  	math.NaN(),
  1231  	math.NaN(),
  1232  	math.NaN(),
  1233  	math.NaN(),
  1234  }
  1235  
  1236  var fmaxSC = []float64{
  1237  	math.Inf(-1),
  1238  	math.Inf(1),
  1239  	math.NaN(),
  1240  	math.Copysign(0, -1),
  1241  	0,
  1242  	0,
  1243  	0,
  1244  	math.Inf(1),
  1245  	math.Inf(1),
  1246  	math.Inf(1),
  1247  	math.NaN(),
  1248  	math.NaN(),
  1249  	math.NaN(),
  1250  	math.Inf(1),
  1251  	math.NaN(),
  1252  }
  1253  
  1254  var fminSC = []float64{
  1255  	math.Inf(-1),
  1256  	math.Inf(-1),
  1257  	math.Inf(-1),
  1258  	math.Copysign(0, -1),
  1259  	math.Copysign(0, -1),
  1260  	math.Copysign(0, -1),
  1261  	0,
  1262  	math.Inf(-1),
  1263  	math.Inf(1),
  1264  	math.NaN(),
  1265  	math.Inf(-1),
  1266  	math.NaN(),
  1267  	math.NaN(),
  1268  	math.NaN(),
  1269  	math.NaN(),
  1270  }
  1271  
  1272  var vffmodSC = [][2]float64{
  1273  	{math.Inf(-1), math.Inf(-1)},
  1274  	{math.Inf(-1), -math.Pi},
  1275  	{math.Inf(-1), 0},
  1276  	{math.Inf(-1), math.Pi},
  1277  	{math.Inf(-1), math.Inf(1)},
  1278  	{math.Inf(-1), math.NaN()},
  1279  	{-math.Pi, math.Inf(-1)},
  1280  	{-math.Pi, 0},
  1281  	{-math.Pi, math.Inf(1)},
  1282  	{-math.Pi, math.NaN()},
  1283  	{math.Copysign(0, -1), math.Inf(-1)},
  1284  	{math.Copysign(0, -1), 0},
  1285  	{math.Copysign(0, -1), math.Inf(1)},
  1286  	{math.Copysign(0, -1), math.NaN()},
  1287  	{0, math.Inf(-1)},
  1288  	{0, 0},
  1289  	{0, math.Inf(1)},
  1290  	{0, math.NaN()},
  1291  	{math.Pi, math.Inf(-1)},
  1292  	{math.Pi, 0},
  1293  	{math.Pi, math.Inf(1)},
  1294  	{math.Pi, math.NaN()},
  1295  	{math.Inf(1), math.Inf(-1)},
  1296  	{math.Inf(1), -math.Pi},
  1297  	{math.Inf(1), 0},
  1298  	{math.Inf(1), math.Pi},
  1299  	{math.Inf(1), math.Inf(1)},
  1300  	{math.Inf(1), math.NaN()},
  1301  	{math.NaN(), math.Inf(-1)},
  1302  	{math.NaN(), -math.Pi},
  1303  	{math.NaN(), 0},
  1304  	{math.NaN(), math.Pi},
  1305  	{math.NaN(), math.Inf(1)},
  1306  	{math.NaN(), math.NaN()},
  1307  }
  1308  
  1309  var fmodSC = []float64{
  1310  	math.NaN(),           // fmod(-Inf, -Inf)
  1311  	math.NaN(),           // fmod(-Inf, -math.Pi)
  1312  	math.NaN(),           // fmod(-Inf, 0)
  1313  	math.NaN(),           // fmod(-Inf, math.Pi)
  1314  	math.NaN(),           // fmod(-Inf, +Inf)
  1315  	math.NaN(),           // fmod(-Inf, NaN)
  1316  	-math.Pi,             // fmod(-math.Pi, -Inf)
  1317  	math.NaN(),           // fmod(-math.Pi, 0)
  1318  	-math.Pi,             // fmod(-math.Pi, +Inf)
  1319  	math.NaN(),           // fmod(-math.Pi, NaN)
  1320  	math.Copysign(0, -1), // fmod(-0, -Inf)
  1321  	math.NaN(),           // fmod(-0, 0)
  1322  	math.Copysign(0, -1), // fmod(-0, Inf)
  1323  	math.NaN(),           // fmod(-0, NaN)
  1324  	0,                    // fmod(0, -Inf)
  1325  	math.NaN(),           // fmod(0, 0)
  1326  	0,                    // fmod(0, +Inf)
  1327  	math.NaN(),           // fmod(0, NaN)
  1328  	math.Pi,              // fmod(math.Pi, -Inf)
  1329  	math.NaN(),           // fmod(math.Pi, 0)
  1330  	math.Pi,              // fmod(math.Pi, +Inf)
  1331  	math.NaN(),           // fmod(math.Pi, NaN)
  1332  	math.NaN(),           // fmod(+Inf, -Inf)
  1333  	math.NaN(),           // fmod(+Inf, -math.Pi)
  1334  	math.NaN(),           // fmod(+Inf, 0)
  1335  	math.NaN(),           // fmod(+Inf, math.Pi)
  1336  	math.NaN(),           // fmod(+Inf, +Inf)
  1337  	math.NaN(),           // fmod(+Inf, NaN)
  1338  	math.NaN(),           // fmod(NaN, -Inf)
  1339  	math.NaN(),           // fmod(NaN, -math.Pi)
  1340  	math.NaN(),           // fmod(NaN, 0)
  1341  	math.NaN(),           // fmod(NaN, math.Pi)
  1342  	math.NaN(),           // fmod(NaN, +Inf)
  1343  	math.NaN(),           // fmod(NaN, NaN)
  1344  }
  1345  
  1346  var vffrexpSC = []float64{
  1347  	math.Inf(-1),
  1348  	math.Copysign(0, -1),
  1349  	0,
  1350  	math.Inf(1),
  1351  	math.NaN(),
  1352  }
  1353  
  1354  var frexpSC = []fi{
  1355  	{math.Inf(-1), 0},
  1356  	{math.Copysign(0, -1), 0},
  1357  	{0, 0},
  1358  	{math.Inf(1), 0},
  1359  	{math.NaN(), 0},
  1360  }
  1361  
  1362  var vfgamma = [][2]float64{
  1363  	{math.Inf(1), math.Inf(1)},
  1364  	{math.Inf(-1), math.NaN()},
  1365  	{0, math.Inf(1)},
  1366  	{math.Copysign(0, -1), math.Inf(-1)},
  1367  	{math.NaN(), math.NaN()},
  1368  	{-1, math.NaN()},
  1369  	{-2, math.NaN()},
  1370  	{-3, math.NaN()},
  1371  	{-1e16, math.NaN()},
  1372  	{-1e300, math.NaN()},
  1373  	{1.7e308, math.Inf(1)},
  1374  
  1375  	// Test inputs inspired by Python test suite.
  1376  	// Outputs computed at high precision by PARI/GP.
  1377  	// If recomputing table entries, be careful to use
  1378  	// high-precision (%.1000g) formatting of the float64 inputs.
  1379  	// For example, -2.0000000000000004 is the float64 with exact value
  1380  	// -2.00000000000000044408920985626161695, and
  1381  	// gamma(-2.0000000000000004) = -1249999999999999.5386078562728167651513, while
  1382  	// gamma(-2.00000000000000044408920985626161695) = -1125899906826907.2044875028130093136826.
  1383  	// Thus the table lists -1.1258999068426235e+15 as the answer.
  1384  	{0.5, 1.772453850905516},
  1385  	{1.5, 0.886226925452758},
  1386  	{2.5, 1.329340388179137},
  1387  	{3.5, 3.3233509704478426},
  1388  	{-0.5, -3.544907701811032},
  1389  	{-1.5, 2.363271801207355},
  1390  	{-2.5, -0.9453087204829419},
  1391  	{-3.5, 0.2700882058522691},
  1392  	{0.1, 9.51350769866873},
  1393  	{0.01, 99.4325851191506},
  1394  	{1e-08, 9.999999942278434e+07},
  1395  	{1e-16, 1e+16},
  1396  	{0.001, 999.4237724845955},
  1397  	{1e-16, 1e+16},
  1398  	{1e-308, 1e+308},
  1399  	{5.6e-309, 1.7857142857142864e+308},
  1400  	{5.5e-309, math.Inf(1)},
  1401  	{1e-309, math.Inf(1)},
  1402  	{1e-323, math.Inf(1)},
  1403  	{5e-324, math.Inf(1)},
  1404  	{-0.1, -10.686287021193193},
  1405  	{-0.01, -100.58719796441078},
  1406  	{-1e-08, -1.0000000057721567e+08},
  1407  	{-1e-16, -1e+16},
  1408  	{-0.001, -1000.5782056293586},
  1409  	{-1e-16, -1e+16},
  1410  	{-1e-308, -1e+308},
  1411  	{-5.6e-309, -1.7857142857142864e+308},
  1412  	{-5.5e-309, math.Inf(-1)},
  1413  	{-1e-309, math.Inf(-1)},
  1414  	{-1e-323, math.Inf(-1)},
  1415  	{-5e-324, math.Inf(-1)},
  1416  	{-0.9999999999999999, -9.007199254740992e+15},
  1417  	{-1.0000000000000002, 4.5035996273704955e+15},
  1418  	{-1.9999999999999998, 2.2517998136852485e+15},
  1419  	{-2.0000000000000004, -1.1258999068426235e+15},
  1420  	{-100.00000000000001, -7.540083334883109e-145},
  1421  	{-99.99999999999999, 7.540083334884096e-145},
  1422  	{17, 2.0922789888e+13},
  1423  	{171, 7.257415615307999e+306},
  1424  	{171.6, 1.5858969096672565e+308},
  1425  	{171.624, 1.7942117599248104e+308},
  1426  	{171.625, math.Inf(1)},
  1427  	{172, math.Inf(1)},
  1428  	{2000, math.Inf(1)},
  1429  	{-100.5, -3.3536908198076787e-159},
  1430  	{-160.5, -5.255546447007829e-286},
  1431  	{-170.5, -3.3127395215386074e-308},
  1432  	{-171.5, 1.9316265431712e-310},
  1433  	{-176.5, -1.196e-321},
  1434  	{-177.5, 5e-324},
  1435  	{-178.5, math.Copysign(0, -1)},
  1436  	{-179.5, 0},
  1437  	{-201.0001, 0},
  1438  	{-202.9999, math.Copysign(0, -1)},
  1439  	{-1000.5, math.Copysign(0, -1)},
  1440  	{-1.0000000003e+09, math.Copysign(0, -1)},
  1441  	{-4.5035996273704955e+15, 0},
  1442  	{-63.349078729022985, 4.177797167776188e-88},
  1443  	{-127.45117632943295, 1.183111089623681e-214},
  1444  }
  1445  
  1446  var vfhypotSC = [][2]float64{
  1447  	{math.Inf(-1), math.Inf(-1)},
  1448  	{math.Inf(-1), 0},
  1449  	{math.Inf(-1), math.Inf(1)},
  1450  	{math.Inf(-1), math.NaN()},
  1451  	{math.Copysign(0, -1), math.Copysign(0, -1)},
  1452  	{math.Copysign(0, -1), 0},
  1453  	{0, math.Copysign(0, -1)},
  1454  	{0, 0}, // +0, +0
  1455  	{0, math.Inf(-1)},
  1456  	{0, math.Inf(1)},
  1457  	{0, math.NaN()},
  1458  	{math.Inf(1), math.Inf(-1)},
  1459  	{math.Inf(1), 0},
  1460  	{math.Inf(1), math.Inf(1)},
  1461  	{math.Inf(1), math.NaN()},
  1462  	{math.NaN(), math.Inf(-1)},
  1463  	{math.NaN(), 0},
  1464  	{math.NaN(), math.Inf(1)},
  1465  	{math.NaN(), math.NaN()},
  1466  }
  1467  
  1468  var hypotSC = []float64{
  1469  	math.Inf(1),
  1470  	math.Inf(1),
  1471  	math.Inf(1),
  1472  	math.Inf(1),
  1473  	0,
  1474  	0,
  1475  	0,
  1476  	0,
  1477  	math.Inf(1),
  1478  	math.Inf(1),
  1479  	math.NaN(),
  1480  	math.Inf(1),
  1481  	math.Inf(1),
  1482  	math.Inf(1),
  1483  	math.Inf(1),
  1484  	math.Inf(1),
  1485  	math.NaN(),
  1486  	math.Inf(1),
  1487  	math.NaN(),
  1488  }
  1489  
  1490  var ilogbSC = []int{
  1491  	math.MaxInt32,
  1492  	math.MinInt32,
  1493  	math.MaxInt32,
  1494  	math.MaxInt32,
  1495  }
  1496  
  1497  var vfj0SC = []float64{
  1498  	math.Inf(-1),
  1499  	0,
  1500  	math.Inf(1),
  1501  	math.NaN(),
  1502  }
  1503  
  1504  var j0SC = []float64{
  1505  	0,
  1506  	1,
  1507  	0,
  1508  	math.NaN(),
  1509  }
  1510  
  1511  var j1SC = []float64{
  1512  	0,
  1513  	0,
  1514  	0,
  1515  	math.NaN(),
  1516  }
  1517  
  1518  var j2SC = []float64{
  1519  	0,
  1520  	0,
  1521  	0,
  1522  	math.NaN(),
  1523  }
  1524  
  1525  var jM3SC = []float64{
  1526  	0,
  1527  	0,
  1528  	0,
  1529  	math.NaN(),
  1530  }
  1531  
  1532  var vfldexpSC = []fi{
  1533  	{0, 0},
  1534  	{0, -1075},
  1535  	{0, 1024},
  1536  	{math.Copysign(0, -1), 0},
  1537  	{math.Copysign(0, -1), -1075},
  1538  	{math.Copysign(0, -1), 1024},
  1539  	{math.Inf(1), 0},
  1540  	{math.Inf(1), -1024},
  1541  	{math.Inf(-1), 0},
  1542  	{math.Inf(-1), -1024},
  1543  	{math.NaN(), -1024},
  1544  	// XXX: changed to use constant values instead of unsafe.Sizeof(0)
  1545  	{10, int(1) << (uint64(7) * 8)},
  1546  	{10, -(int(1) << (uint64(7) * 8))},
  1547  }
  1548  
  1549  var ldexpSC = []float64{
  1550  	0,
  1551  	0,
  1552  	0,
  1553  	math.Copysign(0, -1),
  1554  	math.Copysign(0, -1),
  1555  	math.Copysign(0, -1),
  1556  	math.Inf(1),
  1557  	math.Inf(1),
  1558  	math.Inf(-1),
  1559  	math.Inf(-1),
  1560  	math.NaN(),
  1561  	math.Inf(1),
  1562  	0,
  1563  }
  1564  
  1565  var vflgammaSC = []float64{
  1566  	math.Inf(-1),
  1567  	-3,
  1568  	0,
  1569  	1,
  1570  	2,
  1571  	math.Inf(1),
  1572  	math.NaN(),
  1573  }
  1574  
  1575  var lgammaSC = []fi{
  1576  	{math.Inf(-1), 1},
  1577  	{math.Inf(1), 1},
  1578  	{math.Inf(1), 1},
  1579  	{0, 1},
  1580  	{0, 1},
  1581  	{math.Inf(1), 1},
  1582  	{math.NaN(), 1},
  1583  }
  1584  
  1585  var vflogSC = []float64{
  1586  	math.Inf(-1),
  1587  	-math.Pi,
  1588  	math.Copysign(0, -1),
  1589  	0,
  1590  	1,
  1591  	math.Inf(1),
  1592  	math.NaN(),
  1593  }
  1594  
  1595  var logSC = []float64{
  1596  	math.NaN(),
  1597  	math.NaN(),
  1598  	math.Inf(-1),
  1599  	math.Inf(-1),
  1600  	0,
  1601  	math.Inf(1),
  1602  	math.NaN(),
  1603  }
  1604  
  1605  var vflogbSC = []float64{
  1606  	math.Inf(-1),
  1607  	0,
  1608  	math.Inf(1),
  1609  	math.NaN(),
  1610  }
  1611  
  1612  var logbSC = []float64{
  1613  	math.Inf(1),
  1614  	math.Inf(-1),
  1615  	math.Inf(1),
  1616  	math.NaN(),
  1617  }
  1618  
  1619  var vflog1pSC = []float64{
  1620  	math.Inf(-1),
  1621  	-math.Pi,
  1622  	-1,
  1623  	math.Copysign(0, -1),
  1624  	0,
  1625  	math.Inf(1),
  1626  	math.NaN(),
  1627  	4503599627370496.5, // Issue #29488
  1628  }
  1629  
  1630  var log1pSC = []float64{
  1631  	math.NaN(),
  1632  	math.NaN(),
  1633  	math.Inf(-1),
  1634  	math.Copysign(0, -1),
  1635  	0,
  1636  	math.Inf(1),
  1637  	math.NaN(),
  1638  	36.04365338911715, // Issue #29488
  1639  }
  1640  
  1641  var vfmodfSC = []float64{
  1642  	math.Inf(-1),
  1643  	math.Copysign(0, -1),
  1644  	math.Inf(1),
  1645  	math.NaN(),
  1646  }
  1647  
  1648  var modfSC = [][2]float64{
  1649  	{math.Inf(-1), math.NaN()}, // [2]float64{math.Copysign(0, -1), math.Inf(-1)},
  1650  	{math.Copysign(0, -1), math.Copysign(0, -1)},
  1651  	{math.Inf(1), math.NaN()}, // [2]float64{0, math.Inf(1)},
  1652  	{math.NaN(), math.NaN()},
  1653  }
  1654  
  1655  var vfnextafter32SC = [][2]float32{
  1656  	{0, 0},
  1657  	{0, float32(math.Copysign(0, -1))},
  1658  	{0, -1},
  1659  	{0, float32(math.NaN())},
  1660  	{float32(math.Copysign(0, -1)), 1},
  1661  	{float32(math.Copysign(0, -1)), 0},
  1662  	{float32(math.Copysign(0, -1)), float32(math.Copysign(0, -1))},
  1663  	{float32(math.Copysign(0, -1)), -1},
  1664  	{float32(math.NaN()), 0},
  1665  	{float32(math.NaN()), float32(math.NaN())},
  1666  }
  1667  
  1668  var nextafter32SC = []float32{
  1669  	0,
  1670  	0,
  1671  	-1.401298464e-45, // math.Float32frombits(0x80000001)
  1672  	float32(math.NaN()),
  1673  	1.401298464e-45, // math.Float32frombits(0x00000001)
  1674  	float32(math.Copysign(0, -1)),
  1675  	float32(math.Copysign(0, -1)),
  1676  	-1.401298464e-45, // math.Float32frombits(0x80000001)
  1677  	float32(math.NaN()),
  1678  	float32(math.NaN()),
  1679  }
  1680  
  1681  var vfnextafter64SC = [][2]float64{
  1682  	{0, 0},
  1683  	{0, math.Copysign(0, -1)},
  1684  	{0, -1},
  1685  	{0, math.NaN()},
  1686  	{math.Copysign(0, -1), 1},
  1687  	{math.Copysign(0, -1), 0},
  1688  	{math.Copysign(0, -1), math.Copysign(0, -1)},
  1689  	{math.Copysign(0, -1), -1},
  1690  	{math.NaN(), 0},
  1691  	{math.NaN(), math.NaN()},
  1692  }
  1693  
  1694  var nextafter64SC = []float64{
  1695  	0,
  1696  	0,
  1697  	-4.9406564584124654418e-324, // math.Float64frombits(0x8000000000000001)
  1698  	math.NaN(),
  1699  	4.9406564584124654418e-324, // math.Float64frombits(0x0000000000000001)
  1700  	math.Copysign(0, -1),
  1701  	math.Copysign(0, -1),
  1702  	-4.9406564584124654418e-324, // math.Float64frombits(0x8000000000000001)
  1703  	math.NaN(),
  1704  	math.NaN(),
  1705  }
  1706  
  1707  var vfpowSC = [][2]float64{
  1708  	{math.Inf(-1), -math.Pi},
  1709  	{math.Inf(-1), -3},
  1710  	{math.Inf(-1), math.Copysign(0, -1)},
  1711  	{math.Inf(-1), 0},
  1712  	{math.Inf(-1), 1},
  1713  	{math.Inf(-1), 3},
  1714  	{math.Inf(-1), math.Pi},
  1715  	{math.Inf(-1), 0.5},
  1716  	{math.Inf(-1), math.NaN()},
  1717  
  1718  	{-math.Pi, math.Inf(-1)},
  1719  	{-math.Pi, -math.Pi},
  1720  	{-math.Pi, math.Copysign(0, -1)},
  1721  	{-math.Pi, 0},
  1722  	{-math.Pi, 1},
  1723  	{-math.Pi, math.Pi},
  1724  	{-math.Pi, math.Inf(1)},
  1725  	{-math.Pi, math.NaN()},
  1726  
  1727  	{-1, math.Inf(-1)},
  1728  	{-1, math.Inf(1)},
  1729  	{-1, math.NaN()},
  1730  	{-0.5, math.Inf(-1)},
  1731  	{-0.5, math.Inf(1)},
  1732  	{math.Copysign(0, -1), math.Inf(-1)},
  1733  	{math.Copysign(0, -1), -math.Pi},
  1734  	{math.Copysign(0, -1), -0.5},
  1735  	{math.Copysign(0, -1), -3},
  1736  	{math.Copysign(0, -1), 3},
  1737  	{math.Copysign(0, -1), math.Pi},
  1738  	{math.Copysign(0, -1), 0.5},
  1739  	{math.Copysign(0, -1), math.Inf(1)},
  1740  
  1741  	{0, math.Inf(-1)},
  1742  	{0, -math.Pi},
  1743  	{0, -3},
  1744  	{0, math.Copysign(0, -1)},
  1745  	{0, 0},
  1746  	{0, 3},
  1747  	{0, math.Pi},
  1748  	{0, math.Inf(1)},
  1749  	{0, math.NaN()},
  1750  
  1751  	{0.5, math.Inf(-1)},
  1752  	{0.5, math.Inf(1)},
  1753  	{1, math.Inf(-1)},
  1754  	{1, math.Inf(1)},
  1755  	{1, math.NaN()},
  1756  
  1757  	{math.Pi, math.Inf(-1)},
  1758  	{math.Pi, math.Copysign(0, -1)},
  1759  	{math.Pi, 0},
  1760  	{math.Pi, 1},
  1761  	{math.Pi, math.Inf(1)},
  1762  	{math.Pi, math.NaN()},
  1763  	{math.Inf(1), -math.Pi},
  1764  	{math.Inf(1), math.Copysign(0, -1)},
  1765  	{math.Inf(1), 0},
  1766  	{math.Inf(1), 1},
  1767  	{math.Inf(1), math.Pi},
  1768  	{math.Inf(1), math.NaN()},
  1769  	{math.NaN(), -math.Pi},
  1770  	{math.NaN(), math.Copysign(0, -1)},
  1771  	{math.NaN(), 0},
  1772  	{math.NaN(), 1},
  1773  	{math.NaN(), math.Pi},
  1774  	{math.NaN(), math.NaN()},
  1775  
  1776  	// Issue #7394 overflow checks
  1777  	{2, float64(1 << 32)},
  1778  	{2, -float64(1 << 32)},
  1779  	{-2, float64(1<<32 + 1)},
  1780  	{0.5, float64(1 << 45)},
  1781  	{0.5, -float64(1 << 45)},
  1782  	// https://github.com/gnolang/gno/issues/1085
  1783  	{math.Nextafter(1, 2), float1Shift63},
  1784  	{math.Nextafter(1, -2), float1Shift63},
  1785  	{math.Nextafter(-1, 2), float1Shift63},
  1786  	{math.Nextafter(-1, -2), float1Shift63},
  1787  
  1788  	// Issue #57465
  1789  	{math.Copysign(0, -1), 1e19},
  1790  	{math.Copysign(0, -1), -1e19},
  1791  	{math.Copysign(0, -1), 1<<53 - 1},
  1792  	{math.Copysign(0, -1), -(1<<53 - 1)},
  1793  }
  1794  
  1795  const float1Shift63 float64 = 1 << 63
  1796  
  1797  var powSC = []float64{
  1798  	0,                    // pow(-Inf, -math.Pi)
  1799  	math.Copysign(0, -1), // pow(-Inf, -3)
  1800  	1,                    // pow(-Inf, -0)
  1801  	1,                    // pow(-Inf, +0)
  1802  	math.Inf(-1),         // pow(-Inf, 1)
  1803  	math.Inf(-1),         // pow(-Inf, 3)
  1804  	math.Inf(1),          // pow(-Inf, math.Pi)
  1805  	math.Inf(1),          // pow(-Inf, 0.5)
  1806  	math.NaN(),           // pow(-Inf, NaN)
  1807  	0,                    // pow(-math.Pi, -Inf)
  1808  	math.NaN(),           // pow(-math.Pi, -math.Pi)
  1809  	1,                    // pow(-math.Pi, -0)
  1810  	1,                    // pow(-math.Pi, +0)
  1811  	-math.Pi,             // pow(-math.Pi, 1)
  1812  	math.NaN(),           // pow(-math.Pi, math.Pi)
  1813  	math.Inf(1),          // pow(-math.Pi, +Inf)
  1814  	math.NaN(),           // pow(-math.Pi, NaN)
  1815  	1,                    // pow(-1, -Inf) IEEE 754-2008
  1816  	1,                    // pow(-1, +Inf) IEEE 754-2008
  1817  	math.NaN(),           // pow(-1, NaN)
  1818  	math.Inf(1),          // pow(-1/2, -Inf)
  1819  	0,                    // pow(-1/2, +Inf)
  1820  	math.Inf(1),          // pow(-0, -Inf)
  1821  	math.Inf(1),          // pow(-0, -math.Pi)
  1822  	math.Inf(1),          // pow(-0, -0.5)
  1823  	math.Inf(-1),         // pow(-0, -3) IEEE 754-2008
  1824  	math.Copysign(0, -1), // pow(-0, 3) IEEE 754-2008
  1825  	0,                    // pow(-0, +math.Pi)
  1826  	0,                    // pow(-0, 0.5)
  1827  	0,                    // pow(-0, +Inf)
  1828  	math.Inf(1),          // pow(+0, -Inf)
  1829  	math.Inf(1),          // pow(+0, -math.Pi)
  1830  	math.Inf(1),          // pow(+0, -3)
  1831  	1,                    // pow(+0, -0)
  1832  	1,                    // pow(+0, +0)
  1833  	0,                    // pow(+0, 3)
  1834  	0,                    // pow(+0, +math.Pi)
  1835  	0,                    // pow(+0, +Inf)
  1836  	math.NaN(),           // pow(+0, NaN)
  1837  	math.Inf(1),          // pow(1/2, -Inf)
  1838  	0,                    // pow(1/2, +Inf)
  1839  	1,                    // pow(1, -Inf) IEEE 754-2008
  1840  	1,                    // pow(1, +Inf) IEEE 754-2008
  1841  	1,                    // pow(1, NaN) IEEE 754-2008
  1842  	0,                    // pow(+math.Pi, -Inf)
  1843  	1,                    // pow(+math.Pi, -0)
  1844  	1,                    // pow(+math.Pi, +0)
  1845  	math.Pi,              // pow(+math.Pi, 1)
  1846  	math.Inf(1),          // pow(+math.Pi, +Inf)
  1847  	math.NaN(),           // pow(+math.Pi, NaN)
  1848  	0,                    // pow(+Inf, -math.Pi)
  1849  	1,                    // pow(+Inf, -0)
  1850  	1,                    // pow(+Inf, +0)
  1851  	math.Inf(1),          // pow(+Inf, 1)
  1852  	math.Inf(1),          // pow(+Inf, math.Pi)
  1853  	math.NaN(),           // pow(+Inf, NaN)
  1854  	math.NaN(),           // pow(NaN, -math.Pi)
  1855  	1,                    // pow(NaN, -0)
  1856  	1,                    // pow(NaN, +0)
  1857  	math.NaN(),           // pow(NaN, 1)
  1858  	math.NaN(),           // pow(NaN, +math.Pi)
  1859  	math.NaN(),           // pow(NaN, NaN)
  1860  
  1861  	// Issue #7394 overflow checks
  1862  	math.Inf(1),  // pow(2, float64(1 << 32))
  1863  	0,            // pow(2, -float64(1 << 32))
  1864  	math.Inf(-1), // pow(-2, float64(1<<32 + 1))
  1865  	0,            // pow(1/2, float64(1 << 45))
  1866  	math.Inf(1),  // pow(1/2, -float64(1 << 45))
  1867  	math.Inf(1),  // pow(math.Nextafter(1, 2), float64(1 << 63))
  1868  	0,            // pow(math.Nextafter(1, -2), float64(1 << 63))
  1869  	0,            // pow(math.Nextafter(-1, 2), float64(1 << 63))
  1870  	math.Inf(1),  // pow(math.Nextafter(-1, -2), float64(1 << 63))
  1871  
  1872  	// Issue #57465
  1873  	0,                    // pow(-0, 1e19)
  1874  	math.Inf(1),          // pow(-0, -1e19)
  1875  	math.Copysign(0, -1), // pow(-0, 1<<53 -1)
  1876  	math.Inf(-1),         // pow(-0, -(1<<53 -1))
  1877  }
  1878  
  1879  var vfpow10SC = []int{
  1880  	math.MinInt32,
  1881  	-324,
  1882  	-323,
  1883  	-50,
  1884  	-22,
  1885  	-1,
  1886  	0,
  1887  	1,
  1888  	22,
  1889  	50,
  1890  	100,
  1891  	200,
  1892  	308,
  1893  	309,
  1894  	math.MaxInt32,
  1895  }
  1896  
  1897  var pow10SC = []float64{
  1898  	0,           // pow10(math.MinInt32)
  1899  	0,           // pow10(-324)
  1900  	1.0e-323,    // pow10(-323)
  1901  	1.0e-50,     // pow10(-50)
  1902  	1.0e-22,     // pow10(-22)
  1903  	1.0e-1,      // pow10(-1)
  1904  	1.0e0,       // pow10(0)
  1905  	1.0e1,       // pow10(1)
  1906  	1.0e22,      // pow10(22)
  1907  	1.0e50,      // pow10(50)
  1908  	1.0e100,     // pow10(100)
  1909  	1.0e200,     // pow10(200)
  1910  	1.0e308,     // pow10(308)
  1911  	math.Inf(1), // pow10(309)
  1912  	math.Inf(1), // pow10(math.MaxInt32)
  1913  }
  1914  
  1915  var vfroundSC = [][2]float64{
  1916  	{0, 0},
  1917  	{1.390671161567e-309, 0}, // denormal
  1918  	{0.49999999999999994, 0}, // 0.5-epsilon
  1919  	{0.5, 1},
  1920  	{0.5000000000000001, 1}, // 0.5+epsilon
  1921  	{-1.5, -2},
  1922  	{-2.5, -3},
  1923  	{math.NaN(), math.NaN()},
  1924  	{math.Inf(1), math.Inf(1)},
  1925  	{2251799813685249.5, 2251799813685250}, // 1 bit fraction
  1926  	{2251799813685250.5, 2251799813685251},
  1927  	{4503599627370495.5, 4503599627370496}, // 1 bit fraction, rounding to 0 bit fraction
  1928  	{4503599627370497, 4503599627370497},   // large integer
  1929  }
  1930  
  1931  var vfroundEvenSC = [][2]float64{
  1932  	{0, 0},
  1933  	{1.390671161567e-309, 0}, // denormal
  1934  	{0.49999999999999994, 0}, // 0.5-epsilon
  1935  	{0.5, 0},
  1936  	{0.5000000000000001, 1}, // 0.5+epsilon
  1937  	{-1.5, -2},
  1938  	{-2.5, -2},
  1939  	{math.NaN(), math.NaN()},
  1940  	{math.Inf(1), math.Inf(1)},
  1941  	{2251799813685249.5, 2251799813685250}, // 1 bit fraction
  1942  	{2251799813685250.5, 2251799813685250},
  1943  	{4503599627370495.5, 4503599627370496}, // 1 bit fraction, rounding to 0 bit fraction
  1944  	{4503599627370497, 4503599627370497},   // large integer
  1945  }
  1946  
  1947  var vfsignbitSC = []float64{
  1948  	math.Inf(-1),
  1949  	math.Copysign(0, -1),
  1950  	0,
  1951  	math.Inf(1),
  1952  	math.NaN(),
  1953  }
  1954  
  1955  var signbitSC = []bool{
  1956  	true,
  1957  	true,
  1958  	false,
  1959  	false,
  1960  	false,
  1961  }
  1962  
  1963  var vfsinSC = []float64{
  1964  	math.Inf(-1),
  1965  	math.Copysign(0, -1),
  1966  	0,
  1967  	math.Inf(1),
  1968  	math.NaN(),
  1969  }
  1970  
  1971  var sinSC = []float64{
  1972  	math.NaN(),
  1973  	math.Copysign(0, -1),
  1974  	0,
  1975  	math.NaN(),
  1976  	math.NaN(),
  1977  }
  1978  
  1979  var vfsinhSC = []float64{
  1980  	math.Inf(-1),
  1981  	math.Copysign(0, -1),
  1982  	0,
  1983  	math.Inf(1),
  1984  	math.NaN(),
  1985  }
  1986  
  1987  var sinhSC = []float64{
  1988  	math.Inf(-1),
  1989  	math.Copysign(0, -1),
  1990  	0,
  1991  	math.Inf(1),
  1992  	math.NaN(),
  1993  }
  1994  
  1995  var vfsqrtSC = []float64{
  1996  	math.Inf(-1),
  1997  	-math.Pi,
  1998  	math.Copysign(0, -1),
  1999  	0,
  2000  	math.Inf(1),
  2001  	math.NaN(),
  2002  	math.Float64frombits(2), // subnormal; see https://golang.org/issue/13013
  2003  }
  2004  
  2005  var sqrtSC = []float64{
  2006  	math.NaN(),
  2007  	math.NaN(),
  2008  	math.Copysign(0, -1),
  2009  	0,
  2010  	math.Inf(1),
  2011  	math.NaN(),
  2012  	3.1434555694052576e-162,
  2013  }
  2014  
  2015  var vftanhSC = []float64{
  2016  	math.Inf(-1),
  2017  	math.Copysign(0, -1),
  2018  	0,
  2019  	math.Inf(1),
  2020  	math.NaN(),
  2021  }
  2022  
  2023  var tanhSC = []float64{
  2024  	-1,
  2025  	math.Copysign(0, -1),
  2026  	0,
  2027  	1,
  2028  	math.NaN(),
  2029  }
  2030  
  2031  var vfy0SC = []float64{
  2032  	math.Inf(-1),
  2033  	0,
  2034  	math.Inf(1),
  2035  	math.NaN(),
  2036  	-1,
  2037  }
  2038  
  2039  var y0SC = []float64{
  2040  	math.NaN(),
  2041  	math.Inf(-1),
  2042  	0,
  2043  	math.NaN(),
  2044  	math.NaN(),
  2045  }
  2046  
  2047  var y1SC = []float64{
  2048  	math.NaN(),
  2049  	math.Inf(-1),
  2050  	0,
  2051  	math.NaN(),
  2052  	math.NaN(),
  2053  }
  2054  
  2055  var y2SC = []float64{
  2056  	math.NaN(),
  2057  	math.Inf(-1),
  2058  	0,
  2059  	math.NaN(),
  2060  	math.NaN(),
  2061  }
  2062  
  2063  var yM3SC = []float64{
  2064  	math.NaN(),
  2065  	math.Inf(1),
  2066  	0,
  2067  	math.NaN(),
  2068  	math.NaN(),
  2069  }
  2070  
  2071  // arguments and expected results for boundary cases
  2072  const (
  2073  	SmallestNormalFloat64   = 2.2250738585072014e-308 // 2**-1022
  2074  	LargestSubnormalFloat64 = SmallestNormalFloat64 - math.SmallestNonzeroFloat64
  2075  )
  2076  
  2077  var vffrexpBC = []float64{
  2078  	SmallestNormalFloat64,
  2079  	LargestSubnormalFloat64,
  2080  	math.SmallestNonzeroFloat64,
  2081  	math.MaxFloat64,
  2082  	-SmallestNormalFloat64,
  2083  	-LargestSubnormalFloat64,
  2084  	-math.SmallestNonzeroFloat64,
  2085  	-math.MaxFloat64,
  2086  }
  2087  
  2088  var frexpBC = []fi{
  2089  	{0.5, -1021},
  2090  	{0.99999999999999978, -1022},
  2091  	{0.5, -1073},
  2092  	{0.99999999999999989, 1024},
  2093  	{-0.5, -1021},
  2094  	{-0.99999999999999978, -1022},
  2095  	{-0.5, -1073},
  2096  	{-0.99999999999999989, 1024},
  2097  }
  2098  
  2099  var vfldexpBC = []fi{
  2100  	{SmallestNormalFloat64, -52},
  2101  	{LargestSubnormalFloat64, -51},
  2102  	{math.SmallestNonzeroFloat64, 1074},
  2103  	{math.MaxFloat64, -(1023 + 1074)},
  2104  	{1, -1075},
  2105  	{-1, -1075},
  2106  	{1, 1024},
  2107  	{-1, 1024},
  2108  	{1.0000000000000002, -1075},
  2109  	{1, -1075},
  2110  }
  2111  
  2112  var ldexpBC = []float64{
  2113  	math.SmallestNonzeroFloat64,
  2114  	1e-323, // 2**-1073
  2115  	1,
  2116  	1e-323, // 2**-1073
  2117  	0,
  2118  	math.Copysign(0, -1),
  2119  	math.Inf(1),
  2120  	math.Inf(-1),
  2121  	math.SmallestNonzeroFloat64,
  2122  	0,
  2123  }
  2124  
  2125  var logbBC = []float64{
  2126  	-1022,
  2127  	-1023,
  2128  	-1074,
  2129  	1023,
  2130  	-1022,
  2131  	-1023,
  2132  	-1074,
  2133  	1023,
  2134  }
  2135  
  2136  // Test cases were generated with Berkeley TestFloat-3e/testfloat_gen.
  2137  // http://www.jhauser.us/arithmetic/TestFloat.html.
  2138  // The default rounding mode is selected (nearest/even), and exception flags are ignored.
  2139  var fmaC = []struct{ x, y, z, want float64 }{
  2140  	// Large exponent spread
  2141  	{-3.999999999999087, -1.1123914289620494e-16, -7.999877929687506, -7.999877929687505},
  2142  	{-262112.0000004768, -0.06251525855623184, 1.1102230248837136e-16, 16385.99945072085},
  2143  	{-6.462348523533467e-27, -2.3763644720331857e-211, 4.000000000931324, 4.000000000931324},
  2144  
  2145  	// Effective addition
  2146  	{-2.0000000037252907, 6.7904383376e-313, -3.3951933161e-313, -1.697607001654e-312},
  2147  	{-0.12499999999999999, 512.007568359375, -1.4193627164960366e-16, -64.00094604492188},
  2148  	{-2.7550648847397148e-39, -3.4028301595800694e+38, 0.9960937495343386, 1.9335955376735676},
  2149  	{5.723369164769208e+24, 3.8149300927159385e-06, 1.84489958778182e+19, 4.028324913621874e+19},
  2150  	{-0.4843749999990904, -3.6893487872543293e+19, 9.223653786709391e+18, 2.7093936974938993e+19},
  2151  	{-3.8146972665201165e-06, 4.2949672959999385e+09, -2.2204460489938386e-16, -16384.000003844263},
  2152  	{6.98156394130982e-309, -1.1072962560000002e+09, -4.4414561548793455e-308, -7.73065965765153e-300},
  2153  
  2154  	// Effective subtraction
  2155  	{5e-324, 4.5, -2e-323, 0},
  2156  	{5e-324, 7, -3.5e-323, 0},
  2157  	{5e-324, 0.5000000000000001, -5e-324, math.Copysign(0, -1)},
  2158  	{-2.1240680525e-314, -1.233647078189316e+308, -0.25781249999954525, -0.25780987964919844},
  2159  	{8.579992955364441e-308, 0.6037391876780558, -4.4501307410480706e-308, 7.29947236107098e-309},
  2160  	{-4.450143471986689e-308, -0.9960937499927239, -4.450419332475649e-308, -1.7659233458788e-310},
  2161  	{1.4932076393918112, -2.2248022430460833e-308, 4.449875571054211e-308, 1.127783865601762e-308},
  2162  
  2163  	// Overflow
  2164  	{-2.288020632214759e+38, -8.98846570988901e+307, 1.7696041796300924e+308, math.Inf(0)},
  2165  	{1.4888652783208255e+308, -9.007199254742012e+15, -6.807282911929205e+38, math.Inf(-1)},
  2166  	{9.142703268902826e+192, -1.3504889569802838e+296, -1.9082200803806996e-89, math.Inf(-1)},
  2167  
  2168  	// Finite x and y, but non-finite z.
  2169  	{31.99218749627471, -1.7976930544991702e+308, math.Inf(0), math.Inf(0)},
  2170  	{-1.7976931281784667e+308, -2.0009765625002265, math.Inf(-1), math.Inf(-1)},
  2171  
  2172  	// Special
  2173  	{0, 0, 0, 0},
  2174  	{math.Copysign(0, -1), 0, 0, 0},
  2175  	{0, 0, math.Copysign(0, -1), 0},
  2176  	{math.Copysign(0, -1), 0, math.Copysign(0, -1), math.Copysign(0, -1)},
  2177  	{-1.1754226043408471e-38, math.NaN(), math.Inf(0), math.NaN()},
  2178  	{0, 0, 2.22507385643494e-308, 2.22507385643494e-308},
  2179  	{-8.65697792e+09, math.NaN(), -7.516192799999999e+09, math.NaN()},
  2180  	{-0.00012207403779029757, 3.221225471996093e+09, math.NaN(), math.NaN()},
  2181  	{math.Inf(-1), 0.1252441407414153, -1.387184532981584e-76, math.Inf(-1)},
  2182  	{math.Inf(0), 1.525878907671432e-05, -9.214364835452549e+18, math.Inf(0)},
  2183  
  2184  	// Random
  2185  	{0.1777916152213626, -32.000015266239636, -2.2204459148334633e-16, -5.689334401293007},
  2186  	{-2.0816681711722314e-16, -0.4997558592585846, -0.9465627129124969, -0.9465627129124968},
  2187  	{-1.9999997615814211, 1.8518819259933516e+19, 16.874999999999996, -3.703763410463646e+19},
  2188  	{-0.12499994039717421, 32767.99999976135, -2.0752587082923246e+19, -2.075258708292325e+19},
  2189  	{7.705600568510257e-34, -1.801432979000528e+16, -0.17224197722973714, -0.17224197722973716},
  2190  	{3.8988133103758913e-308, -0.9848632812499999, 3.893879244098556e-308, 5.40811742605814e-310},
  2191  	{-0.012651981190687427, 6.911985574912436e+38, 6.669240527007144e+18, -8.745031148409496e+36},
  2192  	{4.612811918325842e+18, 1.4901161193847641e-08, 2.6077032311277997e-08, 6.873625395187494e+10},
  2193  	{-9.094947033611148e-13, 4.450691014249257e-308, 2.086006742350485e-308, 2.086006742346437e-308},
  2194  	{-7.751454006381804e-05, 5.588653777189071e-308, -2.2207280111272877e-308, -2.2211612130544025e-308},
  2195  
  2196  	// Issue #61130
  2197  	{-1, 1, 1, 0},
  2198  	{1, 1, -1, 0},
  2199  }
  2200  
  2201  var sqrt32 = []float32{
  2202  	0,
  2203  	float32(math.Copysign(0, -1)),
  2204  	float32(math.NaN()),
  2205  	float32(math.Inf(1)),
  2206  	float32(math.Inf(-1)),
  2207  	1,
  2208  	2,
  2209  	-2,
  2210  	4.9790119248836735e+00,
  2211  	7.7388724745781045e+00,
  2212  	-2.7688005719200159e-01,
  2213  	-5.0106036182710749e+00,
  2214  }
  2215  
  2216  func tolerance(a, b, e float64) bool {
  2217  	// Multiplying by e here can underflow denormal values to zero.
  2218  	// Check a==b so that at least if a and b are small and identical
  2219  	// we say they match.
  2220  	if a == b {
  2221  		return true
  2222  	}
  2223  	d := a - b
  2224  	if d < 0 {
  2225  		d = -d
  2226  	}
  2227  
  2228  	// note: b is correct (expected) value, a is actual value.
  2229  	// make error tolerance a fraction of b, not a.
  2230  	if b != 0 {
  2231  		e = e * b
  2232  		if e < 0 {
  2233  			e = -e
  2234  		}
  2235  	}
  2236  	return d < e
  2237  }
  2238  func closeFloat64(a, b float64) bool { return tolerance(a, b, 1e-14) }
  2239  func veryclose(a, b float64) bool    { return tolerance(a, b, 4e-16) }
  2240  func soclose(a, b, e float64) bool   { return tolerance(a, b, e) }
  2241  func alike(a, b float64) bool {
  2242  	switch {
  2243  	case math.IsNaN(a) && math.IsNaN(b):
  2244  		return true
  2245  	case a == b:
  2246  		return math.Signbit(a) == math.Signbit(b)
  2247  	}
  2248  	return false
  2249  }
  2250  
  2251  func TestNaN(t *testing.T) {
  2252  	f64 := math.NaN()
  2253  	if f64 == f64 {
  2254  		t.Fatalf("math.NaN() returns %g, expected NaN", f64)
  2255  	}
  2256  	f32 := float32(f64)
  2257  	if f32 == f32 {
  2258  		t.Fatalf("float32(math.NaN()) is %g, expected NaN", f32)
  2259  	}
  2260  }
  2261  
  2262  func TestAcos(t *testing.T) {
  2263  	for i := 0; i < len(vf); i++ {
  2264  		a := vf[i] / 10
  2265  		if f := math.Acos(a); !closeFloat64(acos[i], f) {
  2266  			t.Errorf("math.Acos(%g) = %g, want %g", a, f, acos[i])
  2267  		}
  2268  	}
  2269  	for i := 0; i < len(vfacosSC); i++ {
  2270  		if f := math.Acos(vfacosSC[i]); !alike(acosSC[i], f) {
  2271  			t.Errorf("math.Acos(%g) = %g, want %g", vfacosSC[i], f, acosSC[i])
  2272  		}
  2273  	}
  2274  }
  2275  
  2276  func TestAcosh(t *testing.T) {
  2277  	for i := 0; i < len(vf); i++ {
  2278  		a := 1 + math.Abs(vf[i])
  2279  		if f := math.Acosh(a); !veryclose(acosh[i], f) {
  2280  			t.Errorf("math.Acosh(%g) = %g, want %g", a, f, acosh[i])
  2281  		}
  2282  	}
  2283  	for i := 0; i < len(vfacoshSC); i++ {
  2284  		if f := math.Acosh(vfacoshSC[i]); !alike(acoshSC[i], f) {
  2285  			t.Errorf("math.Acosh(%g) = %g, want %g", vfacoshSC[i], f, acoshSC[i])
  2286  		}
  2287  	}
  2288  }
  2289  
  2290  func TestAsin(t *testing.T) {
  2291  	for i := 0; i < len(vf); i++ {
  2292  		a := vf[i] / 10
  2293  		if f := math.Asin(a); !veryclose(asin[i], f) {
  2294  			t.Errorf("math.Asin(%g) = %g, want %g", a, f, asin[i])
  2295  		}
  2296  	}
  2297  	for i := 0; i < len(vfasinSC); i++ {
  2298  		if f := math.Asin(vfasinSC[i]); !alike(asinSC[i], f) {
  2299  			t.Errorf("math.Asin(%g) = %g, want %g", vfasinSC[i], f, asinSC[i])
  2300  		}
  2301  	}
  2302  }
  2303  
  2304  func TestAsinh(t *testing.T) {
  2305  	for i := 0; i < len(vf); i++ {
  2306  		if f := math.Asinh(vf[i]); !veryclose(asinh[i], f) {
  2307  			t.Errorf("math.Asinh(%g) = %g, want %g", vf[i], f, asinh[i])
  2308  		}
  2309  	}
  2310  	for i := 0; i < len(vfasinhSC); i++ {
  2311  		if f := math.Asinh(vfasinhSC[i]); !alike(asinhSC[i], f) {
  2312  			t.Errorf("math.Asinh(%g) = %g, want %g", vfasinhSC[i], f, asinhSC[i])
  2313  		}
  2314  	}
  2315  }
  2316  
  2317  func TestAtan(t *testing.T) {
  2318  	for i := 0; i < len(vf); i++ {
  2319  		if f := math.Atan(vf[i]); !veryclose(atan[i], f) {
  2320  			t.Errorf("math.Atan(%g) = %g, want %g", vf[i], f, atan[i])
  2321  		}
  2322  	}
  2323  	for i := 0; i < len(vfatanSC); i++ {
  2324  		if f := math.Atan(vfatanSC[i]); !alike(atanSC[i], f) {
  2325  			t.Errorf("math.Atan(%g) = %g, want %g", vfatanSC[i], f, atanSC[i])
  2326  		}
  2327  	}
  2328  }
  2329  
  2330  func TestAtanh(t *testing.T) {
  2331  	for i := 0; i < len(vf); i++ {
  2332  		a := vf[i] / 10
  2333  		if f := math.Atanh(a); !veryclose(atanh[i], f) {
  2334  			t.Errorf("math.Atanh(%g) = %g, want %g", a, f, atanh[i])
  2335  		}
  2336  	}
  2337  	for i := 0; i < len(vfatanhSC); i++ {
  2338  		if f := math.Atanh(vfatanhSC[i]); !alike(atanhSC[i], f) {
  2339  			t.Errorf("math.Atanh(%g) = %g, want %g", vfatanhSC[i], f, atanhSC[i])
  2340  		}
  2341  	}
  2342  }
  2343  
  2344  func TestAtan2(t *testing.T) {
  2345  	for i := 0; i < len(vf); i++ {
  2346  		if f := math.Atan2(10, vf[i]); !veryclose(atan2[i], f) {
  2347  			t.Errorf("math.Atan2(10, %g) = %g, want %g", vf[i], f, atan2[i])
  2348  		}
  2349  	}
  2350  	for i := 0; i < len(vfatan2SC); i++ {
  2351  		if f := math.Atan2(vfatan2SC[i][0], vfatan2SC[i][1]); !alike(atan2SC[i], f) {
  2352  			t.Errorf("math.Atan2(%g, %g) = %g, want %g", vfatan2SC[i][0], vfatan2SC[i][1], f, atan2SC[i])
  2353  		}
  2354  	}
  2355  }
  2356  
  2357  func TestCbrt(t *testing.T) {
  2358  	for i := 0; i < len(vf); i++ {
  2359  		if f := math.Cbrt(vf[i]); !veryclose(cbrt[i], f) {
  2360  			t.Errorf("math.Cbrt(%g) = %g, want %g", vf[i], f, cbrt[i])
  2361  		}
  2362  	}
  2363  	for i := 0; i < len(vfcbrtSC); i++ {
  2364  		if f := math.Cbrt(vfcbrtSC[i]); !alike(cbrtSC[i], f) {
  2365  			t.Errorf("math.Cbrt(%g) = %g, want %g", vfcbrtSC[i], f, cbrtSC[i])
  2366  		}
  2367  	}
  2368  }
  2369  
  2370  func TestCeil(t *testing.T) {
  2371  	for i := 0; i < len(vf); i++ {
  2372  		if f := math.Ceil(vf[i]); !alike(ceil[i], f) {
  2373  			t.Errorf("math.Ceil(%g) = %g, want %g", vf[i], f, ceil[i])
  2374  		}
  2375  	}
  2376  	for i := 0; i < len(vfceilSC); i++ {
  2377  		if f := math.Ceil(vfceilSC[i]); !alike(ceilSC[i], f) {
  2378  			t.Errorf("math.Ceil(%g) = %g, want %g", vfceilSC[i], f, ceilSC[i])
  2379  		}
  2380  	}
  2381  }
  2382  
  2383  func TestCopysign(t *testing.T) {
  2384  	for i := 0; i < len(vf); i++ {
  2385  		if f := math.Copysign(vf[i], -1); copysign[i] != f {
  2386  			t.Errorf("math.Copysign(%g, -1) = %g, want %g", vf[i], f, copysign[i])
  2387  		}
  2388  	}
  2389  	for i := 0; i < len(vf); i++ {
  2390  		if f := math.Copysign(vf[i], 1); -copysign[i] != f {
  2391  			t.Errorf("math.Copysign(%g, 1) = %g, want %g", vf[i], f, -copysign[i])
  2392  		}
  2393  	}
  2394  	for i := 0; i < len(vfcopysignSC); i++ {
  2395  		if f := math.Copysign(vfcopysignSC[i], -1); !alike(copysignSC[i], f) {
  2396  			t.Errorf("math.Copysign(%g, -1) = %g, want %g", vfcopysignSC[i], f, copysignSC[i])
  2397  		}
  2398  	}
  2399  }
  2400  
  2401  func TestCos(t *testing.T) {
  2402  	for i := 0; i < len(vf); i++ {
  2403  		if f := math.Cos(vf[i]); !veryclose(cos[i], f) {
  2404  			t.Errorf("math.Cos(%g) = %g, want %g", vf[i], f, cos[i])
  2405  		}
  2406  	}
  2407  	for i := 0; i < len(vfcosSC); i++ {
  2408  		if f := math.Cos(vfcosSC[i]); !alike(cosSC[i], f) {
  2409  			t.Errorf("math.Cos(%g) = %g, want %g", vfcosSC[i], f, cosSC[i])
  2410  		}
  2411  	}
  2412  }
  2413  
  2414  func TestCosh(t *testing.T) {
  2415  	for i := 0; i < len(vf); i++ {
  2416  		if f := math.Cosh(vf[i]); !closeFloat64(cosh[i], f) {
  2417  			t.Errorf("math.Cosh(%g) = %g, want %g", vf[i], f, cosh[i])
  2418  		}
  2419  	}
  2420  	for i := 0; i < len(vfcoshSC); i++ {
  2421  		if f := math.Cosh(vfcoshSC[i]); !alike(coshSC[i], f) {
  2422  			t.Errorf("math.Cosh(%g) = %g, want %g", vfcoshSC[i], f, coshSC[i])
  2423  		}
  2424  	}
  2425  }
  2426  
  2427  func TestErf(t *testing.T) {
  2428  	for i := 0; i < len(vf); i++ {
  2429  		a := vf[i] / 10
  2430  		if f := math.Erf(a); !veryclose(erf[i], f) {
  2431  			t.Errorf("math.Erf(%g) = %g, want %g", a, f, erf[i])
  2432  		}
  2433  	}
  2434  	for i := 0; i < len(vferfSC); i++ {
  2435  		if f := math.Erf(vferfSC[i]); !alike(erfSC[i], f) {
  2436  			t.Errorf("math.Erf(%g) = %g, want %g", vferfSC[i], f, erfSC[i])
  2437  		}
  2438  	}
  2439  }
  2440  
  2441  func TestErfc(t *testing.T) {
  2442  	for i := 0; i < len(vf); i++ {
  2443  		a := vf[i] / 10
  2444  		if f := math.Erfc(a); !veryclose(erfc[i], f) {
  2445  			t.Errorf("math.Erfc(%g) = %g, want %g", a, f, erfc[i])
  2446  		}
  2447  	}
  2448  	for i := 0; i < len(vferfcSC); i++ {
  2449  		if f := math.Erfc(vferfcSC[i]); !alike(erfcSC[i], f) {
  2450  			t.Errorf("math.Erfc(%g) = %g, want %g", vferfcSC[i], f, erfcSC[i])
  2451  		}
  2452  	}
  2453  }
  2454  
  2455  func TestErfinv(t *testing.T) {
  2456  	for i := 0; i < len(vf); i++ {
  2457  		a := vf[i] / 10
  2458  		if f := math.Erfinv(a); !veryclose(erfinv[i], f) {
  2459  			t.Errorf("math.Erfinv(%g) = %g, want %g", a, f, erfinv[i])
  2460  		}
  2461  	}
  2462  	for i := 0; i < len(vferfinvSC); i++ {
  2463  		if f := math.Erfinv(vferfinvSC[i]); !alike(erfinvSC[i], f) {
  2464  			t.Errorf("math.Erfinv(%g) = %g, want %g", vferfinvSC[i], f, erfinvSC[i])
  2465  		}
  2466  	}
  2467  	for x := -0.9; x <= 0.90; x += 1e-2 {
  2468  		if f := math.Erf(math.Erfinv(x)); !closeFloat64(x, f) {
  2469  			t.Errorf("math.Erf(math.Erfinv(%g)) = %g, want %g", x, f, x)
  2470  		}
  2471  	}
  2472  	for x := -0.9; x <= 0.90; x += 1e-2 {
  2473  		if f := math.Erfinv(math.Erf(x)); !closeFloat64(x, f) {
  2474  			t.Errorf("math.Erfinv(math.Erf(%g)) = %g, want %g", x, f, x)
  2475  		}
  2476  	}
  2477  }
  2478  
  2479  func TestErfcinv(t *testing.T) {
  2480  	for i := 0; i < len(vf); i++ {
  2481  		a := 1.0 - (vf[i] / 10)
  2482  		if f := math.Erfcinv(a); !veryclose(erfinv[i], f) {
  2483  			t.Errorf("math.Erfcinv(%g) = %g, want %g", a, f, erfinv[i])
  2484  		}
  2485  	}
  2486  	for i := 0; i < len(vferfcinvSC); i++ {
  2487  		if f := math.Erfcinv(vferfcinvSC[i]); !alike(erfcinvSC[i], f) {
  2488  			t.Errorf("math.Erfcinv(%g) = %g, want %g", vferfcinvSC[i], f, erfcinvSC[i])
  2489  		}
  2490  	}
  2491  	for x := 0.1; x <= 1.9; x += 1e-2 {
  2492  		if f := math.Erfc(math.Erfcinv(x)); !closeFloat64(x, f) {
  2493  			t.Errorf("math.Erfc(math.Erfcinv(%g)) = %g, want %g", x, f, x)
  2494  		}
  2495  	}
  2496  	for x := 0.1; x <= 1.9; x += 1e-2 {
  2497  		if f := math.Erfcinv(math.Erfc(x)); !closeFloat64(x, f) {
  2498  			t.Errorf("math.Erfcinv(math.Erfc(%g)) = %g, want %g", x, f, x)
  2499  		}
  2500  	}
  2501  }
  2502  
  2503  func TestExp(t *testing.T) {
  2504  	testExp(t, math.Exp, "Exp")
  2505  	testExp(t, math.ExpGo, "ExpGo")
  2506  }
  2507  
  2508  func testExp(t *testing.T, Exp func(float64) float64, name string) {
  2509  	for i := 0; i < len(vf); i++ {
  2510  		if f := math.Exp(vf[i]); !veryclose(exp[i], f) {
  2511  			t.Errorf("%s(%g) = %g, want %g", name, vf[i], f, exp[i])
  2512  		}
  2513  	}
  2514  	for i := 0; i < len(vfexpSC); i++ {
  2515  		if f := math.Exp(vfexpSC[i]); !alike(expSC[i], f) {
  2516  			t.Errorf("%s(%g) = %g, want %g", name, vfexpSC[i], f, expSC[i])
  2517  		}
  2518  	}
  2519  }
  2520  
  2521  func TestExpm1(t *testing.T) {
  2522  	for i := 0; i < len(vf); i++ {
  2523  		a := vf[i] / 100
  2524  		if f := math.Expm1(a); !veryclose(expm1[i], f) {
  2525  			t.Errorf("math.Expm1(%g) = %g, want %g", a, f, expm1[i])
  2526  		}
  2527  	}
  2528  	for i := 0; i < len(vf); i++ {
  2529  		a := vf[i] * 10
  2530  		if f := math.Expm1(a); !closeFloat64(expm1Large[i], f) {
  2531  			t.Errorf("math.Expm1(%g) = %g, want %g", a, f, expm1Large[i])
  2532  		}
  2533  	}
  2534  	for i := 0; i < len(vfexpm1SC); i++ {
  2535  		if f := math.Expm1(vfexpm1SC[i]); !alike(expm1SC[i], f) {
  2536  			t.Errorf("math.Expm1(%g) = %g, want %g", vfexpm1SC[i], f, expm1SC[i])
  2537  		}
  2538  	}
  2539  }
  2540  
  2541  func TestExp2(t *testing.T) {
  2542  	testExp2(t, math.Exp2, "Exp2")
  2543  	testExp2(t, math.Exp2Go, "Exp2Go")
  2544  }
  2545  
  2546  func testExp2(t *testing.T, Exp2 func(float64) float64, name string) {
  2547  	for i := 0; i < len(vf); i++ {
  2548  		if f := math.Exp2(vf[i]); !closeFloat64(exp2[i], f) {
  2549  			t.Errorf("%s(%g) = %g, want %g", name, vf[i], f, exp2[i])
  2550  		}
  2551  	}
  2552  	for i := 0; i < len(vfexp2SC); i++ {
  2553  		if f := math.Exp2(vfexp2SC[i]); !alike(exp2SC[i], f) {
  2554  			t.Errorf("%s(%g) = %g, want %g", name, vfexp2SC[i], f, exp2SC[i])
  2555  		}
  2556  	}
  2557  	for n := -1074; n < 1024; n++ {
  2558  		f := math.Exp2(float64(n))
  2559  		vf := math.Ldexp(1, n)
  2560  		if f != vf {
  2561  			t.Errorf("%s(%d) = %g, want %g", name, n, f, vf)
  2562  		}
  2563  	}
  2564  }
  2565  
  2566  func TestAbs(t *testing.T) {
  2567  	for i := 0; i < len(vf); i++ {
  2568  		if f := math.Abs(vf[i]); fabs[i] != f {
  2569  			t.Errorf("math.Abs(%g) = %g, want %g", vf[i], f, fabs[i])
  2570  		}
  2571  	}
  2572  	for i := 0; i < len(vffabsSC); i++ {
  2573  		if f := math.Abs(vffabsSC[i]); !alike(fabsSC[i], f) {
  2574  			t.Errorf("math.Abs(%g) = %g, want %g", vffabsSC[i], f, fabsSC[i])
  2575  		}
  2576  	}
  2577  }
  2578  
  2579  func TestDim(t *testing.T) {
  2580  	for i := 0; i < len(vf); i++ {
  2581  		if f := math.Dim(vf[i], 0); fdim[i] != f {
  2582  			t.Errorf("math.Dim(%g, %g) = %g, want %g", vf[i], 0.0, f, fdim[i])
  2583  		}
  2584  	}
  2585  	for i := 0; i < len(vffdimSC); i++ {
  2586  		if f := math.Dim(vffdimSC[i][0], vffdimSC[i][1]); !alike(fdimSC[i], f) {
  2587  			t.Errorf("math.Dim(%g, %g) = %g, want %g", vffdimSC[i][0], vffdimSC[i][1], f, fdimSC[i])
  2588  		}
  2589  	}
  2590  	for i := 0; i < len(vffdim2SC); i++ {
  2591  		if f := math.Dim(vffdim2SC[i][0], vffdim2SC[i][1]); !alike(fdimSC[i], f) {
  2592  			t.Errorf("math.Dim(%g, %g) = %g, want %g", vffdim2SC[i][0], vffdim2SC[i][1], f, fdimSC[i])
  2593  		}
  2594  	}
  2595  }
  2596  
  2597  func TestFloor(t *testing.T) {
  2598  	for i := 0; i < len(vf); i++ {
  2599  		if f := math.Floor(vf[i]); !alike(floor[i], f) {
  2600  			t.Errorf("math.Floor(%g) = %g, want %g", vf[i], f, floor[i])
  2601  		}
  2602  	}
  2603  	for i := 0; i < len(vfceilSC); i++ {
  2604  		if f := math.Floor(vfceilSC[i]); !alike(ceilSC[i], f) {
  2605  			t.Errorf("math.Floor(%g) = %g, want %g", vfceilSC[i], f, ceilSC[i])
  2606  		}
  2607  	}
  2608  }
  2609  
  2610  func TestMax(t *testing.T) {
  2611  	for i := 0; i < len(vf); i++ {
  2612  		if f := math.Max(vf[i], ceil[i]); ceil[i] != f {
  2613  			t.Errorf("math.Max(%g, %g) = %g, want %g", vf[i], ceil[i], f, ceil[i])
  2614  		}
  2615  	}
  2616  	for i := 0; i < len(vffdimSC); i++ {
  2617  		if f := math.Max(vffdimSC[i][0], vffdimSC[i][1]); !alike(fmaxSC[i], f) {
  2618  			t.Errorf("math.Max(%g, %g) = %g, want %g", vffdimSC[i][0], vffdimSC[i][1], f, fmaxSC[i])
  2619  		}
  2620  	}
  2621  	for i := 0; i < len(vffdim2SC); i++ {
  2622  		if f := math.Max(vffdim2SC[i][0], vffdim2SC[i][1]); !alike(fmaxSC[i], f) {
  2623  			t.Errorf("math.Max(%g, %g) = %g, want %g", vffdim2SC[i][0], vffdim2SC[i][1], f, fmaxSC[i])
  2624  		}
  2625  	}
  2626  }
  2627  
  2628  func TestMin(t *testing.T) {
  2629  	for i := 0; i < len(vf); i++ {
  2630  		if f := math.Min(vf[i], floor[i]); floor[i] != f {
  2631  			t.Errorf("math.Min(%g, %g) = %g, want %g", vf[i], floor[i], f, floor[i])
  2632  		}
  2633  	}
  2634  	for i := 0; i < len(vffdimSC); i++ {
  2635  		if f := math.Min(vffdimSC[i][0], vffdimSC[i][1]); !alike(fminSC[i], f) {
  2636  			t.Errorf("math.Min(%g, %g) = %g, want %g", vffdimSC[i][0], vffdimSC[i][1], f, fminSC[i])
  2637  		}
  2638  	}
  2639  	for i := 0; i < len(vffdim2SC); i++ {
  2640  		if f := math.Min(vffdim2SC[i][0], vffdim2SC[i][1]); !alike(fminSC[i], f) {
  2641  			t.Errorf("math.Min(%g, %g) = %g, want %g", vffdim2SC[i][0], vffdim2SC[i][1], f, fminSC[i])
  2642  		}
  2643  	}
  2644  }
  2645  
  2646  func TestMod(t *testing.T) {
  2647  	for i := 0; i < len(vf); i++ {
  2648  		if f := math.Mod(10, vf[i]); fmod[i] != f {
  2649  			t.Errorf("math.Mod(10, %g) = %g, want %g", vf[i], f, fmod[i])
  2650  		}
  2651  	}
  2652  	for i := 0; i < len(vffmodSC); i++ {
  2653  		if f := math.Mod(vffmodSC[i][0], vffmodSC[i][1]); !alike(fmodSC[i], f) {
  2654  			t.Errorf("math.Mod(%g, %g) = %g, want %g", vffmodSC[i][0], vffmodSC[i][1], f, fmodSC[i])
  2655  		}
  2656  	}
  2657  	// verify precision of result for extreme inputs
  2658  	if f := math.Mod(5.9790119248836734e+200, 1.1258465975523544); 0.6447968302508578 != f {
  2659  		t.Errorf("math.Remainder(5.9790119248836734e+200, 1.1258465975523544) = %g, want 0.6447968302508578", f)
  2660  	}
  2661  }
  2662  
  2663  func TestFrexp(t *testing.T) {
  2664  	for i := 0; i < len(vf); i++ {
  2665  		if f, j := math.Frexp(vf[i]); !veryclose(frexp[i].f, f) || frexp[i].i != j {
  2666  			t.Errorf("math.Frexp(%g) = %g, %d, want %g, %d", vf[i], f, j, frexp[i].f, frexp[i].i)
  2667  		}
  2668  	}
  2669  	for i := 0; i < len(vffrexpSC); i++ {
  2670  		if f, j := math.Frexp(vffrexpSC[i]); !alike(frexpSC[i].f, f) || frexpSC[i].i != j {
  2671  			t.Errorf("math.Frexp(%g) = %g, %d, want %g, %d", vffrexpSC[i], f, j, frexpSC[i].f, frexpSC[i].i)
  2672  		}
  2673  	}
  2674  	for i := 0; i < len(vffrexpBC); i++ {
  2675  		if f, j := math.Frexp(vffrexpBC[i]); !alike(frexpBC[i].f, f) || frexpBC[i].i != j {
  2676  			t.Errorf("math.Frexp(%g) = %g, %d, want %g, %d", vffrexpBC[i], f, j, frexpBC[i].f, frexpBC[i].i)
  2677  		}
  2678  	}
  2679  }
  2680  
  2681  func TestGamma(t *testing.T) {
  2682  	for i := 0; i < len(vf); i++ {
  2683  		if f := math.Gamma(vf[i]); !closeFloat64(gamma[i], f) {
  2684  			t.Errorf("math.Gamma(%g) = %g, want %g", vf[i], f, gamma[i])
  2685  		}
  2686  	}
  2687  	for _, g := range vfgamma {
  2688  		f := math.Gamma(g[0])
  2689  		var ok bool
  2690  		if math.IsNaN(g[1]) || math.IsInf(g[1], 0) || g[1] == 0 || f == 0 {
  2691  			ok = alike(g[1], f)
  2692  		} else if g[0] > -50 && g[0] <= 171 {
  2693  			ok = veryclose(g[1], f)
  2694  		} else {
  2695  			ok = closeFloat64(g[1], f)
  2696  		}
  2697  		if !ok {
  2698  			t.Errorf("math.Gamma(%g) = %g, want %g", g[0], f, g[1])
  2699  		}
  2700  	}
  2701  }
  2702  
  2703  func TestHypot(t *testing.T) {
  2704  	for i := 0; i < len(vf); i++ {
  2705  		a := math.Abs(1e200 * tanh[i] * math.Sqrt(2))
  2706  		if f := math.Hypot(1e200*tanh[i], 1e200*tanh[i]); !veryclose(a, f) {
  2707  			t.Errorf("math.Hypot(%g, %g) = %g, want %g", 1e200*tanh[i], 1e200*tanh[i], f, a)
  2708  		}
  2709  	}
  2710  	for i := 0; i < len(vfhypotSC); i++ {
  2711  		if f := math.Hypot(vfhypotSC[i][0], vfhypotSC[i][1]); !alike(hypotSC[i], f) {
  2712  			t.Errorf("math.Hypot(%g, %g) = %g, want %g", vfhypotSC[i][0], vfhypotSC[i][1], f, hypotSC[i])
  2713  		}
  2714  	}
  2715  }
  2716  
  2717  func TestHypotGo(t *testing.T) {
  2718  	for i := 0; i < len(vf); i++ {
  2719  		a := math.Abs(1e200 * tanh[i] * math.Sqrt(2))
  2720  		if f := math.HypotGo(1e200*tanh[i], 1e200*tanh[i]); !veryclose(a, f) {
  2721  			t.Errorf("math.HypotGo(%g, %g) = %g, want %g", 1e200*tanh[i], 1e200*tanh[i], f, a)
  2722  		}
  2723  	}
  2724  	for i := 0; i < len(vfhypotSC); i++ {
  2725  		if f := math.HypotGo(vfhypotSC[i][0], vfhypotSC[i][1]); !alike(hypotSC[i], f) {
  2726  			t.Errorf("math.HypotGo(%g, %g) = %g, want %g", vfhypotSC[i][0], vfhypotSC[i][1], f, hypotSC[i])
  2727  		}
  2728  	}
  2729  }
  2730  
  2731  func TestIlogb(t *testing.T) {
  2732  	for i := 0; i < len(vf); i++ {
  2733  		a := frexp[i].i - 1 // adjust because fr in the interval [½, 1)
  2734  		if e := math.Ilogb(vf[i]); a != e {
  2735  			t.Errorf("math.Ilogb(%g) = %d, want %d", vf[i], e, a)
  2736  		}
  2737  	}
  2738  	for i := 0; i < len(vflogbSC); i++ {
  2739  		if e := math.Ilogb(vflogbSC[i]); ilogbSC[i] != e {
  2740  			t.Errorf("math.Ilogb(%g) = %d, want %d", vflogbSC[i], e, ilogbSC[i])
  2741  		}
  2742  	}
  2743  	for i := 0; i < len(vffrexpBC); i++ {
  2744  		if e := math.Ilogb(vffrexpBC[i]); int(logbBC[i]) != e {
  2745  			t.Errorf("math.Ilogb(%g) = %d, want %d", vffrexpBC[i], e, int(logbBC[i]))
  2746  		}
  2747  	}
  2748  }
  2749  
  2750  func TestJ0(t *testing.T) {
  2751  	for i := 0; i < len(vf); i++ {
  2752  		if f := math.J0(vf[i]); !soclose(j0[i], f, 4e-14) {
  2753  			t.Errorf("math.J0(%g) = %g, want %g", vf[i], f, j0[i])
  2754  		}
  2755  	}
  2756  	for i := 0; i < len(vfj0SC); i++ {
  2757  		if f := math.J0(vfj0SC[i]); !alike(j0SC[i], f) {
  2758  			t.Errorf("math.J0(%g) = %g, want %g", vfj0SC[i], f, j0SC[i])
  2759  		}
  2760  	}
  2761  }
  2762  
  2763  func TestJ1(t *testing.T) {
  2764  	for i := 0; i < len(vf); i++ {
  2765  		if f := math.J1(vf[i]); !closeFloat64(j1[i], f) {
  2766  			t.Errorf("math.J1(%g) = %g, want %g", vf[i], f, j1[i])
  2767  		}
  2768  	}
  2769  	for i := 0; i < len(vfj0SC); i++ {
  2770  		if f := math.J1(vfj0SC[i]); !alike(j1SC[i], f) {
  2771  			t.Errorf("math.J1(%g) = %g, want %g", vfj0SC[i], f, j1SC[i])
  2772  		}
  2773  	}
  2774  }
  2775  
  2776  func TestJn(t *testing.T) {
  2777  	for i := 0; i < len(vf); i++ {
  2778  		if f := math.Jn(2, vf[i]); !closeFloat64(j2[i], f) {
  2779  			t.Errorf("math.Jn(2, %g) = %g, want %g", vf[i], f, j2[i])
  2780  		}
  2781  		if f := math.Jn(-3, vf[i]); !closeFloat64(jM3[i], f) {
  2782  			t.Errorf("math.Jn(-3, %g) = %g, want %g", vf[i], f, jM3[i])
  2783  		}
  2784  	}
  2785  	for i := 0; i < len(vfj0SC); i++ {
  2786  		if f := math.Jn(2, vfj0SC[i]); !alike(j2SC[i], f) {
  2787  			t.Errorf("math.Jn(2, %g) = %g, want %g", vfj0SC[i], f, j2SC[i])
  2788  		}
  2789  		if f := math.Jn(-3, vfj0SC[i]); !alike(jM3SC[i], f) {
  2790  			t.Errorf("math.Jn(-3, %g) = %g, want %g", vfj0SC[i], f, jM3SC[i])
  2791  		}
  2792  	}
  2793  }
  2794  
  2795  func TestLdexp(t *testing.T) {
  2796  	for i := 0; i < len(vf); i++ {
  2797  		if f := math.Ldexp(frexp[i].f, frexp[i].i); !veryclose(vf[i], f) {
  2798  			t.Errorf("math.Ldexp(%g, %d) = %g, want %g", frexp[i].f, frexp[i].i, f, vf[i])
  2799  		}
  2800  	}
  2801  	for i := 0; i < len(vffrexpSC); i++ {
  2802  		if f := math.Ldexp(frexpSC[i].f, frexpSC[i].i); !alike(vffrexpSC[i], f) {
  2803  			t.Errorf("math.Ldexp(%g, %d) = %g, want %g", frexpSC[i].f, frexpSC[i].i, f, vffrexpSC[i])
  2804  		}
  2805  	}
  2806  	for i := 0; i < len(vfldexpSC); i++ {
  2807  		if f := math.Ldexp(vfldexpSC[i].f, vfldexpSC[i].i); !alike(ldexpSC[i], f) {
  2808  			t.Errorf("math.Ldexp(%g, %d) = %g, want %g", vfldexpSC[i].f, vfldexpSC[i].i, f, ldexpSC[i])
  2809  		}
  2810  	}
  2811  	for i := 0; i < len(vffrexpBC); i++ {
  2812  		if f := math.Ldexp(frexpBC[i].f, frexpBC[i].i); !alike(vffrexpBC[i], f) {
  2813  			t.Errorf("math.Ldexp(%g, %d) = %g, want %g", frexpBC[i].f, frexpBC[i].i, f, vffrexpBC[i])
  2814  		}
  2815  	}
  2816  	for i := 0; i < len(vfldexpBC); i++ {
  2817  		if f := math.Ldexp(vfldexpBC[i].f, vfldexpBC[i].i); !alike(ldexpBC[i], f) {
  2818  			t.Errorf("math.Ldexp(%g, %d) = %g, want %g", vfldexpBC[i].f, vfldexpBC[i].i, f, ldexpBC[i])
  2819  		}
  2820  	}
  2821  }
  2822  
  2823  func TestLgamma(t *testing.T) {
  2824  	for i := 0; i < len(vf); i++ {
  2825  		if f, s := math.Lgamma(vf[i]); !closeFloat64(lgamma[i].f, f) || lgamma[i].i != s {
  2826  			t.Errorf("math.Lgamma(%g) = %g, %d, want %g, %d", vf[i], f, s, lgamma[i].f, lgamma[i].i)
  2827  		}
  2828  	}
  2829  	for i := 0; i < len(vflgammaSC); i++ {
  2830  		if f, s := math.Lgamma(vflgammaSC[i]); !alike(lgammaSC[i].f, f) || lgammaSC[i].i != s {
  2831  			t.Errorf("math.Lgamma(%g) = %g, %d, want %g, %d", vflgammaSC[i], f, s, lgammaSC[i].f, lgammaSC[i].i)
  2832  		}
  2833  	}
  2834  }
  2835  
  2836  func TestLog(t *testing.T) {
  2837  	for i := 0; i < len(vf); i++ {
  2838  		a := math.Abs(vf[i])
  2839  		if f := math.Log(a); log[i] != f {
  2840  			t.Errorf("math.Log(%g) = %g, want %g", a, f, log[i])
  2841  		}
  2842  	}
  2843  	if f := math.Log(10); f != math.Ln10 {
  2844  		t.Errorf("math.Log(%g) = %g, want %g", 10.0, f, math.Ln10)
  2845  	}
  2846  	for i := 0; i < len(vflogSC); i++ {
  2847  		if f := math.Log(vflogSC[i]); !alike(logSC[i], f) {
  2848  			t.Errorf("math.Log(%g) = %g, want %g", vflogSC[i], f, logSC[i])
  2849  		}
  2850  	}
  2851  }
  2852  
  2853  func TestLogb(t *testing.T) {
  2854  	for i := 0; i < len(vf); i++ {
  2855  		if f := math.Logb(vf[i]); logb[i] != f {
  2856  			t.Errorf("math.Logb(%g) = %g, want %g", vf[i], f, logb[i])
  2857  		}
  2858  	}
  2859  	for i := 0; i < len(vflogbSC); i++ {
  2860  		if f := math.Logb(vflogbSC[i]); !alike(logbSC[i], f) {
  2861  			t.Errorf("math.Logb(%g) = %g, want %g", vflogbSC[i], f, logbSC[i])
  2862  		}
  2863  	}
  2864  	for i := 0; i < len(vffrexpBC); i++ {
  2865  		if f := math.Logb(vffrexpBC[i]); !alike(logbBC[i], f) {
  2866  			t.Errorf("math.Logb(%g) = %g, want %g", vffrexpBC[i], f, logbBC[i])
  2867  		}
  2868  	}
  2869  }
  2870  
  2871  func TestLog10(t *testing.T) {
  2872  	for i := 0; i < len(vf); i++ {
  2873  		a := math.Abs(vf[i])
  2874  		if f := math.Log10(a); !veryclose(log10[i], f) {
  2875  			t.Errorf("math.Log10(%g) = %g, want %g", a, f, log10[i])
  2876  		}
  2877  	}
  2878  	if f := math.Log10(math.E); f != math.Log10E {
  2879  		t.Errorf("math.Log10(%g) = %g, want %g", math.E, f, math.Log10E)
  2880  	}
  2881  	for i := 0; i < len(vflogSC); i++ {
  2882  		if f := math.Log10(vflogSC[i]); !alike(logSC[i], f) {
  2883  			t.Errorf("math.Log10(%g) = %g, want %g", vflogSC[i], f, logSC[i])
  2884  		}
  2885  	}
  2886  }
  2887  
  2888  func TestLog1p(t *testing.T) {
  2889  	for i := 0; i < len(vf); i++ {
  2890  		a := vf[i] / 100
  2891  		if f := math.Log1p(a); !veryclose(log1p[i], f) {
  2892  			t.Errorf("math.Log1p(%g) = %g, want %g", a, f, log1p[i])
  2893  		}
  2894  	}
  2895  	a := 9.0
  2896  	if f := math.Log1p(a); f != math.Ln10 {
  2897  		t.Errorf("math.Log1p(%g) = %g, want %g", a, f, math.Ln10)
  2898  	}
  2899  	for i := 0; i < len(vflogSC); i++ {
  2900  		if f := math.Log1p(vflog1pSC[i]); !alike(log1pSC[i], f) {
  2901  			t.Errorf("math.Log1p(%g) = %g, want %g", vflog1pSC[i], f, log1pSC[i])
  2902  		}
  2903  	}
  2904  }
  2905  
  2906  func TestLog2(t *testing.T) {
  2907  	for i := 0; i < len(vf); i++ {
  2908  		a := math.Abs(vf[i])
  2909  		if f := math.Log2(a); !veryclose(log2[i], f) {
  2910  			t.Errorf("math.Log2(%g) = %g, want %g", a, f, log2[i])
  2911  		}
  2912  	}
  2913  	if f := math.Log2(math.E); f != math.Log2E {
  2914  		t.Errorf("math.Log2(%g) = %g, want %g", math.E, f, math.Log2E)
  2915  	}
  2916  	for i := 0; i < len(vflogSC); i++ {
  2917  		if f := math.Log2(vflogSC[i]); !alike(logSC[i], f) {
  2918  			t.Errorf("math.Log2(%g) = %g, want %g", vflogSC[i], f, logSC[i])
  2919  		}
  2920  	}
  2921  	for i := -1074; i <= 1023; i++ {
  2922  		f := math.Ldexp(1, i)
  2923  		l := math.Log2(f)
  2924  		if l != float64(i) {
  2925  			t.Errorf("math.Log2(2**%d) = %g, want %d", i, l, i)
  2926  		}
  2927  	}
  2928  }
  2929  
  2930  func TestModf(t *testing.T) {
  2931  	for i := 0; i < len(vf); i++ {
  2932  		if f, g := math.Modf(vf[i]); !veryclose(modf[i][0], f) || !veryclose(modf[i][1], g) {
  2933  			t.Errorf("math.Modf(%g) = %g, %g, want %g, %g", vf[i], f, g, modf[i][0], modf[i][1])
  2934  		}
  2935  	}
  2936  	for i := 0; i < len(vfmodfSC); i++ {
  2937  		if f, g := math.Modf(vfmodfSC[i]); !alike(modfSC[i][0], f) || !alike(modfSC[i][1], g) {
  2938  			t.Errorf("math.Modf(%g) = %g, %g, want %g, %g", vfmodfSC[i], f, g, modfSC[i][0], modfSC[i][1])
  2939  		}
  2940  	}
  2941  }
  2942  
  2943  func TestNextafter32(t *testing.T) {
  2944  	for i := 0; i < len(vf); i++ {
  2945  		vfi := float32(vf[i])
  2946  		if f := math.Nextafter32(vfi, 10); nextafter32[i] != f {
  2947  			t.Errorf("math.Nextafter32(%g, %g) = %g want %g", vfi, 10.0, f, nextafter32[i])
  2948  		}
  2949  	}
  2950  	for i := 0; i < len(vfnextafter32SC); i++ {
  2951  		if f := math.Nextafter32(vfnextafter32SC[i][0], vfnextafter32SC[i][1]); !alike(float64(nextafter32SC[i]), float64(f)) {
  2952  			t.Errorf("math.Nextafter32(%g, %g) = %g want %g", vfnextafter32SC[i][0], vfnextafter32SC[i][1], f, nextafter32SC[i])
  2953  		}
  2954  	}
  2955  }
  2956  
  2957  func TestNextafter64(t *testing.T) {
  2958  	for i := 0; i < len(vf); i++ {
  2959  		if f := math.Nextafter(vf[i], 10); nextafter64[i] != f {
  2960  			t.Errorf("math.Nextafter64(%g, %g) = %g want %g", vf[i], 10.0, f, nextafter64[i])
  2961  		}
  2962  	}
  2963  	for i := 0; i < len(vfnextafter64SC); i++ {
  2964  		if f := math.Nextafter(vfnextafter64SC[i][0], vfnextafter64SC[i][1]); !alike(nextafter64SC[i], f) {
  2965  			t.Errorf("math.Nextafter64(%g, %g) = %g want %g", vfnextafter64SC[i][0], vfnextafter64SC[i][1], f, nextafter64SC[i])
  2966  		}
  2967  	}
  2968  }
  2969  
  2970  func TestPow(t *testing.T) {
  2971  	for i := 0; i < len(vf); i++ {
  2972  		if f := math.Pow(10, vf[i]); !closeFloat64(pow[i], f) {
  2973  			t.Errorf("math.Pow(10, %g) = %g, want %g", vf[i], f, pow[i])
  2974  		}
  2975  	}
  2976  	for i := 0; i < len(vfpowSC); i++ {
  2977  		if f := math.Pow(vfpowSC[i][0], vfpowSC[i][1]); !alike(powSC[i], f) {
  2978  			t.Errorf("math.Pow(%g, %g) = %g, want %g", vfpowSC[i][0], vfpowSC[i][1], f, powSC[i])
  2979  		}
  2980  	}
  2981  }
  2982  
  2983  func TestPow10(t *testing.T) {
  2984  	for i := 0; i < len(vfpow10SC); i++ {
  2985  		if f := math.Pow10(vfpow10SC[i]); !alike(pow10SC[i], f) {
  2986  			t.Errorf("math.Pow10(%d) = %g, want %g", vfpow10SC[i], f, pow10SC[i])
  2987  		}
  2988  	}
  2989  }
  2990  
  2991  func TestRemainder(t *testing.T) {
  2992  	for i := 0; i < len(vf); i++ {
  2993  		if f := math.Remainder(10, vf[i]); remainder[i] != f {
  2994  			t.Errorf("math.Remainder(10, %g) = %g, want %g", vf[i], f, remainder[i])
  2995  		}
  2996  	}
  2997  	for i := 0; i < len(vffmodSC); i++ {
  2998  		if f := math.Remainder(vffmodSC[i][0], vffmodSC[i][1]); !alike(fmodSC[i], f) {
  2999  			t.Errorf("math.Remainder(%g, %g) = %g, want %g", vffmodSC[i][0], vffmodSC[i][1], f, fmodSC[i])
  3000  		}
  3001  	}
  3002  	// verify precision of result for extreme inputs
  3003  	if f := math.Remainder(5.9790119248836734e+200, 1.1258465975523544); -0.4810497673014966 != f {
  3004  		t.Errorf("math.Remainder(5.9790119248836734e+200, 1.1258465975523544) = %g, want -0.4810497673014966", f)
  3005  	}
  3006  	// verify that sign is correct when r == 0.
  3007  	test := func(x, y float64) {
  3008  		if r := math.Remainder(x, y); r == 0 && math.Signbit(r) != math.Signbit(x) {
  3009  			t.Errorf("math.Remainder(x=%f, y=%f) = %f, sign of (zero) result should agree with sign of x", x, y, r)
  3010  		}
  3011  	}
  3012  	for x := 0.0; x <= 3.0; x += 1 {
  3013  		for y := 1.0; y <= 3.0; y += 1 {
  3014  			test(x, y)
  3015  			test(x, -y)
  3016  			test(-x, y)
  3017  			test(-x, -y)
  3018  		}
  3019  	}
  3020  }
  3021  
  3022  func TestRound(t *testing.T) {
  3023  	for i := 0; i < len(vf); i++ {
  3024  		if f := math.Round(vf[i]); !alike(round[i], f) {
  3025  			t.Errorf("math.Round(%g) = %g, want %g", vf[i], f, round[i])
  3026  		}
  3027  	}
  3028  	for i := 0; i < len(vfroundSC); i++ {
  3029  		if f := math.Round(vfroundSC[i][0]); !alike(vfroundSC[i][1], f) {
  3030  			t.Errorf("math.Round(%g) = %g, want %g", vfroundSC[i][0], f, vfroundSC[i][1])
  3031  		}
  3032  	}
  3033  }
  3034  
  3035  func TestRoundToEven(t *testing.T) {
  3036  	for i := 0; i < len(vf); i++ {
  3037  		if f := math.RoundToEven(vf[i]); !alike(round[i], f) {
  3038  			t.Errorf("math.RoundToEven(%g) = %g, want %g", vf[i], f, round[i])
  3039  		}
  3040  	}
  3041  	for i := 0; i < len(vfroundEvenSC); i++ {
  3042  		if f := math.RoundToEven(vfroundEvenSC[i][0]); !alike(vfroundEvenSC[i][1], f) {
  3043  			t.Errorf("math.RoundToEven(%g) = %g, want %g", vfroundEvenSC[i][0], f, vfroundEvenSC[i][1])
  3044  		}
  3045  	}
  3046  }
  3047  
  3048  func TestSignbit(t *testing.T) {
  3049  	for i := 0; i < len(vf); i++ {
  3050  		if f := math.Signbit(vf[i]); signbit[i] != f {
  3051  			t.Errorf("math.Signbit(%g) = %t, want %t", vf[i], f, signbit[i])
  3052  		}
  3053  	}
  3054  	for i := 0; i < len(vfsignbitSC); i++ {
  3055  		if f := math.Signbit(vfsignbitSC[i]); signbitSC[i] != f {
  3056  			t.Errorf("math.Signbit(%g) = %t, want %t", vfsignbitSC[i], f, signbitSC[i])
  3057  		}
  3058  	}
  3059  }
  3060  
  3061  func TestSin(t *testing.T) {
  3062  	for i := 0; i < len(vf); i++ {
  3063  		if f := math.Sin(vf[i]); !veryclose(sin[i], f) {
  3064  			t.Errorf("math.Sin(%g) = %g, want %g", vf[i], f, sin[i])
  3065  		}
  3066  	}
  3067  	for i := 0; i < len(vfsinSC); i++ {
  3068  		if f := math.Sin(vfsinSC[i]); !alike(sinSC[i], f) {
  3069  			t.Errorf("math.Sin(%g) = %g, want %g", vfsinSC[i], f, sinSC[i])
  3070  		}
  3071  	}
  3072  }
  3073  
  3074  func TestSincos(t *testing.T) {
  3075  	for i := 0; i < len(vf); i++ {
  3076  		if s, c := math.Sincos(vf[i]); !veryclose(sin[i], s) || !veryclose(cos[i], c) {
  3077  			t.Errorf("math.Sincos(%g) = %g, %g want %g, %g", vf[i], s, c, sin[i], cos[i])
  3078  		}
  3079  	}
  3080  }
  3081  
  3082  func TestSinh(t *testing.T) {
  3083  	for i := 0; i < len(vf); i++ {
  3084  		if f := math.Sinh(vf[i]); !closeFloat64(sinh[i], f) {
  3085  			t.Errorf("math.Sinh(%g) = %g, want %g", vf[i], f, sinh[i])
  3086  		}
  3087  	}
  3088  	for i := 0; i < len(vfsinhSC); i++ {
  3089  		if f := math.Sinh(vfsinhSC[i]); !alike(sinhSC[i], f) {
  3090  			t.Errorf("math.Sinh(%g) = %g, want %g", vfsinhSC[i], f, sinhSC[i])
  3091  		}
  3092  	}
  3093  }
  3094  
  3095  func TestSqrt(t *testing.T) {
  3096  	for i := 0; i < len(vf); i++ {
  3097  		a := math.Abs(vf[i])
  3098  		if f := math.SqrtGo(a); sqrt[i] != f {
  3099  			t.Errorf("math.SqrtGo(%g) = %g, want %g", a, f, sqrt[i])
  3100  		}
  3101  		a = math.Abs(vf[i])
  3102  		if f := math.Sqrt(a); sqrt[i] != f {
  3103  			t.Errorf("math.Sqrt(%g) = %g, want %g", a, f, sqrt[i])
  3104  		}
  3105  	}
  3106  	for i := 0; i < len(vfsqrtSC); i++ {
  3107  		if f := math.SqrtGo(vfsqrtSC[i]); !alike(sqrtSC[i], f) {
  3108  			t.Errorf("math.SqrtGo(%g) = %g, want %g", vfsqrtSC[i], f, sqrtSC[i])
  3109  		}
  3110  		if f := math.Sqrt(vfsqrtSC[i]); !alike(sqrtSC[i], f) {
  3111  			t.Errorf("math.Sqrt(%g) = %g, want %g", vfsqrtSC[i], f, sqrtSC[i])
  3112  		}
  3113  	}
  3114  }
  3115  
  3116  func TestTan(t *testing.T) {
  3117  	for i := 0; i < len(vf); i++ {
  3118  		if f := math.Tan(vf[i]); !veryclose(tan[i], f) {
  3119  			t.Errorf("math.Tan(%g) = %g, want %g", vf[i], f, tan[i])
  3120  		}
  3121  	}
  3122  	// same special cases as Sin
  3123  	for i := 0; i < len(vfsinSC); i++ {
  3124  		if f := math.Tan(vfsinSC[i]); !alike(sinSC[i], f) {
  3125  			t.Errorf("math.Tan(%g) = %g, want %g", vfsinSC[i], f, sinSC[i])
  3126  		}
  3127  	}
  3128  }
  3129  
  3130  func TestTanh(t *testing.T) {
  3131  	for i := 0; i < len(vf); i++ {
  3132  		if f := math.Tanh(vf[i]); !veryclose(tanh[i], f) {
  3133  			t.Errorf("math.Tanh(%g) = %g, want %g", vf[i], f, tanh[i])
  3134  		}
  3135  	}
  3136  	for i := 0; i < len(vftanhSC); i++ {
  3137  		if f := math.Tanh(vftanhSC[i]); !alike(tanhSC[i], f) {
  3138  			t.Errorf("math.Tanh(%g) = %g, want %g", vftanhSC[i], f, tanhSC[i])
  3139  		}
  3140  	}
  3141  }
  3142  
  3143  func TestTrunc(t *testing.T) {
  3144  	for i := 0; i < len(vf); i++ {
  3145  		if f := math.Trunc(vf[i]); !alike(trunc[i], f) {
  3146  			t.Errorf("math.Trunc(%g) = %g, want %g", vf[i], f, trunc[i])
  3147  		}
  3148  	}
  3149  	for i := 0; i < len(vfceilSC); i++ {
  3150  		if f := math.Trunc(vfceilSC[i]); !alike(ceilSC[i], f) {
  3151  			t.Errorf("math.Trunc(%g) = %g, want %g", vfceilSC[i], f, ceilSC[i])
  3152  		}
  3153  	}
  3154  }
  3155  
  3156  func TestY0(t *testing.T) {
  3157  	for i := 0; i < len(vf); i++ {
  3158  		a := math.Abs(vf[i])
  3159  		if f := math.Y0(a); !closeFloat64(y0[i], f) {
  3160  			t.Errorf("math.Y0(%g) = %g, want %g", a, f, y0[i])
  3161  		}
  3162  	}
  3163  	for i := 0; i < len(vfy0SC); i++ {
  3164  		if f := math.Y0(vfy0SC[i]); !alike(y0SC[i], f) {
  3165  			t.Errorf("math.Y0(%g) = %g, want %g", vfy0SC[i], f, y0SC[i])
  3166  		}
  3167  	}
  3168  }
  3169  
  3170  func TestY1(t *testing.T) {
  3171  	for i := 0; i < len(vf); i++ {
  3172  		a := math.Abs(vf[i])
  3173  		if f := math.Y1(a); !soclose(y1[i], f, 2e-14) {
  3174  			t.Errorf("math.Y1(%g) = %g, want %g", a, f, y1[i])
  3175  		}
  3176  	}
  3177  	for i := 0; i < len(vfy0SC); i++ {
  3178  		if f := math.Y1(vfy0SC[i]); !alike(y1SC[i], f) {
  3179  			t.Errorf("math.Y1(%g) = %g, want %g", vfy0SC[i], f, y1SC[i])
  3180  		}
  3181  	}
  3182  }
  3183  
  3184  func TestYn(t *testing.T) {
  3185  	for i := 0; i < len(vf); i++ {
  3186  		a := math.Abs(vf[i])
  3187  		if f := math.Yn(2, a); !closeFloat64(y2[i], f) {
  3188  			t.Errorf("math.Yn(2, %g) = %g, want %g", a, f, y2[i])
  3189  		}
  3190  		if f := math.Yn(-3, a); !closeFloat64(yM3[i], f) {
  3191  			t.Errorf("math.Yn(-3, %g) = %g, want %g", a, f, yM3[i])
  3192  		}
  3193  	}
  3194  	for i := 0; i < len(vfy0SC); i++ {
  3195  		if f := math.Yn(2, vfy0SC[i]); !alike(y2SC[i], f) {
  3196  			t.Errorf("math.Yn(2, %g) = %g, want %g", vfy0SC[i], f, y2SC[i])
  3197  		}
  3198  		if f := math.Yn(-3, vfy0SC[i]); !alike(yM3SC[i], f) {
  3199  			t.Errorf("math.Yn(-3, %g) = %g, want %g", vfy0SC[i], f, yM3SC[i])
  3200  		}
  3201  	}
  3202  	if f := math.Yn(0, 0); !alike(math.Inf(-1), f) {
  3203  		t.Errorf("math.Yn(0, 0) = %g, want %g", f, math.Inf(-1))
  3204  	}
  3205  }
  3206  
  3207  var PortableFMA = math.FMA // hide call from compiler intrinsic; falls back to portable code
  3208  
  3209  func TestFMA(t *testing.T) {
  3210  	for _, c := range fmaC {
  3211  		got := math.FMA(c.x, c.y, c.z)
  3212  		if !alike(got, c.want) {
  3213  			t.Errorf("math.FMA(%g,%g,%g) == %g; want %g", c.x, c.y, c.z, got, c.want)
  3214  		}
  3215  		got = PortableFMA(c.x, c.y, c.z)
  3216  		if !alike(got, c.want) {
  3217  			t.Errorf("PortableFMA(%g,%g,%g) == %g; want %g", c.x, c.y, c.z, got, c.want)
  3218  		}
  3219  	}
  3220  }
  3221  
  3222  //go:noinline
  3223  func fmsub(x, y, z float64) float64 {
  3224  	return math.FMA(x, y, -z)
  3225  }
  3226  
  3227  //go:noinline
  3228  func fnmsub(x, y, z float64) float64 {
  3229  	return math.FMA(-x, y, z)
  3230  }
  3231  
  3232  //go:noinline
  3233  func fnmadd(x, y, z float64) float64 {
  3234  	return math.FMA(-x, y, -z)
  3235  }
  3236  
  3237  func TestFMANegativeArgs(t *testing.T) {
  3238  	// Some architectures have instructions for fused multiply-subtract and
  3239  	// also negated variants of fused multiply-add and subtract. This test
  3240  	// aims to check that the optimizations that generate those instructions
  3241  	// are applied correctly, if they exist.
  3242  	for _, c := range fmaC {
  3243  		want := PortableFMA(c.x, c.y, -c.z)
  3244  		got := fmsub(c.x, c.y, c.z)
  3245  		if !alike(got, want) {
  3246  			t.Errorf("math.FMA(%g, %g, -(%g)) == %g, want %g", c.x, c.y, c.z, got, want)
  3247  		}
  3248  		want = PortableFMA(-c.x, c.y, c.z)
  3249  		got = fnmsub(c.x, c.y, c.z)
  3250  		if !alike(got, want) {
  3251  			t.Errorf("math.FMA(-(%g), %g, %g) == %g, want %g", c.x, c.y, c.z, got, want)
  3252  		}
  3253  		want = PortableFMA(-c.x, c.y, -c.z)
  3254  		got = fnmadd(c.x, c.y, c.z)
  3255  		if !alike(got, want) {
  3256  			t.Errorf("math.FMA(-(%g), %g, -(%g)) == %g, want %g", c.x, c.y, c.z, got, want)
  3257  		}
  3258  	}
  3259  }
  3260  
  3261  // Check that math functions of high angle values
  3262  // return accurate results. [Since (vf[i] + large) - large != vf[i],
  3263  // testing for math.Trig(vf[i] + large) == math.Trig(vf[i]), where large is
  3264  // a multiple of 2*math.Pi, is misleading.]
  3265  func TestLargeCos(t *testing.T) {
  3266  	large := float64(100000 * math.Pi)
  3267  	for i := 0; i < len(vf); i++ {
  3268  		f1 := cosLarge[i]
  3269  		f2 := math.Cos(vf[i] + large)
  3270  		if !closeFloat64(f1, f2) {
  3271  			t.Errorf("math.Cos(%g) = %g, want %g", vf[i]+large, f2, f1)
  3272  		}
  3273  	}
  3274  }
  3275  
  3276  func TestLargeSin(t *testing.T) {
  3277  	large := float64(100000 * math.Pi)
  3278  	for i := 0; i < len(vf); i++ {
  3279  		f1 := sinLarge[i]
  3280  		f2 := math.Sin(vf[i] + large)
  3281  		if !closeFloat64(f1, f2) {
  3282  			t.Errorf("math.Sin(%g) = %g, want %g", vf[i]+large, f2, f1)
  3283  		}
  3284  	}
  3285  }
  3286  
  3287  func TestLargeSincos(t *testing.T) {
  3288  	large := float64(100000 * math.Pi)
  3289  	for i := 0; i < len(vf); i++ {
  3290  		f1, g1 := sinLarge[i], cosLarge[i]
  3291  		f2, g2 := math.Sincos(vf[i] + large)
  3292  		if !closeFloat64(f1, f2) || !closeFloat64(g1, g2) {
  3293  			t.Errorf("math.Sincos(%g) = %g, %g, want %g, %g", vf[i]+large, f2, g2, f1, g1)
  3294  		}
  3295  	}
  3296  }
  3297  
  3298  func TestLargeTan(t *testing.T) {
  3299  	large := float64(100000 * math.Pi)
  3300  	for i := 0; i < len(vf); i++ {
  3301  		f1 := tanLarge[i]
  3302  		f2 := math.Tan(vf[i] + large)
  3303  		if !closeFloat64(f1, f2) {
  3304  			t.Errorf("math.Tan(%g) = %g, want %g", vf[i]+large, f2, f1)
  3305  		}
  3306  	}
  3307  }
  3308  
  3309  // Check that trigReduce matches the standard reduction results for input values
  3310  // below reduceThreshold.
  3311  func TestTrigReduce(t *testing.T) {
  3312  	inputs := make([]float64, len(vf))
  3313  	// all of the standard inputs
  3314  	copy(inputs, vf)
  3315  	// all of the large inputs
  3316  	large := float64(100000 * math.Pi)
  3317  	for _, v := range vf {
  3318  		inputs = append(inputs, v+large)
  3319  	}
  3320  	// Also test some special inputs, math.Pi and right below the reduceThreshold
  3321  	// XXX: https://github.com/gnolang/gno/issues/1149
  3322  	inputs = append(inputs, float64(math.Pi), math.Nextafter(math.ReduceThreshold, 0))
  3323  	for _, x := range inputs {
  3324  		// reduce the value to compare
  3325  		j, z := math.TrigReduce(x)
  3326  		xred := float64(j)*(math.Pi/4) + z
  3327  
  3328  		if f, fred := math.Sin(x), math.Sin(xred); !closeFloat64(f, fred) {
  3329  			t.Errorf("math.Sin(trigmath.Reduce(%g)) != math.Sin(%g), got %g, want %g", x, x, fred, f)
  3330  		}
  3331  		if f, fred := math.Cos(x), math.Cos(xred); !closeFloat64(f, fred) {
  3332  			t.Errorf("math.Cos(trigmath.Reduce(%g)) != math.Cos(%g), got %g, want %g", x, x, fred, f)
  3333  		}
  3334  		if f, fred := math.Tan(x), math.Tan(xred); !closeFloat64(f, fred) {
  3335  			t.Errorf(" math.Tan(trigmath.Reduce(%g)) != math.Tan(%g), got %g, want %g", x, x, fred, f)
  3336  		}
  3337  		f, g := math.Sincos(x)
  3338  		fred, gred := math.Sincos(xred)
  3339  		if !closeFloat64(f, fred) || !closeFloat64(g, gred) {
  3340  			t.Errorf(" math.Sincos(trigmath.Reduce(%g)) != math.Sincos(%g), got %g, %g, want %g, %g", x, x, fred, gred, f, g)
  3341  		}
  3342  	}
  3343  }
  3344  
  3345  // Check that math constants are accepted by compiler
  3346  // and have right value (assumes strconv.ParseFloat works).
  3347  // https://golang.org/issue/201
  3348  
  3349  type floatTest struct {
  3350  	val  interface{}
  3351  	name string
  3352  	str  string
  3353  }
  3354  
  3355  var floatTests = []floatTest{
  3356  	{float64(math.MaxFloat64), "MaxFloat64", "1.7976931348623157e+308"},
  3357  	{float64(math.SmallestNonzeroFloat64), "SmallestNonzeroFloat64", "5e-324"},
  3358  	{float32(math.MaxFloat32), "MaxFloat32", "3.4028235e+38"},
  3359  	{float32(math.SmallestNonzeroFloat32), "SmallestNonzeroFloat32", "1e-45"},
  3360  }
  3361  
  3362  func TestFloatMinMax(t *testing.T) {
  3363  	for _, tt := range floatTests {
  3364  		s := fmt.Sprint(tt.val)
  3365  		if s != tt.str {
  3366  			t.Errorf("math.Sprint(%v) = %s, want %s", tt.name, s, tt.str)
  3367  		}
  3368  	}
  3369  }
  3370  
  3371  func TestFloatMinima(t *testing.T) {
  3372  	if q := float32(math.SmallestNonzeroFloat32 / 2); q != 0 {
  3373  		t.Errorf("float32(math.SmallestNonzeroFloat32 / 2) = %g, want 0", q)
  3374  	}
  3375  	if q := float64(math.SmallestNonzeroFloat64 / 2); q != 0 {
  3376  		t.Errorf("float64(math.SmallestNonzeroFloat64 / 2) = %g, want 0", q)
  3377  	}
  3378  }
  3379  
  3380  var indirectSqrt = math.Sqrt
  3381  
  3382  // TestFloat32Sqrt checks the correctness of the float32 square root optimization result.
  3383  func TestFloat32Sqrt(t *testing.T) {
  3384  	for _, v := range sqrt32 {
  3385  		want := float32(indirectSqrt(float64(v)))
  3386  		got := float32(math.Sqrt(float64(v)))
  3387  		if math.IsNaN(float64(want)) {
  3388  			if !math.IsNaN(float64(got)) {
  3389  				t.Errorf("got=%#v want=NaN, v=%#v", got, v)
  3390  			}
  3391  			continue
  3392  		}
  3393  		if got != want {
  3394  			t.Errorf("got=%#v want=%#v, v=%#v", got, want, v)
  3395  		}
  3396  	}
  3397  }
  3398  
  3399  // Benchmarks
  3400  
  3401  // Global exported variables are used to store the
  3402  // return values of functions measured in the benchmarks.
  3403  // Storing the results in these variables prevents the compiler
  3404  // from completely optimizing the benchmarked functions away.
  3405  var (
  3406  	GlobalI int
  3407  	GlobalB bool
  3408  	GlobalF float64
  3409  )
  3410  
  3411  func BenchmarkAcos(b *testing.B) {
  3412  	x := 0.0
  3413  	for i := 0; i < b.N; i++ {
  3414  		x = math.Acos(.5)
  3415  	}
  3416  	GlobalF = x
  3417  }
  3418  
  3419  func BenchmarkAcosh(b *testing.B) {
  3420  	x := 0.0
  3421  	for i := 0; i < b.N; i++ {
  3422  		x = math.Acosh(1.5)
  3423  	}
  3424  	GlobalF = x
  3425  }
  3426  
  3427  func BenchmarkAsin(b *testing.B) {
  3428  	x := 0.0
  3429  	for i := 0; i < b.N; i++ {
  3430  		x = math.Asin(.5)
  3431  	}
  3432  	GlobalF = x
  3433  }
  3434  
  3435  func BenchmarkAsinh(b *testing.B) {
  3436  	x := 0.0
  3437  	for i := 0; i < b.N; i++ {
  3438  		x = math.Asinh(.5)
  3439  	}
  3440  	GlobalF = x
  3441  }
  3442  
  3443  func BenchmarkAtan(b *testing.B) {
  3444  	x := 0.0
  3445  	for i := 0; i < b.N; i++ {
  3446  		x = math.Atan(.5)
  3447  	}
  3448  	GlobalF = x
  3449  }
  3450  
  3451  func BenchmarkAtanh(b *testing.B) {
  3452  	x := 0.0
  3453  	for i := 0; i < b.N; i++ {
  3454  		x = math.Atanh(.5)
  3455  	}
  3456  	GlobalF = x
  3457  }
  3458  
  3459  func BenchmarkAtan2(b *testing.B) {
  3460  	x := 0.0
  3461  	for i := 0; i < b.N; i++ {
  3462  		x = math.Atan2(.5, 1)
  3463  	}
  3464  	GlobalF = x
  3465  }
  3466  
  3467  func BenchmarkCbrt(b *testing.B) {
  3468  	x := 0.0
  3469  	for i := 0; i < b.N; i++ {
  3470  		x = math.Cbrt(10)
  3471  	}
  3472  	GlobalF = x
  3473  }
  3474  
  3475  func BenchmarkCeil(b *testing.B) {
  3476  	x := 0.0
  3477  	for i := 0; i < b.N; i++ {
  3478  		x = math.Ceil(.5)
  3479  	}
  3480  	GlobalF = x
  3481  }
  3482  
  3483  var copysignNeg = -1.0
  3484  
  3485  func BenchmarkCopysign(b *testing.B) {
  3486  	x := 0.0
  3487  	for i := 0; i < b.N; i++ {
  3488  		x = math.Copysign(.5, copysignNeg)
  3489  	}
  3490  	GlobalF = x
  3491  }
  3492  
  3493  func BenchmarkCos(b *testing.B) {
  3494  	x := 0.0
  3495  	for i := 0; i < b.N; i++ {
  3496  		x = math.Cos(.5)
  3497  	}
  3498  	GlobalF = x
  3499  }
  3500  
  3501  func BenchmarkCosh(b *testing.B) {
  3502  	x := 0.0
  3503  	for i := 0; i < b.N; i++ {
  3504  		x = math.Cosh(2.5)
  3505  	}
  3506  	GlobalF = x
  3507  }
  3508  
  3509  func BenchmarkErf(b *testing.B) {
  3510  	x := 0.0
  3511  	for i := 0; i < b.N; i++ {
  3512  		x = math.Erf(.5)
  3513  	}
  3514  	GlobalF = x
  3515  }
  3516  
  3517  func BenchmarkErfc(b *testing.B) {
  3518  	x := 0.0
  3519  	for i := 0; i < b.N; i++ {
  3520  		x = math.Erfc(.5)
  3521  	}
  3522  	GlobalF = x
  3523  }
  3524  
  3525  func BenchmarkErfinv(b *testing.B) {
  3526  	x := 0.0
  3527  	for i := 0; i < b.N; i++ {
  3528  		x = math.Erfinv(.5)
  3529  	}
  3530  	GlobalF = x
  3531  }
  3532  
  3533  func BenchmarkErfcinv(b *testing.B) {
  3534  	x := 0.0
  3535  	for i := 0; i < b.N; i++ {
  3536  		x = math.Erfcinv(.5)
  3537  	}
  3538  	GlobalF = x
  3539  }
  3540  
  3541  func BenchmarkExp(b *testing.B) {
  3542  	x := 0.0
  3543  	for i := 0; i < b.N; i++ {
  3544  		x = math.Exp(.5)
  3545  	}
  3546  	GlobalF = x
  3547  }
  3548  
  3549  func BenchmarkExpGo(b *testing.B) {
  3550  	x := 0.0
  3551  	for i := 0; i < b.N; i++ {
  3552  		x = math.ExpGo(.5)
  3553  	}
  3554  	GlobalF = x
  3555  }
  3556  
  3557  func BenchmarkExpm1(b *testing.B) {
  3558  	x := 0.0
  3559  	for i := 0; i < b.N; i++ {
  3560  		x = math.Expm1(.5)
  3561  	}
  3562  	GlobalF = x
  3563  }
  3564  
  3565  func BenchmarkExp2(b *testing.B) {
  3566  	x := 0.0
  3567  	for i := 0; i < b.N; i++ {
  3568  		x = math.Exp2(.5)
  3569  	}
  3570  	GlobalF = x
  3571  }
  3572  
  3573  func BenchmarkExp2Go(b *testing.B) {
  3574  	x := 0.0
  3575  	for i := 0; i < b.N; i++ {
  3576  		x = math.Exp2Go(.5)
  3577  	}
  3578  	GlobalF = x
  3579  }
  3580  
  3581  var absPos = .5
  3582  
  3583  func BenchmarkAbs(b *testing.B) {
  3584  	x := 0.0
  3585  	for i := 0; i < b.N; i++ {
  3586  		x = math.Abs(absPos)
  3587  	}
  3588  	GlobalF = x
  3589  }
  3590  
  3591  func BenchmarkDim(b *testing.B) {
  3592  	x := 0.0
  3593  	for i := 0; i < b.N; i++ {
  3594  		x = math.Dim(GlobalF, x)
  3595  	}
  3596  	GlobalF = x
  3597  }
  3598  
  3599  func BenchmarkFloor(b *testing.B) {
  3600  	x := 0.0
  3601  	for i := 0; i < b.N; i++ {
  3602  		x = math.Floor(.5)
  3603  	}
  3604  	GlobalF = x
  3605  }
  3606  
  3607  func BenchmarkMax(b *testing.B) {
  3608  	x := 0.0
  3609  	for i := 0; i < b.N; i++ {
  3610  		x = math.Max(10, 3)
  3611  	}
  3612  	GlobalF = x
  3613  }
  3614  
  3615  func BenchmarkMin(b *testing.B) {
  3616  	x := 0.0
  3617  	for i := 0; i < b.N; i++ {
  3618  		x = math.Min(10, 3)
  3619  	}
  3620  	GlobalF = x
  3621  }
  3622  
  3623  func BenchmarkMod(b *testing.B) {
  3624  	x := 0.0
  3625  	for i := 0; i < b.N; i++ {
  3626  		x = math.Mod(10, 3)
  3627  	}
  3628  	GlobalF = x
  3629  }
  3630  
  3631  func BenchmarkFrexp(b *testing.B) {
  3632  	x := 0.0
  3633  	y := 0
  3634  	for i := 0; i < b.N; i++ {
  3635  		x, y = math.Frexp(8)
  3636  	}
  3637  	GlobalF = x
  3638  	GlobalI = y
  3639  }
  3640  
  3641  func BenchmarkGamma(b *testing.B) {
  3642  	x := 0.0
  3643  	for i := 0; i < b.N; i++ {
  3644  		x = math.Gamma(2.5)
  3645  	}
  3646  	GlobalF = x
  3647  }
  3648  
  3649  func BenchmarkHypot(b *testing.B) {
  3650  	x := 0.0
  3651  	for i := 0; i < b.N; i++ {
  3652  		x = math.Hypot(3, 4)
  3653  	}
  3654  	GlobalF = x
  3655  }
  3656  
  3657  func BenchmarkHypotGo(b *testing.B) {
  3658  	x := 0.0
  3659  	for i := 0; i < b.N; i++ {
  3660  		x = math.HypotGo(3, 4)
  3661  	}
  3662  	GlobalF = x
  3663  }
  3664  
  3665  func BenchmarkIlogb(b *testing.B) {
  3666  	x := 0
  3667  	for i := 0; i < b.N; i++ {
  3668  		x = math.Ilogb(.5)
  3669  	}
  3670  	GlobalI = x
  3671  }
  3672  
  3673  func BenchmarkJ0(b *testing.B) {
  3674  	x := 0.0
  3675  	for i := 0; i < b.N; i++ {
  3676  		x = math.J0(2.5)
  3677  	}
  3678  	GlobalF = x
  3679  }
  3680  
  3681  func BenchmarkJ1(b *testing.B) {
  3682  	x := 0.0
  3683  	for i := 0; i < b.N; i++ {
  3684  		x = math.J1(2.5)
  3685  	}
  3686  	GlobalF = x
  3687  }
  3688  
  3689  func BenchmarkJn(b *testing.B) {
  3690  	x := 0.0
  3691  	for i := 0; i < b.N; i++ {
  3692  		x = math.Jn(2, 2.5)
  3693  	}
  3694  	GlobalF = x
  3695  }
  3696  
  3697  func BenchmarkLdexp(b *testing.B) {
  3698  	x := 0.0
  3699  	for i := 0; i < b.N; i++ {
  3700  		x = math.Ldexp(.5, 2)
  3701  	}
  3702  	GlobalF = x
  3703  }
  3704  
  3705  func BenchmarkLgamma(b *testing.B) {
  3706  	x := 0.0
  3707  	y := 0
  3708  	for i := 0; i < b.N; i++ {
  3709  		x, y = math.Lgamma(2.5)
  3710  	}
  3711  	GlobalF = x
  3712  	GlobalI = y
  3713  }
  3714  
  3715  func BenchmarkLog(b *testing.B) {
  3716  	x := 0.0
  3717  	for i := 0; i < b.N; i++ {
  3718  		x = math.Log(.5)
  3719  	}
  3720  	GlobalF = x
  3721  }
  3722  
  3723  func BenchmarkLogb(b *testing.B) {
  3724  	x := 0.0
  3725  	for i := 0; i < b.N; i++ {
  3726  		x = math.Logb(.5)
  3727  	}
  3728  	GlobalF = x
  3729  }
  3730  
  3731  func BenchmarkLog1p(b *testing.B) {
  3732  	x := 0.0
  3733  	for i := 0; i < b.N; i++ {
  3734  		x = math.Log1p(.5)
  3735  	}
  3736  	GlobalF = x
  3737  }
  3738  
  3739  func BenchmarkLog10(b *testing.B) {
  3740  	x := 0.0
  3741  	for i := 0; i < b.N; i++ {
  3742  		x = math.Log10(.5)
  3743  	}
  3744  	GlobalF = x
  3745  }
  3746  
  3747  func BenchmarkLog2(b *testing.B) {
  3748  	x := 0.0
  3749  	for i := 0; i < b.N; i++ {
  3750  		x = math.Log2(.5)
  3751  	}
  3752  	GlobalF += x
  3753  }
  3754  
  3755  func BenchmarkModf(b *testing.B) {
  3756  	x := 0.0
  3757  	y := 0.0
  3758  	for i := 0; i < b.N; i++ {
  3759  		x, y = math.Modf(1.5)
  3760  	}
  3761  	GlobalF += x
  3762  	GlobalF += y
  3763  }
  3764  
  3765  func BenchmarkNextafter32(b *testing.B) {
  3766  	x := float32(0.0)
  3767  	for i := 0; i < b.N; i++ {
  3768  		x = math.Nextafter32(.5, 1)
  3769  	}
  3770  	GlobalF = float64(x)
  3771  }
  3772  
  3773  func BenchmarkNextafter64(b *testing.B) {
  3774  	x := 0.0
  3775  	for i := 0; i < b.N; i++ {
  3776  		x = math.Nextafter(.5, 1)
  3777  	}
  3778  	GlobalF = x
  3779  }
  3780  
  3781  func BenchmarkPowInt(b *testing.B) {
  3782  	x := 0.0
  3783  	for i := 0; i < b.N; i++ {
  3784  		x = math.Pow(2, 2)
  3785  	}
  3786  	GlobalF = x
  3787  }
  3788  
  3789  func BenchmarkPowFrac(b *testing.B) {
  3790  	x := 0.0
  3791  	for i := 0; i < b.N; i++ {
  3792  		x = math.Pow(2.5, 1.5)
  3793  	}
  3794  	GlobalF = x
  3795  }
  3796  
  3797  var pow10pos = int(300)
  3798  
  3799  func BenchmarkPow10Pos(b *testing.B) {
  3800  	x := 0.0
  3801  	for i := 0; i < b.N; i++ {
  3802  		x = math.Pow10(pow10pos)
  3803  	}
  3804  	GlobalF = x
  3805  }
  3806  
  3807  var pow10neg = int(-300)
  3808  
  3809  func BenchmarkPow10Neg(b *testing.B) {
  3810  	x := 0.0
  3811  	for i := 0; i < b.N; i++ {
  3812  		x = math.Pow10(pow10neg)
  3813  	}
  3814  	GlobalF = x
  3815  }
  3816  
  3817  var roundNeg = float64(-2.5)
  3818  
  3819  func BenchmarkRound(b *testing.B) {
  3820  	x := 0.0
  3821  	for i := 0; i < b.N; i++ {
  3822  		x = math.Round(roundNeg)
  3823  	}
  3824  	GlobalF = x
  3825  }
  3826  
  3827  func BenchmarkRoundToEven(b *testing.B) {
  3828  	x := 0.0
  3829  	for i := 0; i < b.N; i++ {
  3830  		x = math.RoundToEven(roundNeg)
  3831  	}
  3832  	GlobalF = x
  3833  }
  3834  
  3835  func BenchmarkRemainder(b *testing.B) {
  3836  	x := 0.0
  3837  	for i := 0; i < b.N; i++ {
  3838  		x = math.Remainder(10, 3)
  3839  	}
  3840  	GlobalF = x
  3841  }
  3842  
  3843  var signbitPos = 2.5
  3844  
  3845  func BenchmarkSignbit(b *testing.B) {
  3846  	x := false
  3847  	for i := 0; i < b.N; i++ {
  3848  		x = math.Signbit(signbitPos)
  3849  	}
  3850  	GlobalB = x
  3851  }
  3852  
  3853  func BenchmarkSin(b *testing.B) {
  3854  	x := 0.0
  3855  	for i := 0; i < b.N; i++ {
  3856  		x = math.Sin(.5)
  3857  	}
  3858  	GlobalF = x
  3859  }
  3860  
  3861  func BenchmarkSincos(b *testing.B) {
  3862  	x := 0.0
  3863  	y := 0.0
  3864  	for i := 0; i < b.N; i++ {
  3865  		x, y = math.Sincos(.5)
  3866  	}
  3867  	GlobalF += x
  3868  	GlobalF += y
  3869  }
  3870  
  3871  func BenchmarkSinh(b *testing.B) {
  3872  	x := 0.0
  3873  	for i := 0; i < b.N; i++ {
  3874  		x = math.Sinh(2.5)
  3875  	}
  3876  	GlobalF = x
  3877  }
  3878  
  3879  func BenchmarkSqrtIndirect(b *testing.B) {
  3880  	x, y := 0.0, 10.0
  3881  	f := math.Sqrt
  3882  	for i := 0; i < b.N; i++ {
  3883  		x += f(y)
  3884  	}
  3885  	GlobalF = x
  3886  }
  3887  
  3888  func BenchmarkSqrtLatency(b *testing.B) {
  3889  	x := 10.0
  3890  	for i := 0; i < b.N; i++ {
  3891  		x = math.Sqrt(x)
  3892  	}
  3893  	GlobalF = x
  3894  }
  3895  
  3896  func BenchmarkSqrtIndirectLatency(b *testing.B) {
  3897  	x := 10.0
  3898  	f := math.Sqrt
  3899  	for i := 0; i < b.N; i++ {
  3900  		x = f(x)
  3901  	}
  3902  	GlobalF = x
  3903  }
  3904  
  3905  func BenchmarkSqrtGoLatency(b *testing.B) {
  3906  	x := 10.0
  3907  	for i := 0; i < b.N; i++ {
  3908  		x = math.SqrtGo(x)
  3909  	}
  3910  	GlobalF = x
  3911  }
  3912  
  3913  func isPrime(i int) bool {
  3914  	// Yes, this is a dumb way to write this code,
  3915  	// but calling Sqrt repeatedly in this way demonstrates
  3916  	// the benefit of using a direct SQRT instruction on systems
  3917  	// that have one, whereas the obvious loop seems not to
  3918  	// demonstrate such a benefit.
  3919  	for j := 2; float64(j) <= math.Sqrt(float64(i)); j++ {
  3920  		if i%j == 0 {
  3921  			return false
  3922  		}
  3923  	}
  3924  	return true
  3925  }
  3926  
  3927  func BenchmarkSqrtPrime(b *testing.B) {
  3928  	x := false
  3929  	for i := 0; i < b.N; i++ {
  3930  		x = isPrime(100003)
  3931  	}
  3932  	GlobalB = x
  3933  }
  3934  
  3935  func BenchmarkTan(b *testing.B) {
  3936  	x := 0.0
  3937  	for i := 0; i < b.N; i++ {
  3938  		x = math.Tan(.5)
  3939  	}
  3940  	GlobalF = x
  3941  }
  3942  
  3943  func BenchmarkTanh(b *testing.B) {
  3944  	x := 0.0
  3945  	for i := 0; i < b.N; i++ {
  3946  		x = math.Tanh(2.5)
  3947  	}
  3948  	GlobalF = x
  3949  }
  3950  
  3951  func BenchmarkTrunc(b *testing.B) {
  3952  	x := 0.0
  3953  	for i := 0; i < b.N; i++ {
  3954  		x = math.Trunc(.5)
  3955  	}
  3956  	GlobalF = x
  3957  }
  3958  
  3959  func BenchmarkY0(b *testing.B) {
  3960  	x := 0.0
  3961  	for i := 0; i < b.N; i++ {
  3962  		x = math.Y0(2.5)
  3963  	}
  3964  	GlobalF = x
  3965  }
  3966  
  3967  func BenchmarkY1(b *testing.B) {
  3968  	x := 0.0
  3969  	for i := 0; i < b.N; i++ {
  3970  		x = math.Y1(2.5)
  3971  	}
  3972  	GlobalF = x
  3973  }
  3974  
  3975  func BenchmarkYn(b *testing.B) {
  3976  	x := 0.0
  3977  	for i := 0; i < b.N; i++ {
  3978  		x = math.Yn(2, 2.5)
  3979  	}
  3980  	GlobalF = x
  3981  }
  3982  
  3983  func BenchmarkFloat64bits(b *testing.B) {
  3984  	y := uint64(0)
  3985  	for i := 0; i < b.N; i++ {
  3986  		y = math.Float64bits(roundNeg)
  3987  	}
  3988  	GlobalI = int(y)
  3989  }
  3990  
  3991  var roundUint64 = uint64(5)
  3992  
  3993  func BenchmarkFloat64frombits(b *testing.B) {
  3994  	x := 0.0
  3995  	for i := 0; i < b.N; i++ {
  3996  		x = math.Float64frombits(roundUint64)
  3997  	}
  3998  	GlobalF = x
  3999  }
  4000  
  4001  var roundFloat32 = float32(-2.5)
  4002  
  4003  func BenchmarkFloat32bits(b *testing.B) {
  4004  	y := uint32(0)
  4005  	for i := 0; i < b.N; i++ {
  4006  		y = math.Float32bits(roundFloat32)
  4007  	}
  4008  	GlobalI = int(y)
  4009  }
  4010  
  4011  var roundUint32 = uint32(5)
  4012  
  4013  func BenchmarkFloat32frombits(b *testing.B) {
  4014  	x := float32(0.0)
  4015  	for i := 0; i < b.N; i++ {
  4016  		x = math.Float32frombits(roundUint32)
  4017  	}
  4018  	GlobalF = float64(x)
  4019  }
  4020  
  4021  func BenchmarkFMA(b *testing.B) {
  4022  	x := 0.0
  4023  	for i := 0; i < b.N; i++ {
  4024  		x = math.FMA(math.E, math.Pi, x)
  4025  	}
  4026  	GlobalF = x
  4027  }