Math Module
Calculates the number of decimals needed to show a float with a given number of significant digits, and rounds the float to those decimals.
Functions and values
| Function or value |
Description
|
Full Usage:
fixPrecision n f
Parameters:
int
f : float
Returns: float
|
Rounds f to the number of decimals that shows at least n significant digits. For example, 0.0666 |> fixPrecision 2 = 0.067 and 6.6666 |> fixPrecision 2 = 6.7. Returns f unchanged when n is negative. The number of decimals is at most 15, because Math.Round takes at most 15 decimals for a float.
|
Full Usage:
getPrecision n f
Parameters:
int
f : float
Returns: int
|
Returns the number of decimals that shows f with at least n significant digits. For example, 0.0666 |> getPrecision 2 = 3 and 6.6666 |> getPrecision 2 = 1. A negative n counts as 0. Returns n when f is zero, infinite or not a number.
|
GenPRES