BSL:Manual: Difference between revisions

131 bytes added ,  6 December 2015
m
→‎float: wording; mentioning that floats are unused by Oni's scripts
m (→‎float: wording; mentioning that floats are unused by Oni's scripts)
Line 328: Line 328:


===float===
===float===
A [[wikipedia:floating point|floating-point]] number. BSL was not designed for performing serious math, so floats are somewhat lacking in precision.
A [[wikipedia:floating point|floating-point]] number. Bungie West actually never used floats in their scripts for Oni, which explains why there are certain rough aspects to them. For instance, floats are limited to six decimal places of precision:


  var float good_example = 10.5; # returns as "10.500000"
  var float good_example = 10.5; # returns as "10.500000"
  var float too_precise = 3.141592653589793; # returns as "3.141593"
  var float too_precise = 3.141592653589793; # returns as "3.141593"


Adding a value below the sixth decimal place to a float will have no effect, e.g. 3.0 plus 0.0000001.
Thus, adding a value below the sixth decimal place to a float will have no effect, e.g. 3.000000 + 0.0000001 = 3.000000. Additionally, adding an int (or a bool) to a float has no effect:
 
Adding an int (or a bool) to a float has no effect:


  func float test_float_addition(void)
  func float test_float_addition(void)