num/num_more_extensions library
Extensions
- NumMoreExtensions on num
- Number More: clamp non-negative, isInteger, round half up, truncate decimals, percentage, degrees/radians, etc. Roadmap #311-325.
Functions
-
degreesToRadians(
double deg) → double -
Converts an angle in degrees (
deg) to radians. -
digitSum(
int n) → int -
Returns the sum of the decimal digits of
n. -
isPowerOfTwo(
int n) → bool -
Returns
trueifnis a positive power of two (1, 2, 4, 8, …). -
isqrt(
int n) → int -
Returns the integer square root of
n(the floor of its real square root). -
nextPowerOfTwo(
int n) → int -
Returns the smallest power of two greater than or equal to
n. -
normalizeAngle180(
double degrees) → double -
Normalizes
degreesinto the range(-180, 180]. -
normalizeAngle360(
double degrees) → double -
Normalizes
degreesinto the range[0, 360). -
radiansToDegrees(
double rad) → double -
Converts an angle in radians (
rad) to degrees.