string.ratio
| Syntax |
string.ratio (numerator, denominator, places)
|
| Params |
numerator is a number, the numerator of the fraction.
denominator is a number, the denominator of the fraction.
places is a number, the maximum number of places to the right of the decimal point in the resulting string.
|
| Action |
Computes the ratio in double precision, converts it to a string and truncates the string according to the value of places.
|
| Returns |
The resulting string.
|
| Examples |
string.ratio (12, 100, 3)
» "0.12"
string.ratio (1, 3, 5)
» "0.33333"
string.ratio (1, 3, 1)
» "0.3"
string.ratio (12.01, 100.1, 3)
» "0.119"
string.ratio (file.size (Frontier.getFilePath ()), file.volumeSize ("C:"), 8)
» "0.00060182"
string.ratio (12, 0, 3) //error, can't divide by zero
|
| Notes |
This verb is new in 5.1.5.
It's implemented as a script.
|
|