hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

data+test.ha (13972B)


      1 // License: MPL-2.0
      2 // (c) 2021 Alexey Yerin <yyp@disroot.org>
      3 // (c) 2021 Vlad-Stefan Harbuz <vlad@vladh.net>
      4 
      5 // The test data below is based on Go's implementation, and came with the
      6 // following note and copyright notice:
      7 //
      8 // The expected results below were computed by the high precision calculators
      9 // at https://keisan.casio.com/.  More exact input values (array vf[], above)
     10 // were obtained by printing them with "%.26f".  The answers were calculated
     11 // to 26 digits (by using the "Digit number" drop-down control of each
     12 // calculator).
     13 //
     14 // The Go copyright notice:
     15 // ====================================================
     16 // Copyright (c) 2009 The Go Authors. All rights reserved.
     17 //
     18 // Redistribution and use in source and binary forms, with or without
     19 // modification, are permitted provided that the following conditions are
     20 // met:
     21 //
     22 //    * Redistributions of source code must retain the above copyright
     23 // notice, this list of conditions and the following disclaimer.
     24 //    * Redistributions in binary form must reproduce the above
     25 // copyright notice, this list of conditions and the following disclaimer
     26 // in the documentation and/or other materials provided with the
     27 // distribution.
     28 //    * Neither the name of Google Inc. nor the names of its
     29 // contributors may be used to endorse or promote products derived from
     30 // this software without specific prior written permission.
     31 //
     32 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     33 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     34 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     35 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     36 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     37 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     38 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     39 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     40 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     41 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     42 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     43 // ====================================================
     44 
     45 const TEST_INPUTS: [_]f64 = [
     46 	4.9790119248836735e+00,
     47 	7.7388724745781045e+00,
     48 	-2.7688005719200159e-01,
     49 	-5.0106036182710749e+00,
     50 	9.6362937071984173e+00,
     51 	2.9263772392439646e+00,
     52 	5.2290834314593066e+00,
     53 	2.7279399104360102e+00,
     54 	1.8253080916808550e+00,
     55 	-8.6859247685756013e+00,
     56 ];
     57 
     58 const TEST_ACOS: [_]f64 = [
     59 	1.0496193546107222142571536e+00,
     60 	6.8584012813664425171660692e-01,
     61 	1.5984878714577160325521819e+00,
     62 	2.0956199361475859327461799e+00,
     63 	2.7053008467824138592616927e-01,
     64 	1.2738121680361776018155625e+00,
     65 	1.0205369421140629186287407e+00,
     66 	1.2945003481781246062157835e+00,
     67 	1.3872364345374451433846657e+00,
     68 	2.6231510803970463967294145e+00,
     69 ];
     70 const TEST_ACOSH: [_]f64 = [
     71 	2.4743347004159012494457618e+00,
     72 	2.8576385344292769649802701e+00,
     73 	7.2796961502981066190593175e-01,
     74 	2.4796794418831451156471977e+00,
     75 	3.0552020742306061857212962e+00,
     76 	2.044238592688586588942468e+00,
     77 	2.5158701513104513595766636e+00,
     78 	1.99050839282411638174299e+00,
     79 	1.6988625798424034227205445e+00,
     80 	2.9611454842470387925531875e+00,
     81 ];
     82 const TEST_ASIN: [_]f64 = [
     83 	5.2117697218417440497416805e-01,
     84 	8.8495619865825236751471477e-01,
     85 	-2.769154466281941332086016e-02,
     86 	-5.2482360935268931351485822e-01,
     87 	1.3002662421166552333051524e+00,
     88 	2.9698415875871901741575922e-01,
     89 	5.5025938468083370060258102e-01,
     90 	2.7629597861677201301553823e-01,
     91 	1.83559892257451475846656e-01,
     92 	-1.0523547536021497774980928e+00,
     93 ];
     94 const TEST_ASINH: [_]f64 = [
     95 	2.3083139124923523427628243e+00,
     96 	2.743551594301593620039021e+00,
     97 	-2.7345908534880091229413487e-01,
     98 	-2.3145157644718338650499085e+00,
     99 	2.9613652154015058521951083e+00,
    100 	1.7949041616585821933067568e+00,
    101 	2.3564032905983506405561554e+00,
    102 	1.7287118790768438878045346e+00,
    103 	1.3626658083714826013073193e+00,
    104 	-2.8581483626513914445234004e+00,
    105 ];
    106 const TEST_ATAN: [_]f64 = [
    107 	1.372590262129621651920085e+00,
    108 	1.442290609645298083020664e+00,
    109 	-2.7011324359471758245192595e-01,
    110 	-1.3738077684543379452781531e+00,
    111 	1.4673921193587666049154681e+00,
    112 	1.2415173565870168649117764e+00,
    113 	1.3818396865615168979966498e+00,
    114 	1.2194305844639670701091426e+00,
    115 	1.0696031952318783760193244e+00,
    116 	-1.4561721938838084990898679e+00,
    117 ];
    118 const TEST_ATAN2: [_]f64 = [
    119 	1.1088291730037004444527075e+00,
    120 	9.1218183188715804018797795e-01,
    121 	1.5984772603216203736068915e+00,
    122 	2.0352918654092086637227327e+00,
    123 	8.0391819139044720267356014e-01,
    124 	1.2861075249894661588866752e+00,
    125 	1.0889904479131695712182587e+00,
    126 	1.3044821793397925293797357e+00,
    127 	1.3902530903455392306872261e+00,
    128 	2.2859857424479142655411058e+00,
    129 ];
    130 const TEST_ATANH: [_]f64 = [
    131 	5.4651163712251938116878204e-01,
    132 	1.0299474112843111224914709e+00,
    133 	-2.7695084420740135145234906e-02,
    134 	-5.5072096119207195480202529e-01,
    135 	1.9943940993171843235906642e+00,
    136 	3.01448604578089708203017e-01,
    137 	5.8033427206942188834370595e-01,
    138 	2.7987997499441511013958297e-01,
    139 	1.8459947964298794318714228e-01,
    140 	-1.3273186910532645867272502e+00,
    141 ];
    142 const TEST_CEIL: [_]f64 = [
    143 	5.0000000000000000e+00,
    144 	8.0000000000000000e+00,
    145 	-0.0000000000000000e+00,
    146 	-5.0000000000000000e+00,
    147 	1.0000000000000000e+01,
    148 	3.0000000000000000e+00,
    149 	6.0000000000000000e+00,
    150 	3.0000000000000000e+00,
    151 	2.0000000000000000e+00,
    152 	-8.0000000000000000e+00,
    153 ];
    154 const TEST_COS: [_]f64 = [
    155 	2.634752140995199110787593e-01,
    156 	1.148551260848219865642039e-01,
    157 	9.6191297325640768154550453e-01,
    158 	2.938141150061714816890637e-01,
    159 	-9.777138189897924126294461e-01,
    160 	-9.7693041344303219127199518e-01,
    161 	4.940088096948647263961162e-01,
    162 	-9.1565869021018925545016502e-01,
    163 	-2.517729313893103197176091e-01,
    164 	-7.39241351595676573201918e-01,
    165 ];
    166 // Results for 100000 * PI + TEST_INPUTS[i]
    167 const TEST_COSLARGE: [_]f64 = [
    168 	2.634752141185559426744e-01,
    169 	1.14855126055543100712e-01,
    170 	9.61912973266488928113e-01,
    171 	2.9381411499556122552e-01,
    172 	-9.777138189880161924641e-01,
    173 	-9.76930413445147608049e-01,
    174 	4.940088097314976789841e-01,
    175 	-9.15658690217517835002e-01,
    176 	-2.51772931436786954751e-01,
    177 	-7.3924135157173099849e-01,
    178 ];
    179 const TEST_COSH: [_]f64 = [
    180 	7.2668796942212842775517446e+01,
    181 	1.1479413465659254502011135e+03,
    182 	1.0385767908766418550935495e+00,
    183 	7.5000957789658051428857788e+01,
    184 	7.655246669605357888468613e+03,
    185 	9.3567491758321272072888257e+00,
    186 	9.331351599270605471131735e+01,
    187 	7.6833430994624643209296404e+00,
    188 	3.1829371625150718153881164e+00,
    189 	2.9595059261916188501640911e+03,
    190 ];
    191 const TEST_EXP: [_]f64 = [
    192 	1.4533071302642137507696589e+02,
    193 	2.2958822575694449002537581e+03,
    194 	7.5814542574851666582042306e-01,
    195 	6.6668778421791005061482264e-03,
    196 	1.5310493273896033740861206e+04,
    197 	1.8659907517999328638667732e+01,
    198 	1.8662167355098714543942057e+02,
    199 	1.5301332413189378961665788e+01,
    200 	6.2047063430646876349125085e+00,
    201 	1.6894712385826521111610438e-04,
    202 ];
    203 const TEST_EXP2: [_]f64 = [
    204 	3.1537839463286288034313104e+01,
    205 	2.1361549283756232296144849e+02,
    206 	8.2537402562185562902577219e-01,
    207 	3.1021158628740294833424229e-02,
    208 	7.9581744110252191462569661e+02,
    209 	7.6019905892596359262696423e+00,
    210 	3.7506882048388096973183084e+01,
    211 	6.6250893439173561733216375e+00,
    212 	3.5438267900243941544605339e+00,
    213 	2.4281533133513300984289196e-03,
    214 ];
    215 const TEST_ABSF: [_]f64 = [
    216 	4.9790119248836735e+00,
    217 	7.7388724745781045e+00,
    218 	2.7688005719200159e-01,
    219 	5.0106036182710749e+00,
    220 	9.6362937071984173e+00,
    221 	2.9263772392439646e+00,
    222 	5.2290834314593066e+00,
    223 	2.7279399104360102e+00,
    224 	1.8253080916808550e+00,
    225 	8.6859247685756013e+00,
    226 ];
    227 const TEST_FLOOR: [_]f64 = [
    228 	4.0000000000000000e+00,
    229 	7.0000000000000000e+00,
    230 	-1.0000000000000000e+00,
    231 	-6.0000000000000000e+00,
    232 	9.0000000000000000e+00,
    233 	2.0000000000000000e+00,
    234 	5.0000000000000000e+00,
    235 	2.0000000000000000e+00,
    236 	1.0000000000000000e+00,
    237 	-9.0000000000000000e+00,
    238 ];
    239 const TEST_MODF: [_]f64 = [
    240 	4.197615023265299782906368e-02,
    241 	2.261127525421895434476482e+00,
    242 	3.231794108794261433104108e-02,
    243 	4.989396381728925078391512e+00,
    244 	3.637062928015826201999516e-01,
    245 	1.220868282268106064236690e+00,
    246 	4.770916568540693347699744e+00,
    247 	1.816180268691969246219742e+00,
    248 	8.734595415957246977711748e-01,
    249 	1.314075231424398637614104e+00,
    250 ];
    251 const TEST_FREXP: [_](f64, i64) = [
    252 	(6.2237649061045918750e-01, 3),
    253 	(9.6735905932226306250e-01, 3),
    254 	(-5.5376011438400318000e-01, -1),
    255 	(-6.2632545228388436250e-01, 3),
    256 	(6.02268356699901081250e-01, 4),
    257 	(7.3159430981099115000e-01, 2),
    258 	(6.5363542893241332500e-01, 3),
    259 	(6.8198497760900255000e-01, 2),
    260 	(9.1265404584042750000e-01, 1),
    261 	(-5.4287029803597508250e-01, 4),
    262 ];
    263 const TEST_LOG: [_]f64 = [
    264 	1.605231462693062999102599e+00,
    265 	2.0462560018708770653153909e+00,
    266 	-1.2841708730962657801275038e+00,
    267 	1.6115563905281545116286206e+00,
    268 	2.2655365644872016636317461e+00,
    269 	1.0737652208918379856272735e+00,
    270 	1.6542360106073546632707956e+00,
    271 	1.0035467127723465801264487e+00,
    272 	6.0174879014578057187016475e-01,
    273 	2.161703872847352815363655e+00,
    274 ];
    275 const TEST_LOG10: [_]f64 = [
    276 	6.9714316642508290997617083e-01,
    277 	8.886776901739320576279124e-01,
    278 	-5.5770832400658929815908236e-01,
    279 	6.998900476822994346229723e-01,
    280 	9.8391002850684232013281033e-01,
    281 	4.6633031029295153334285302e-01,
    282 	7.1842557117242328821552533e-01,
    283 	4.3583479968917773161304553e-01,
    284 	2.6133617905227038228626834e-01,
    285 	9.3881606348649405716214241e-01,
    286 ];
    287 const TEST_LOG2: [_]f64 = [
    288 	2.3158594707062190618898251e+00,
    289 	2.9521233862883917703341018e+00,
    290 	-1.8526669502700329984917062e+00,
    291 	2.3249844127278861543568029e+00,
    292 	3.268478366538305087466309e+00,
    293 	1.5491157592596970278166492e+00,
    294 	2.3865580889631732407886495e+00,
    295 	1.447811865817085365540347e+00,
    296 	8.6813999540425116282815557e-01,
    297 	3.118679457227342224364709e+00,
    298 ];
    299 const TEST_LOG1P: []f64 = [
    300 	4.8590257759797794104158205e-02,
    301 	7.4540265965225865330849141e-02,
    302 	-2.7726407903942672823234024e-03,
    303 	-5.1404917651627649094953380e-02,
    304 	9.1998280672258624681335010e-02,
    305 	2.8843762576593352865894824e-02,
    306 	5.0969534581863707268992645e-02,
    307 	2.6913947602193238458458594e-02,
    308 	1.8088493239630770262045333e-02,
    309 	-9.0865245631588989681559268e-02,
    310 ];
    311 const TEST_MODFRAC: [_](i64, f64) = [
    312 	(4i64, 9.7901192488367350108546816e-01),
    313 	(7i64, 7.3887247457810456552351752e-01),
    314 	(-0i64, -2.7688005719200159404635997e-01),
    315 	(-5i64, -1.060361827107492160848778e-02),
    316 	(9i64, 6.3629370719841737980004837e-01),
    317 	(2i64, 9.2637723924396464525443662e-01),
    318 	(5i64, 2.2908343145930665230025625e-01),
    319 	(2i64, 7.2793991043601025126008608e-01),
    320 	(1i64, 8.2530809168085506044576505e-01),
    321 	(-8i64, -6.8592476857560136238589621e-01),
    322 ];
    323 const TEST_POW: [_]f64 = [
    324 	9.5282232631648411840742957e+04,
    325 	5.4811599352999901232411871e+07,
    326 	5.2859121715894396531132279e-01,
    327 	9.7587991957286474464259698e-06,
    328 	4.328064329346044846740467e+09,
    329 	8.4406761805034547437659092e+02,
    330 	1.6946633276191194947742146e+05,
    331 	5.3449040147551939075312879e+02,
    332 	6.688182138451414936380374e+01,
    333 	2.0609869004248742886827439e-09,
    334 ];
    335 const TEST_ROUND: [_]f64 = [
    336 	5.0f64,
    337 	8.0f64,
    338 	-0.0f64,
    339 	-5.0f64,
    340 	10.0f64,
    341 	3.0f64,
    342 	5.0f64,
    343 	3.0f64,
    344 	2.0f64,
    345 	-9.0f64,
    346 ];
    347 const TEST_SIGNF: [_]i8 = [
    348 	1,
    349 	1,
    350 	-1,
    351 	-1,
    352 	1,
    353 	1,
    354 	1,
    355 	1,
    356 	1,
    357 	-1,
    358 ];
    359 const TEST_SIN: [_]f64 = [
    360 	-9.6466616586009283766724726e-01,
    361 	9.9338225271646545763467022e-01,
    362 	-2.7335587039794393342449301e-01,
    363 	9.5586257685042792878173752e-01,
    364 	-2.099421066779969164496634e-01,
    365 	2.135578780799860532750616e-01,
    366 	-8.694568971167362743327708e-01,
    367 	4.019566681155577786649878e-01,
    368 	9.6778633541687993721617774e-01,
    369 	-6.734405869050344734943028e-01,
    370 ];
    371 // Results for 100000 * PI + TEST_INPUTS[i]
    372 const TEST_SINLARGE: [_]f64 = [
    373 	-9.646661658548936063912e-01,
    374 	9.933822527198506903752e-01,
    375 	-2.7335587036246899796e-01,
    376 	9.55862576853689321268e-01,
    377 	-2.099421066862688873691e-01,
    378 	2.13557878070308981163e-01,
    379 	-8.694568970959221300497e-01,
    380 	4.01956668098863248917e-01,
    381 	9.67786335404528727927e-01,
    382 	-6.7344058693131973066e-01,
    383 ];
    384 const TEST_SINH: [_]f64 = [
    385 	7.2661916084208532301448439e+01,
    386 	1.1479409110035194500526446e+03,
    387 	-2.8043136512812518927312641e-01,
    388 	-7.499429091181587232835164e+01,
    389 	7.6552466042906758523925934e+03,
    390 	9.3031583421672014313789064e+00,
    391 	9.330815755828109072810322e+01,
    392 	7.6179893137269146407361477e+00,
    393 	3.021769180549615819524392e+00,
    394 	-2.95950575724449499189888e+03,
    395 ];
    396 const TEST_SQRT: [_]f64 = [
    397 	2.2313699659365484748756904e+00,
    398 	2.7818829009464263511285458e+00,
    399 	5.2619393496314796848143251e-01,
    400 	2.2384377628763938724244104e+00,
    401 	3.1042380236055381099288487e+00,
    402 	1.7106657298385224403917771e+00,
    403 	2.286718922705479046148059e+00,
    404 	1.6516476350711159636222979e+00,
    405 	1.3510396336454586262419247e+00,
    406 	2.9471892997524949215723329e+00,
    407 ];
    408 const TEST_TAN: [_]f64 = [
    409 	-3.661316565040227801781974e+00,
    410 	8.64900232648597589369854e+00,
    411 	-2.8417941955033612725238097e-01,
    412 	3.253290185974728640827156e+00,
    413 	2.147275640380293804770778e-01,
    414 	-2.18600910711067004921551e-01,
    415 	-1.760002817872367935518928e+00,
    416 	-4.389808914752818126249079e-01,
    417 	-3.843885560201130679995041e+00,
    418 	9.10988793377685105753416e-01,
    419 ];
    420 // Results for 100000 * PI + TEST_INPUTS[i]
    421 const TEST_TANLARGE: [_]f64 = [
    422 	-3.66131656475596512705e+00,
    423 	8.6490023287202547927e+00,
    424 	-2.841794195104782406e-01,
    425 	3.2532901861033120983e+00,
    426 	2.14727564046880001365e-01,
    427 	-2.18600910700688062874e-01,
    428 	-1.760002817699722747043e+00,
    429 	-4.38980891453536115952e-01,
    430 	-3.84388555942723509071e+00,
    431 	9.1098879344275101051e-01,
    432 ];
    433 const TEST_TANH: [_]f64 = [
    434 	9.9990531206936338549262119e-01,
    435 	9.9999962057085294197613294e-01,
    436 	-2.7001505097318677233756845e-01,
    437 	-9.9991110943061718603541401e-01,
    438 	9.9999999146798465745022007e-01,
    439 	9.9427249436125236705001048e-01,
    440 	9.9994257600983138572705076e-01,
    441 	9.9149409509772875982054701e-01,
    442 	9.4936501296239685514466577e-01,
    443 	-9.9999994291374030946055701e-01,
    444 ];
    445 const TEST_TRUNC: [_]f64 = [
    446 	4.0000000000000000e+00,
    447 	7.0000000000000000e+00,
    448 	-0.0000000000000000e+00,
    449 	-5.0000000000000000e+00,
    450 	9.0000000000000000e+00,
    451 	2.0000000000000000e+00,
    452 	5.0000000000000000e+00,
    453 	2.0000000000000000e+00,
    454 	1.0000000000000000e+00,
    455 	-8.0000000000000000e+00,
    456 ];