Improve llFrand.

- Remove it from lslextrafuncs, and move all the code to lslbasefuncs.
- Make it behave like SL's more accurately. Denormals return 0 always in SL.
- Use int() for truncation rather then floor/ceil.
- Add test cases.
This commit is contained in:
Sei Lisa 2016-12-22 01:05:21 +01:00
parent fc97ce42df
commit 159fae90bf
3 changed files with 40 additions and 28 deletions

View file

@ -890,6 +890,21 @@ def do_tests():
test('llList2CSV([llPow(nan,F32(1.3))])', u'nan')
test('llList2CSV([Vector((-nan,nan,-inf))])', u'<-nan, nan, -inf>')
test('llFrand(0.0)', 0.0)
test('llFrand(-0.0)', 0.0)
test('llFrand(Infinity)', 0.0)
test('llFrand(-Infinity)', 0.0)
test('llFrand(-NaN)', -NaN)
test('llFrand(NaN)', NaN)
for i in range(10):
test('llFrand(F32(1.4e-45))', 0.0)
test('llFrand(F32(1.1754943508222875e-38))', 0.0)
lslcommon.IsCalc = True
test('cond(llGenerateKey())', True)
lslcommon.IsCalc = False
shouldexcept('llGenerateKey()', ELSLCantCompute)
testXB64S("", "", "")
testXB64S(u"Hello, World!", u"", u"Hello, World!")
testXB64S("AAAAA==AAAAA=", "_X", "/X/X/==X/X/X=")