add a few more tests for floating point rands() seeds, and expected results.

This commit is contained in:
Don Bright 2015-09-23 20:03:34 -05:00
parent 3327231847
commit d2d273895e
2 changed files with 13 additions and 0 deletions

View file

@ -35,6 +35,13 @@ v = rands(1,1,4);
echo( v );
echo( rands(1,2,3,4.1) );
echo( rands(1,2,3,-4.1) );
echo( rands(1,2,3,-4.1e100) );
echo( rands(1,2,3,4.1e100) );
echo( rands(1,2,3,-4.1e-100) );
echo( rands(1,2,3,4.1e-100) );
// part 2 - verify seeded rands() behavior with bizarro infinite inputs
echo("rands(1/0,1/0,1/0,1/0)", rands(1/0,1/0,1/0,1/0));
echo("rands(1/0,1/0,1/0,-1/0)", rands(1/0,1/0,1/0,-1/0));

View file

@ -1,6 +1,12 @@
WARNING: Ignoring unknown variable 'v'.
ECHO: "i hope rands() did not crash"
ECHO: [1, 1, 1, 1]
ECHO: [1.4486, 1.96977, 1.8777]
ECHO: [1.62213, 1.19758, 1.75764]
ECHO: [1.17089, 1.47102, 1.39911]
ECHO: [1.27118, 1.21889, 1.03937]
ECHO: [1.52706, 1.18352, 1.5901]
ECHO: [1.1334, 1.71837, 1.49197]
WARNING: rands() range cannot be -infinity
WARNING: resetting to -89884656743115785407263711865852178399035283762922498299458738401578630390014269380294779316383439085770229476757191232117160663444732091384233773351768758493024955288275641038122745045194664472037934254227566971152291618451611474082904279666061674137398913102072361584369088590459649940625202013092062429184.000000
WARNING: rands() max cannot be infinity