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

@ -17,11 +17,10 @@
# Extra functions that have predictable return values for certain arguments.
import lslcommon
from lslcommon import Key #, Vector, Quaternion
from lslbasefuncs import ELSLCantCompute, isinteger, iskey, islist, \
isfloat, isvector, isstring, NULL_KEY, ZERO_VECTOR, ZERO_ROTATION, cond
#isrotation
isvector, isstring, NULL_KEY, ZERO_VECTOR, ZERO_ROTATION, cond
#isfloat, isrotation
TouchEvents = ('touch', 'touch_start', 'touch_end')
DetectionEvents = ('touch', 'touch_start', 'touch_end',
@ -147,13 +146,6 @@ def llEdgeOfWorld(v1, v2):
return 1
raise ELSLCantCompute
if not lslcommon.IsCalc:
def llFrand(f):
assert isfloat(f)
if f == 0:
return 0.
raise ELSLCantCompute
def llGetAgentInfo(id):
assert iskey(id)
if not cond(id):