Class: H_math

H_math

Small utility class for math operations (you'll find it in generics.js).
Provides static methods for parsing, rounding, and checking numbers.
Used as h.libs.math.

new H_math()

generics.js, line 347

Methods

staticH_math.extract_float(str){number}

generics.js, line 364
Extracts a float from a string.
Returns 0.0 if not found.
Name Type Description
str string String to parse.
Returns:
Type Description
number Float value.

staticH_math.extract_int(str){number}

generics.js, line 388
Extracts an integer from a string.
Returns 0 if not found.
Name Type Description
str string String to parse.
Returns:
Type Description
number Integer value.

staticH_math.is_even(a){boolean|NaN}

generics.js, line 424
Checks if a number is even.
Name Type Description
a number Number to check.
Returns:
Type Description
boolean | NaN True if even, NaN if not a number.

staticH_math.is_odd(a){boolean|NaN}

generics.js, line 411
Checks if a number is odd.
Name Type Description
a number Number to check.
Returns:
Type Description
boolean | NaN True if odd, NaN if not a number.

staticH_math.round_float(fl, rn){number}

generics.js, line 438
Rounds a float to a given number of decimals.
Name Type Default Description
fl number Float to round.
rn number 8 optional Number of decimals.
Returns:
Type Description
number Rounded float.