Scol standard library package
0.3.1
Common and usefull functions for all Scol applications
|
Functions | |
std_fClamp (f, startf, endf) | |
Clamp a float number in a range. | |
std_fCmp (f1, f2) | |
Compare two float numbers (depending of epsilon) | |
std_fDivide (f1, f2) | |
Perform a division between two float numbers The function returns a tuple : the result, the entire and the decimal parts of the result. | |
std_fEpsilonGet () | |
Get the 'epsilon' to compare deux floating point numbers. | |
std_fEpsilonSet (f) | |
Set the 'epsilon' to compare deux floating point numbers. | |
std_fInRange (f, startf, endf) | |
Return if a a float number in a range. | |
std_fIntDec (f) | |
Return the entire and the decimal parts of a float number. | |
std_fIsZero (f) | |
Return if a float number is near at zero (depending of epsilon) | |
std_vectorIsEqualF (v1, v2) | |
Return if two float vectors are equals. |
Detailed Description
Package to load : lib/std/float.pkg
Function Documentation
std_fEpsilonGet | ( | ) |
Get the 'epsilon' to compare deux floating point numbers.
By default, this value is 0.000001
Prototype : : fun [] F
- Returns
- F : the current epsilon
std_fEpsilonSet | ( | f | ) |
Set the 'epsilon' to compare deux floating point numbers.
By default, this value is 0.000001
Prototype : : fun [F] F
- Parameters
-
F : a new 'epsilon'
- Returns
- F : the same value
std_fIsZero | ( | f | ) |
Return if a float number is near at zero (depending of epsilon)
- See Also
- std_fEpsilonSet
- std_fEpsilonGet
Prototype : : fun [F] I
- Parameters
-
F : value to test
- Returns
- I : 1 if zero else 0
std_fCmp | ( | f1 | , |
f2 | |||
) |
Compare two float numbers (depending of epsilon)
- See Also
- std_fEpsilonSet
- std_fEpsilonGet
Prototype : : fun [F F] I
- Parameters
-
F : a float number F : another float number
- Returns
- I : 1 if they are equals else 0
std_fInRange | ( | f | , |
startf | , | ||
endf | |||
) |
Return if a a float number in a range.
Prototype : : fun [F F F] I
- Parameters
-
F : a float number F : the bottom of the range (start) F : the top of the range (end)
- Returns
- I : 1 if success, 0 if fail or nil if error (start > end)
std_fClamp | ( | f | , |
startf | , | ||
endf | |||
) |
Clamp a float number in a range.
Prototype : : fun [F F F] F
- Parameters
-
F : a float number F : the bottom of the range (start) F : the top of the range (end)
- Returns
- F : the float number clamped or nil if error (start > end)
std_fIntDec | ( | f | ) |
Return the entire and the decimal parts of a float number.
- Remarks
- the decimal part can be rounded.
Prototype : : fun [F] [I F]
- Parameters
-
F : a float number
- Returns
- [I F] : the tuple
std_fDivide | ( | f1 | , |
f2 | |||
) |
Perform a division between two float numbers The function returns a tuple : the result, the entire and the decimal parts of the result.
_fooS sprintf "%f %i %f" std_fDivide 10.25 5.0; // 2,050000 2 0,050000
- Remarks
- the decimal part can be rounded.
Prototype : : fun [F] [F I F]
- Parameters
-
F : a float number
- Returns
- [F I F] : the result and the entire and decimal parts of the result
std_vectorIsEqualF | ( | v1 | , |
v2 | |||
) |
Return if two float vectors are equals.
Prototype: fun [[F F F] [F F F]] I
- Parameters
-
[F F F] : first float vector [F F F] : second float vector
- Returns
- I : 1 if are equuals else 0
- Remarks
- The float number are compared with an 'epsilon'.
Generated on Sat Jan 31 2015 19:15:44 for Scol standard library package by 1.8.1.2