@nberlette/math 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +889 -0
- package/cjs/abs.d.ts +14 -0
- package/cjs/abs.d.ts.map +1 -0
- package/cjs/abs.js +22 -0
- package/cjs/abs.js.map +1 -0
- package/cjs/acos.d.ts +17 -0
- package/cjs/acos.d.ts.map +1 -0
- package/cjs/acos.js +27 -0
- package/cjs/acos.js.map +1 -0
- package/cjs/acosh.d.ts +11 -0
- package/cjs/acosh.d.ts.map +1 -0
- package/cjs/acosh.js +35 -0
- package/cjs/acosh.js.map +1 -0
- package/cjs/asin.d.ts +11 -0
- package/cjs/asin.d.ts.map +1 -0
- package/cjs/asin.js +28 -0
- package/cjs/asin.js.map +1 -0
- package/cjs/asinh.d.ts +9 -0
- package/cjs/asinh.d.ts.map +1 -0
- package/cjs/asinh.js +26 -0
- package/cjs/asinh.js.map +1 -0
- package/cjs/atan.d.ts +11 -0
- package/cjs/atan.d.ts.map +1 -0
- package/cjs/atan.js +65 -0
- package/cjs/atan.js.map +1 -0
- package/cjs/atan2.d.ts +12 -0
- package/cjs/atan2.d.ts.map +1 -0
- package/cjs/atan2.js +70 -0
- package/cjs/atan2.js.map +1 -0
- package/cjs/atanh.d.ts +11 -0
- package/cjs/atanh.d.ts.map +1 -0
- package/cjs/atanh.js +32 -0
- package/cjs/atanh.js.map +1 -0
- package/cjs/cbrt.d.ts +9 -0
- package/cjs/cbrt.d.ts.map +1 -0
- package/cjs/cbrt.js +26 -0
- package/cjs/cbrt.js.map +1 -0
- package/cjs/ceil.d.ts +15 -0
- package/cjs/ceil.d.ts.map +1 -0
- package/cjs/ceil.js +34 -0
- package/cjs/ceil.js.map +1 -0
- package/cjs/clamp.d.ts +15 -0
- package/cjs/clamp.d.ts.map +1 -0
- package/cjs/clamp.js +32 -0
- package/cjs/clamp.js.map +1 -0
- package/cjs/clz32.d.ts +20 -0
- package/cjs/clz32.d.ts.map +1 -0
- package/cjs/clz32.js +48 -0
- package/cjs/clz32.js.map +1 -0
- package/cjs/constants/e.d.ts +17 -0
- package/cjs/constants/e.d.ts.map +1 -0
- package/cjs/constants/e.js +19 -0
- package/cjs/constants/e.js.map +1 -0
- package/cjs/constants/epsilon.d.ts +24 -0
- package/cjs/constants/epsilon.d.ts.map +1 -0
- package/cjs/constants/epsilon.js +26 -0
- package/cjs/constants/epsilon.js.map +1 -0
- package/cjs/constants/index.d.ts +23 -0
- package/cjs/constants/index.d.ts.map +1 -0
- package/cjs/constants/index.js +39 -0
- package/cjs/constants/index.js.map +1 -0
- package/cjs/constants/infinity.d.ts +3 -0
- package/cjs/constants/infinity.d.ts.map +1 -0
- package/cjs/constants/infinity.js +19 -0
- package/cjs/constants/infinity.js.map +1 -0
- package/cjs/constants/ln10.d.ts +10 -0
- package/cjs/constants/ln10.d.ts.map +1 -0
- package/cjs/constants/ln10.js +12 -0
- package/cjs/constants/ln10.js.map +1 -0
- package/cjs/constants/ln2.d.ts +10 -0
- package/cjs/constants/ln2.d.ts.map +1 -0
- package/cjs/constants/ln2.js +12 -0
- package/cjs/constants/ln2.js.map +1 -0
- package/cjs/constants/log10e.d.ts +10 -0
- package/cjs/constants/log10e.d.ts.map +1 -0
- package/cjs/constants/log10e.js +12 -0
- package/cjs/constants/log10e.js.map +1 -0
- package/cjs/constants/log2e.d.ts +10 -0
- package/cjs/constants/log2e.d.ts.map +1 -0
- package/cjs/constants/log2e.js +12 -0
- package/cjs/constants/log2e.js.map +1 -0
- package/cjs/constants/max_safe_integer.d.ts +11 -0
- package/cjs/constants/max_safe_integer.d.ts.map +1 -0
- package/cjs/constants/max_safe_integer.js +13 -0
- package/cjs/constants/max_safe_integer.js.map +1 -0
- package/cjs/constants/max_value.d.ts +10 -0
- package/cjs/constants/max_value.d.ts.map +1 -0
- package/cjs/constants/max_value.js +12 -0
- package/cjs/constants/max_value.js.map +1 -0
- package/cjs/constants/min_safe_integer.d.ts +12 -0
- package/cjs/constants/min_safe_integer.d.ts.map +1 -0
- package/cjs/constants/min_safe_integer.js +14 -0
- package/cjs/constants/min_safe_integer.js.map +1 -0
- package/cjs/constants/min_value.d.ts +10 -0
- package/cjs/constants/min_value.d.ts.map +1 -0
- package/cjs/constants/min_value.js +12 -0
- package/cjs/constants/min_value.js.map +1 -0
- package/cjs/constants/nan.d.ts +47 -0
- package/cjs/constants/nan.d.ts.map +1 -0
- package/cjs/constants/nan.js +30 -0
- package/cjs/constants/nan.js.map +1 -0
- package/cjs/constants/negative_infinity.d.ts +28 -0
- package/cjs/constants/negative_infinity.d.ts.map +1 -0
- package/cjs/constants/negative_infinity.js +15 -0
- package/cjs/constants/negative_infinity.js.map +1 -0
- package/cjs/constants/negative_zero.d.ts +31 -0
- package/cjs/constants/negative_zero.d.ts.map +1 -0
- package/cjs/constants/negative_zero.js +21 -0
- package/cjs/constants/negative_zero.js.map +1 -0
- package/cjs/constants/pi.d.ts +10 -0
- package/cjs/constants/pi.d.ts.map +1 -0
- package/cjs/constants/pi.js +12 -0
- package/cjs/constants/pi.js.map +1 -0
- package/cjs/constants/positive_infinity.d.ts +29 -0
- package/cjs/constants/positive_infinity.d.ts.map +1 -0
- package/cjs/constants/positive_infinity.js +16 -0
- package/cjs/constants/positive_infinity.js.map +1 -0
- package/cjs/constants/positive_zero.d.ts +38 -0
- package/cjs/constants/positive_zero.d.ts.map +1 -0
- package/cjs/constants/positive_zero.js +36 -0
- package/cjs/constants/positive_zero.js.map +1 -0
- package/cjs/constants/sqrt1_2.d.ts +9 -0
- package/cjs/constants/sqrt1_2.d.ts.map +1 -0
- package/cjs/constants/sqrt1_2.js +11 -0
- package/cjs/constants/sqrt1_2.js.map +1 -0
- package/cjs/constants/sqrt2.d.ts +9 -0
- package/cjs/constants/sqrt2.d.ts.map +1 -0
- package/cjs/constants/sqrt2.js +11 -0
- package/cjs/constants/sqrt2.js.map +1 -0
- package/cjs/cos.d.ts +10 -0
- package/cjs/cos.d.ts.map +1 -0
- package/cjs/cos.js +32 -0
- package/cjs/cos.js.map +1 -0
- package/cjs/cosh.d.ts +10 -0
- package/cjs/cosh.d.ts.map +1 -0
- package/cjs/cosh.js +21 -0
- package/cjs/cosh.js.map +1 -0
- package/cjs/exp.d.ts +20 -0
- package/cjs/exp.d.ts.map +1 -0
- package/cjs/exp.js +48 -0
- package/cjs/exp.js.map +1 -0
- package/cjs/expm1.d.ts +11 -0
- package/cjs/expm1.d.ts.map +1 -0
- package/cjs/expm1.js +38 -0
- package/cjs/expm1.js.map +1 -0
- package/cjs/f16round.d.ts +24 -0
- package/cjs/f16round.d.ts.map +1 -0
- package/cjs/f16round.js +42 -0
- package/cjs/f16round.js.map +1 -0
- package/cjs/float16/constants.d.ts +97 -0
- package/cjs/float16/constants.d.ts.map +1 -0
- package/cjs/float16/constants.js +99 -0
- package/cjs/float16/constants.js.map +1 -0
- package/cjs/float16/decode.d.ts +40 -0
- package/cjs/float16/decode.d.ts.map +1 -0
- package/cjs/float16/decode.js +67 -0
- package/cjs/float16/decode.js.map +1 -0
- package/cjs/float16/encode.d.ts +67 -0
- package/cjs/float16/encode.d.ts.map +1 -0
- package/cjs/float16/encode.js +77 -0
- package/cjs/float16/encode.js.map +1 -0
- package/cjs/float16/guards.d.ts +22 -0
- package/cjs/float16/guards.d.ts.map +1 -0
- package/cjs/float16/guards.js +15 -0
- package/cjs/float16/guards.js.map +1 -0
- package/cjs/float16/index.d.ts +11 -0
- package/cjs/float16/index.d.ts.map +1 -0
- package/cjs/float16/index.js +27 -0
- package/cjs/float16/index.js.map +1 -0
- package/cjs/float16/round.d.ts +25 -0
- package/cjs/float16/round.d.ts.map +1 -0
- package/cjs/float16/round.js +46 -0
- package/cjs/float16/round.js.map +1 -0
- package/cjs/float32/constants.d.ts +96 -0
- package/cjs/float32/constants.d.ts.map +1 -0
- package/cjs/float32/constants.js +98 -0
- package/cjs/float32/constants.js.map +1 -0
- package/cjs/float32/decode.d.ts +38 -0
- package/cjs/float32/decode.d.ts.map +1 -0
- package/cjs/float32/decode.js +70 -0
- package/cjs/float32/decode.js.map +1 -0
- package/cjs/float32/encode.d.ts +50 -0
- package/cjs/float32/encode.d.ts.map +1 -0
- package/cjs/float32/encode.js +77 -0
- package/cjs/float32/encode.js.map +1 -0
- package/cjs/float32/guards.d.ts +37 -0
- package/cjs/float32/guards.d.ts.map +1 -0
- package/cjs/float32/guards.js +20 -0
- package/cjs/float32/guards.js.map +1 -0
- package/cjs/float32/index.d.ts +11 -0
- package/cjs/float32/index.d.ts.map +1 -0
- package/cjs/float32/index.js +27 -0
- package/cjs/float32/index.js.map +1 -0
- package/cjs/float32/round.d.ts +23 -0
- package/cjs/float32/round.d.ts.map +1 -0
- package/cjs/float32/round.js +36 -0
- package/cjs/float32/round.js.map +1 -0
- package/cjs/floor.d.ts +10 -0
- package/cjs/floor.d.ts.map +1 -0
- package/cjs/floor.js +32 -0
- package/cjs/floor.js.map +1 -0
- package/cjs/fround.d.ts +23 -0
- package/cjs/fround.d.ts.map +1 -0
- package/cjs/fround.js +35 -0
- package/cjs/fround.js.map +1 -0
- package/cjs/guards/finite.d.ts +23 -0
- package/cjs/guards/finite.d.ts.map +1 -0
- package/cjs/guards/finite.js +21 -0
- package/cjs/guards/finite.js.map +1 -0
- package/cjs/guards/index.d.ts +50 -0
- package/cjs/guards/index.d.ts.map +1 -0
- package/cjs/guards/index.js +66 -0
- package/cjs/guards/index.js.map +1 -0
- package/cjs/guards/infinity.d.ts +3 -0
- package/cjs/guards/infinity.d.ts.map +1 -0
- package/cjs/guards/infinity.js +19 -0
- package/cjs/guards/infinity.js.map +1 -0
- package/cjs/guards/integer.d.ts +47 -0
- package/cjs/guards/integer.d.ts.map +1 -0
- package/cjs/guards/integer.js +23 -0
- package/cjs/guards/integer.js.map +1 -0
- package/cjs/guards/nan.d.ts +61 -0
- package/cjs/guards/nan.d.ts.map +1 -0
- package/cjs/guards/nan.js +68 -0
- package/cjs/guards/nan.js.map +1 -0
- package/cjs/guards/negative_infinity.d.ts +19 -0
- package/cjs/guards/negative_infinity.d.ts.map +1 -0
- package/cjs/guards/negative_infinity.js +25 -0
- package/cjs/guards/negative_infinity.js.map +1 -0
- package/cjs/guards/negative_zero.d.ts +12 -0
- package/cjs/guards/negative_zero.d.ts.map +1 -0
- package/cjs/guards/negative_zero.js +24 -0
- package/cjs/guards/negative_zero.js.map +1 -0
- package/cjs/guards/positive_infinity.d.ts +19 -0
- package/cjs/guards/positive_infinity.d.ts.map +1 -0
- package/cjs/guards/positive_infinity.js +25 -0
- package/cjs/guards/positive_infinity.js.map +1 -0
- package/cjs/guards/positive_zero.d.ts +17 -0
- package/cjs/guards/positive_zero.d.ts.map +1 -0
- package/cjs/guards/positive_zero.js +36 -0
- package/cjs/guards/positive_zero.js.map +1 -0
- package/cjs/guards/safe_integer.d.ts +33 -0
- package/cjs/guards/safe_integer.d.ts.map +1 -0
- package/cjs/guards/safe_integer.js +27 -0
- package/cjs/guards/safe_integer.js.map +1 -0
- package/cjs/hypot.d.ts +18 -0
- package/cjs/hypot.d.ts.map +1 -0
- package/cjs/hypot.js +63 -0
- package/cjs/hypot.js.map +1 -0
- package/cjs/ieee754.d.ts +16 -0
- package/cjs/ieee754.d.ts.map +1 -0
- package/cjs/ieee754.js +32 -0
- package/cjs/ieee754.js.map +1 -0
- package/cjs/imul.d.ts +17 -0
- package/cjs/imul.d.ts.map +1 -0
- package/cjs/imul.js +24 -0
- package/cjs/imul.js.map +1 -0
- package/cjs/index.d.ts +84 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js +113 -0
- package/cjs/index.js.map +1 -0
- package/cjs/internal/ieee754.d.ts +174 -0
- package/cjs/internal/ieee754.d.ts.map +1 -0
- package/cjs/internal/ieee754.js +200 -0
- package/cjs/internal/ieee754.js.map +1 -0
- package/cjs/internal/primordials.d.ts +30 -0
- package/cjs/internal/primordials.d.ts.map +1 -0
- package/cjs/internal/primordials.js +30 -0
- package/cjs/internal/primordials.js.map +1 -0
- package/cjs/log.d.ts +9 -0
- package/cjs/log.d.ts.map +1 -0
- package/cjs/log.js +46 -0
- package/cjs/log.js.map +1 -0
- package/cjs/log10.d.ts +9 -0
- package/cjs/log10.d.ts.map +1 -0
- package/cjs/log10.js +21 -0
- package/cjs/log10.js.map +1 -0
- package/cjs/log1p.d.ts +10 -0
- package/cjs/log1p.d.ts.map +1 -0
- package/cjs/log1p.js +32 -0
- package/cjs/log1p.js.map +1 -0
- package/cjs/log2.d.ts +12 -0
- package/cjs/log2.d.ts.map +1 -0
- package/cjs/log2.js +24 -0
- package/cjs/log2.js.map +1 -0
- package/cjs/max.d.ts +22 -0
- package/cjs/max.d.ts.map +1 -0
- package/cjs/max.js +51 -0
- package/cjs/max.js.map +1 -0
- package/cjs/min.d.ts +10 -0
- package/cjs/min.d.ts.map +1 -0
- package/cjs/min.js +36 -0
- package/cjs/min.js.map +1 -0
- package/cjs/package.json +3 -0
- package/cjs/pow.d.ts +31 -0
- package/cjs/pow.d.ts.map +1 -0
- package/cjs/pow.js +36 -0
- package/cjs/pow.js.map +1 -0
- package/cjs/random.d.ts +93 -0
- package/cjs/random.d.ts.map +1 -0
- package/cjs/random.js +242 -0
- package/cjs/random.js.map +1 -0
- package/cjs/round.d.ts +9 -0
- package/cjs/round.d.ts.map +1 -0
- package/cjs/round.js +24 -0
- package/cjs/round.js.map +1 -0
- package/cjs/sign.d.ts +17 -0
- package/cjs/sign.d.ts.map +1 -0
- package/cjs/sign.js +22 -0
- package/cjs/sign.js.map +1 -0
- package/cjs/sin.d.ts +14 -0
- package/cjs/sin.d.ts.map +1 -0
- package/cjs/sin.js +31 -0
- package/cjs/sin.js.map +1 -0
- package/cjs/sinh.d.ts +14 -0
- package/cjs/sinh.d.ts.map +1 -0
- package/cjs/sinh.js +22 -0
- package/cjs/sinh.js.map +1 -0
- package/cjs/sqrt.d.ts +19 -0
- package/cjs/sqrt.d.ts.map +1 -0
- package/cjs/sqrt.js +45 -0
- package/cjs/sqrt.js.map +1 -0
- package/cjs/tan.d.ts +9 -0
- package/cjs/tan.d.ts.map +1 -0
- package/cjs/tan.js +26 -0
- package/cjs/tan.js.map +1 -0
- package/cjs/tanh.d.ts +17 -0
- package/cjs/tanh.d.ts.map +1 -0
- package/cjs/tanh.js +34 -0
- package/cjs/tanh.js.map +1 -0
- package/cjs/trunc.d.ts +21 -0
- package/cjs/trunc.d.ts.map +1 -0
- package/cjs/trunc.js +50 -0
- package/cjs/trunc.js.map +1 -0
- package/cjs/types/finite.d.ts +16 -0
- package/cjs/types/finite.d.ts.map +1 -0
- package/cjs/types/finite.js +4 -0
- package/cjs/types/finite.js.map +1 -0
- package/cjs/types/float.d.ts +65 -0
- package/cjs/types/float.d.ts.map +1 -0
- package/cjs/types/float.js +4 -0
- package/cjs/types/float.js.map +1 -0
- package/cjs/types/index.d.ts +6 -0
- package/cjs/types/index.d.ts.map +1 -0
- package/cjs/types/index.js +22 -0
- package/cjs/types/index.js.map +1 -0
- package/cjs/types/integer.d.ts +147 -0
- package/cjs/types/integer.d.ts.map +1 -0
- package/cjs/types/integer.js +5 -0
- package/cjs/types/integer.js.map +1 -0
- package/cjs/types/precision.d.ts +46 -0
- package/cjs/types/precision.d.ts.map +1 -0
- package/cjs/types/precision.js +9 -0
- package/cjs/types/precision.js.map +1 -0
- package/cjs/types/safe_integer.d.ts +17 -0
- package/cjs/types/safe_integer.d.ts.map +1 -0
- package/cjs/types/safe_integer.js +5 -0
- package/cjs/types/safe_integer.js.map +1 -0
- package/esm/abs.d.ts +14 -0
- package/esm/abs.d.ts.map +1 -0
- package/esm/abs.js +19 -0
- package/esm/abs.js.map +1 -0
- package/esm/acos.d.ts +17 -0
- package/esm/acos.d.ts.map +1 -0
- package/esm/acos.js +24 -0
- package/esm/acos.js.map +1 -0
- package/esm/acosh.d.ts +11 -0
- package/esm/acosh.d.ts.map +1 -0
- package/esm/acosh.js +32 -0
- package/esm/acosh.js.map +1 -0
- package/esm/asin.d.ts +11 -0
- package/esm/asin.d.ts.map +1 -0
- package/esm/asin.js +25 -0
- package/esm/asin.js.map +1 -0
- package/esm/asinh.d.ts +9 -0
- package/esm/asinh.d.ts.map +1 -0
- package/esm/asinh.js +23 -0
- package/esm/asinh.js.map +1 -0
- package/esm/atan.d.ts +11 -0
- package/esm/atan.d.ts.map +1 -0
- package/esm/atan.js +62 -0
- package/esm/atan.js.map +1 -0
- package/esm/atan2.d.ts +12 -0
- package/esm/atan2.d.ts.map +1 -0
- package/esm/atan2.js +67 -0
- package/esm/atan2.js.map +1 -0
- package/esm/atanh.d.ts +11 -0
- package/esm/atanh.d.ts.map +1 -0
- package/esm/atanh.js +29 -0
- package/esm/atanh.js.map +1 -0
- package/esm/cbrt.d.ts +9 -0
- package/esm/cbrt.d.ts.map +1 -0
- package/esm/cbrt.js +23 -0
- package/esm/cbrt.js.map +1 -0
- package/esm/ceil.d.ts +15 -0
- package/esm/ceil.d.ts.map +1 -0
- package/esm/ceil.js +31 -0
- package/esm/ceil.js.map +1 -0
- package/esm/clamp.d.ts +15 -0
- package/esm/clamp.d.ts.map +1 -0
- package/esm/clamp.js +29 -0
- package/esm/clamp.js.map +1 -0
- package/esm/clz32.d.ts +20 -0
- package/esm/clz32.d.ts.map +1 -0
- package/esm/clz32.js +45 -0
- package/esm/clz32.js.map +1 -0
- package/esm/constants/e.d.ts +17 -0
- package/esm/constants/e.d.ts.map +1 -0
- package/esm/constants/e.js +16 -0
- package/esm/constants/e.js.map +1 -0
- package/esm/constants/epsilon.d.ts +24 -0
- package/esm/constants/epsilon.d.ts.map +1 -0
- package/esm/constants/epsilon.js +23 -0
- package/esm/constants/epsilon.js.map +1 -0
- package/esm/constants/index.d.ts +23 -0
- package/esm/constants/index.d.ts.map +1 -0
- package/esm/constants/index.js +23 -0
- package/esm/constants/index.js.map +1 -0
- package/esm/constants/infinity.d.ts +3 -0
- package/esm/constants/infinity.d.ts.map +1 -0
- package/esm/constants/infinity.js +3 -0
- package/esm/constants/infinity.js.map +1 -0
- package/esm/constants/ln10.d.ts +10 -0
- package/esm/constants/ln10.d.ts.map +1 -0
- package/esm/constants/ln10.js +9 -0
- package/esm/constants/ln10.js.map +1 -0
- package/esm/constants/ln2.d.ts +10 -0
- package/esm/constants/ln2.d.ts.map +1 -0
- package/esm/constants/ln2.js +9 -0
- package/esm/constants/ln2.js.map +1 -0
- package/esm/constants/log10e.d.ts +10 -0
- package/esm/constants/log10e.d.ts.map +1 -0
- package/esm/constants/log10e.js +9 -0
- package/esm/constants/log10e.js.map +1 -0
- package/esm/constants/log2e.d.ts +10 -0
- package/esm/constants/log2e.d.ts.map +1 -0
- package/esm/constants/log2e.js +9 -0
- package/esm/constants/log2e.js.map +1 -0
- package/esm/constants/max_safe_integer.d.ts +11 -0
- package/esm/constants/max_safe_integer.d.ts.map +1 -0
- package/esm/constants/max_safe_integer.js +10 -0
- package/esm/constants/max_safe_integer.js.map +1 -0
- package/esm/constants/max_value.d.ts +10 -0
- package/esm/constants/max_value.d.ts.map +1 -0
- package/esm/constants/max_value.js +9 -0
- package/esm/constants/max_value.js.map +1 -0
- package/esm/constants/min_safe_integer.d.ts +12 -0
- package/esm/constants/min_safe_integer.d.ts.map +1 -0
- package/esm/constants/min_safe_integer.js +11 -0
- package/esm/constants/min_safe_integer.js.map +1 -0
- package/esm/constants/min_value.d.ts +10 -0
- package/esm/constants/min_value.d.ts.map +1 -0
- package/esm/constants/min_value.js +9 -0
- package/esm/constants/min_value.js.map +1 -0
- package/esm/constants/nan.d.ts +47 -0
- package/esm/constants/nan.d.ts.map +1 -0
- package/esm/constants/nan.js +27 -0
- package/esm/constants/nan.js.map +1 -0
- package/esm/constants/negative_infinity.d.ts +28 -0
- package/esm/constants/negative_infinity.d.ts.map +1 -0
- package/esm/constants/negative_infinity.js +12 -0
- package/esm/constants/negative_infinity.js.map +1 -0
- package/esm/constants/negative_zero.d.ts +31 -0
- package/esm/constants/negative_zero.d.ts.map +1 -0
- package/esm/constants/negative_zero.js +18 -0
- package/esm/constants/negative_zero.js.map +1 -0
- package/esm/constants/pi.d.ts +10 -0
- package/esm/constants/pi.d.ts.map +1 -0
- package/esm/constants/pi.js +9 -0
- package/esm/constants/pi.js.map +1 -0
- package/esm/constants/positive_infinity.d.ts +29 -0
- package/esm/constants/positive_infinity.d.ts.map +1 -0
- package/esm/constants/positive_infinity.js +13 -0
- package/esm/constants/positive_infinity.js.map +1 -0
- package/esm/constants/positive_zero.d.ts +38 -0
- package/esm/constants/positive_zero.d.ts.map +1 -0
- package/esm/constants/positive_zero.js +33 -0
- package/esm/constants/positive_zero.js.map +1 -0
- package/esm/constants/sqrt1_2.d.ts +9 -0
- package/esm/constants/sqrt1_2.d.ts.map +1 -0
- package/esm/constants/sqrt1_2.js +8 -0
- package/esm/constants/sqrt1_2.js.map +1 -0
- package/esm/constants/sqrt2.d.ts +9 -0
- package/esm/constants/sqrt2.d.ts.map +1 -0
- package/esm/constants/sqrt2.js +8 -0
- package/esm/constants/sqrt2.js.map +1 -0
- package/esm/cos.d.ts +10 -0
- package/esm/cos.d.ts.map +1 -0
- package/esm/cos.js +29 -0
- package/esm/cos.js.map +1 -0
- package/esm/cosh.d.ts +10 -0
- package/esm/cosh.d.ts.map +1 -0
- package/esm/cosh.js +18 -0
- package/esm/cosh.js.map +1 -0
- package/esm/exp.d.ts +20 -0
- package/esm/exp.d.ts.map +1 -0
- package/esm/exp.js +45 -0
- package/esm/exp.js.map +1 -0
- package/esm/expm1.d.ts +11 -0
- package/esm/expm1.d.ts.map +1 -0
- package/esm/expm1.js +35 -0
- package/esm/expm1.js.map +1 -0
- package/esm/f16round.d.ts +24 -0
- package/esm/f16round.d.ts.map +1 -0
- package/esm/f16round.js +39 -0
- package/esm/f16round.js.map +1 -0
- package/esm/float16/constants.d.ts +97 -0
- package/esm/float16/constants.d.ts.map +1 -0
- package/esm/float16/constants.js +96 -0
- package/esm/float16/constants.js.map +1 -0
- package/esm/float16/decode.d.ts +40 -0
- package/esm/float16/decode.d.ts.map +1 -0
- package/esm/float16/decode.js +61 -0
- package/esm/float16/decode.js.map +1 -0
- package/esm/float16/encode.d.ts +67 -0
- package/esm/float16/encode.d.ts.map +1 -0
- package/esm/float16/encode.js +71 -0
- package/esm/float16/encode.js.map +1 -0
- package/esm/float16/guards.d.ts +22 -0
- package/esm/float16/guards.d.ts.map +1 -0
- package/esm/float16/guards.js +12 -0
- package/esm/float16/guards.js.map +1 -0
- package/esm/float16/index.d.ts +11 -0
- package/esm/float16/index.d.ts.map +1 -0
- package/esm/float16/index.js +11 -0
- package/esm/float16/index.js.map +1 -0
- package/esm/float16/round.d.ts +25 -0
- package/esm/float16/round.d.ts.map +1 -0
- package/esm/float16/round.js +43 -0
- package/esm/float16/round.js.map +1 -0
- package/esm/float32/constants.d.ts +96 -0
- package/esm/float32/constants.d.ts.map +1 -0
- package/esm/float32/constants.js +95 -0
- package/esm/float32/constants.js.map +1 -0
- package/esm/float32/decode.d.ts +38 -0
- package/esm/float32/decode.d.ts.map +1 -0
- package/esm/float32/decode.js +64 -0
- package/esm/float32/decode.js.map +1 -0
- package/esm/float32/encode.d.ts +50 -0
- package/esm/float32/encode.d.ts.map +1 -0
- package/esm/float32/encode.js +71 -0
- package/esm/float32/encode.js.map +1 -0
- package/esm/float32/guards.d.ts +37 -0
- package/esm/float32/guards.d.ts.map +1 -0
- package/esm/float32/guards.js +16 -0
- package/esm/float32/guards.js.map +1 -0
- package/esm/float32/index.d.ts +11 -0
- package/esm/float32/index.d.ts.map +1 -0
- package/esm/float32/index.js +11 -0
- package/esm/float32/index.js.map +1 -0
- package/esm/float32/round.d.ts +23 -0
- package/esm/float32/round.d.ts.map +1 -0
- package/esm/float32/round.js +33 -0
- package/esm/float32/round.js.map +1 -0
- package/esm/floor.d.ts +10 -0
- package/esm/floor.d.ts.map +1 -0
- package/esm/floor.js +29 -0
- package/esm/floor.js.map +1 -0
- package/esm/fround.d.ts +23 -0
- package/esm/fround.d.ts.map +1 -0
- package/esm/fround.js +32 -0
- package/esm/fround.js.map +1 -0
- package/esm/guards/finite.d.ts +23 -0
- package/esm/guards/finite.d.ts.map +1 -0
- package/esm/guards/finite.js +18 -0
- package/esm/guards/finite.js.map +1 -0
- package/esm/guards/index.d.ts +50 -0
- package/esm/guards/index.d.ts.map +1 -0
- package/esm/guards/index.js +50 -0
- package/esm/guards/index.js.map +1 -0
- package/esm/guards/infinity.d.ts +3 -0
- package/esm/guards/infinity.d.ts.map +1 -0
- package/esm/guards/infinity.js +3 -0
- package/esm/guards/infinity.js.map +1 -0
- package/esm/guards/integer.d.ts +47 -0
- package/esm/guards/integer.d.ts.map +1 -0
- package/esm/guards/integer.js +19 -0
- package/esm/guards/integer.js.map +1 -0
- package/esm/guards/nan.d.ts +61 -0
- package/esm/guards/nan.d.ts.map +1 -0
- package/esm/guards/nan.js +63 -0
- package/esm/guards/nan.js.map +1 -0
- package/esm/guards/negative_infinity.d.ts +19 -0
- package/esm/guards/negative_infinity.d.ts.map +1 -0
- package/esm/guards/negative_infinity.js +21 -0
- package/esm/guards/negative_infinity.js.map +1 -0
- package/esm/guards/negative_zero.d.ts +12 -0
- package/esm/guards/negative_zero.d.ts.map +1 -0
- package/esm/guards/negative_zero.js +20 -0
- package/esm/guards/negative_zero.js.map +1 -0
- package/esm/guards/positive_infinity.d.ts +19 -0
- package/esm/guards/positive_infinity.d.ts.map +1 -0
- package/esm/guards/positive_infinity.js +21 -0
- package/esm/guards/positive_infinity.js.map +1 -0
- package/esm/guards/positive_zero.d.ts +17 -0
- package/esm/guards/positive_zero.d.ts.map +1 -0
- package/esm/guards/positive_zero.js +19 -0
- package/esm/guards/positive_zero.js.map +1 -0
- package/esm/guards/safe_integer.d.ts +33 -0
- package/esm/guards/safe_integer.d.ts.map +1 -0
- package/esm/guards/safe_integer.js +22 -0
- package/esm/guards/safe_integer.js.map +1 -0
- package/esm/hypot.d.ts +18 -0
- package/esm/hypot.d.ts.map +1 -0
- package/esm/hypot.js +60 -0
- package/esm/hypot.js.map +1 -0
- package/esm/ieee754.d.ts +16 -0
- package/esm/ieee754.d.ts.map +1 -0
- package/esm/ieee754.js +16 -0
- package/esm/ieee754.js.map +1 -0
- package/esm/imul.d.ts +17 -0
- package/esm/imul.d.ts.map +1 -0
- package/esm/imul.js +21 -0
- package/esm/imul.js.map +1 -0
- package/esm/index.d.ts +84 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +84 -0
- package/esm/index.js.map +1 -0
- package/esm/internal/ieee754.d.ts +174 -0
- package/esm/internal/ieee754.d.ts.map +1 -0
- package/esm/internal/ieee754.js +194 -0
- package/esm/internal/ieee754.js.map +1 -0
- package/esm/internal/primordials.d.ts +30 -0
- package/esm/internal/primordials.d.ts.map +1 -0
- package/esm/internal/primordials.js +27 -0
- package/esm/internal/primordials.js.map +1 -0
- package/esm/log.d.ts +9 -0
- package/esm/log.d.ts.map +1 -0
- package/esm/log.js +43 -0
- package/esm/log.js.map +1 -0
- package/esm/log10.d.ts +9 -0
- package/esm/log10.d.ts.map +1 -0
- package/esm/log10.js +18 -0
- package/esm/log10.js.map +1 -0
- package/esm/log1p.d.ts +10 -0
- package/esm/log1p.d.ts.map +1 -0
- package/esm/log1p.js +29 -0
- package/esm/log1p.js.map +1 -0
- package/esm/log2.d.ts +12 -0
- package/esm/log2.d.ts.map +1 -0
- package/esm/log2.js +21 -0
- package/esm/log2.js.map +1 -0
- package/esm/max.d.ts +22 -0
- package/esm/max.d.ts.map +1 -0
- package/esm/max.js +48 -0
- package/esm/max.js.map +1 -0
- package/esm/min.d.ts +10 -0
- package/esm/min.d.ts.map +1 -0
- package/esm/min.js +33 -0
- package/esm/min.js.map +1 -0
- package/esm/package.json +3 -0
- package/esm/pow.d.ts +31 -0
- package/esm/pow.d.ts.map +1 -0
- package/esm/pow.js +33 -0
- package/esm/pow.js.map +1 -0
- package/esm/random.d.ts +93 -0
- package/esm/random.d.ts.map +1 -0
- package/esm/random.js +237 -0
- package/esm/random.js.map +1 -0
- package/esm/round.d.ts +9 -0
- package/esm/round.d.ts.map +1 -0
- package/esm/round.js +21 -0
- package/esm/round.js.map +1 -0
- package/esm/sign.d.ts +17 -0
- package/esm/sign.d.ts.map +1 -0
- package/esm/sign.js +19 -0
- package/esm/sign.js.map +1 -0
- package/esm/sin.d.ts +14 -0
- package/esm/sin.d.ts.map +1 -0
- package/esm/sin.js +28 -0
- package/esm/sin.js.map +1 -0
- package/esm/sinh.d.ts +14 -0
- package/esm/sinh.d.ts.map +1 -0
- package/esm/sinh.js +19 -0
- package/esm/sinh.js.map +1 -0
- package/esm/sqrt.d.ts +19 -0
- package/esm/sqrt.d.ts.map +1 -0
- package/esm/sqrt.js +42 -0
- package/esm/sqrt.js.map +1 -0
- package/esm/tan.d.ts +9 -0
- package/esm/tan.d.ts.map +1 -0
- package/esm/tan.js +23 -0
- package/esm/tan.js.map +1 -0
- package/esm/tanh.d.ts +17 -0
- package/esm/tanh.d.ts.map +1 -0
- package/esm/tanh.js +31 -0
- package/esm/tanh.js.map +1 -0
- package/esm/trunc.d.ts +21 -0
- package/esm/trunc.d.ts.map +1 -0
- package/esm/trunc.js +47 -0
- package/esm/trunc.js.map +1 -0
- package/esm/types/finite.d.ts +16 -0
- package/esm/types/finite.d.ts.map +1 -0
- package/esm/types/finite.js +3 -0
- package/esm/types/finite.js.map +1 -0
- package/esm/types/float.d.ts +65 -0
- package/esm/types/float.d.ts.map +1 -0
- package/esm/types/float.js +3 -0
- package/esm/types/float.js.map +1 -0
- package/esm/types/index.d.ts +6 -0
- package/esm/types/index.d.ts.map +1 -0
- package/esm/types/index.js +6 -0
- package/esm/types/index.js.map +1 -0
- package/esm/types/integer.d.ts +147 -0
- package/esm/types/integer.d.ts.map +1 -0
- package/esm/types/integer.js +4 -0
- package/esm/types/integer.js.map +1 -0
- package/esm/types/precision.d.ts +46 -0
- package/esm/types/precision.d.ts.map +1 -0
- package/esm/types/precision.js +8 -0
- package/esm/types/precision.js.map +1 -0
- package/esm/types/safe_integer.d.ts +17 -0
- package/esm/types/safe_integer.d.ts.map +1 -0
- package/esm/types/safe_integer.js +4 -0
- package/esm/types/safe_integer.js.map +1 -0
- package/package.json +1834 -0
- package/src/abs.ts +18 -0
- package/src/acos.ts +24 -0
- package/src/acosh.ts +28 -0
- package/src/asin.ts +24 -0
- package/src/asinh.ts +21 -0
- package/src/atan.ts +64 -0
- package/src/atan2.ts +58 -0
- package/src/atanh.ts +26 -0
- package/src/cbrt.ts +22 -0
- package/src/ceil.ts +27 -0
- package/src/clamp.ts +29 -0
- package/src/clz32.ts +45 -0
- package/src/constants/e.ts +18 -0
- package/src/constants/epsilon.ts +25 -0
- package/src/constants/index.ts +22 -0
- package/src/constants/infinity.ts +2 -0
- package/src/constants/ln10.ts +9 -0
- package/src/constants/ln2.ts +9 -0
- package/src/constants/log10e.ts +9 -0
- package/src/constants/log2e.ts +9 -0
- package/src/constants/max_safe_integer.ts +10 -0
- package/src/constants/max_value.ts +9 -0
- package/src/constants/min_safe_integer.ts +11 -0
- package/src/constants/min_value.ts +9 -0
- package/src/constants/nan.ts +57 -0
- package/src/constants/negative_infinity.ts +28 -0
- package/src/constants/negative_zero.ts +34 -0
- package/src/constants/pi.ts +9 -0
- package/src/constants/positive_infinity.ts +30 -0
- package/src/constants/positive_zero.ts +41 -0
- package/src/constants/sqrt1_2.ts +8 -0
- package/src/constants/sqrt2.ts +8 -0
- package/src/cos.ts +29 -0
- package/src/cosh.ts +18 -0
- package/src/exp.ts +45 -0
- package/src/expm1.ts +31 -0
- package/src/f16round.ts +39 -0
- package/src/float16/constants.ts +106 -0
- package/src/float16/decode.ts +61 -0
- package/src/float16/encode.ts +72 -0
- package/src/float16/guards.ts +33 -0
- package/src/float16/index.ts +10 -0
- package/src/float16/round.ts +43 -0
- package/src/float32/constants.ts +105 -0
- package/src/float32/decode.ts +64 -0
- package/src/float32/encode.ts +71 -0
- package/src/float32/guards.ts +54 -0
- package/src/float32/index.ts +10 -0
- package/src/float32/round.ts +33 -0
- package/src/floor.ts +26 -0
- package/src/fround.ts +32 -0
- package/src/guards/finite.ts +45 -0
- package/src/guards/index.ts +49 -0
- package/src/guards/infinity.ts +2 -0
- package/src/guards/integer.ts +62 -0
- package/src/guards/nan.ts +65 -0
- package/src/guards/negative_infinity.ts +22 -0
- package/src/guards/negative_zero.ts +21 -0
- package/src/guards/positive_infinity.ts +22 -0
- package/src/guards/positive_zero.ts +19 -0
- package/src/guards/safe_integer.ts +56 -0
- package/src/hypot.ts +59 -0
- package/src/ieee754.ts +15 -0
- package/src/imul.ts +21 -0
- package/src/index.ts +84 -0
- package/src/internal/ieee754.ts +255 -0
- package/src/internal/primordials.ts +33 -0
- package/src/log.ts +42 -0
- package/src/log10.ts +18 -0
- package/src/log1p.ts +26 -0
- package/src/log2.ts +21 -0
- package/src/max.ts +46 -0
- package/src/min.ts +32 -0
- package/src/pow.ts +33 -0
- package/src/random.ts +241 -0
- package/src/round.ts +20 -0
- package/src/sign.ts +19 -0
- package/src/sin.ts +29 -0
- package/src/sinh.ts +19 -0
- package/src/sqrt.ts +40 -0
- package/src/tan.ts +22 -0
- package/src/tanh.ts +28 -0
- package/src/trunc.ts +44 -0
- package/src/types/finite.ts +23 -0
- package/src/types/float.ts +74 -0
- package/src/types/index.ts +5 -0
- package/src/types/integer.ts +167 -0
- package/src/types/precision.ts +51 -0
- package/src/types/safe_integer.ts +18 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.roundFloat32 = roundFloat32;
|
|
4
|
+
/**
|
|
5
|
+
* Rounds a number to the nearest 32-bit floating point value (single
|
|
6
|
+
* precision), following the IEEE 754-2008 specification.
|
|
7
|
+
*
|
|
8
|
+
* @module float32/round
|
|
9
|
+
*/
|
|
10
|
+
const encode_js_1 = require("./encode.js");
|
|
11
|
+
const decode_js_1 = require("./decode.js");
|
|
12
|
+
/**
|
|
13
|
+
* Rounds a number to the nearest 32-bit floating point value (single
|
|
14
|
+
* precision).
|
|
15
|
+
*
|
|
16
|
+
* Based on `Math.fround` function, this function follows the same rounding and
|
|
17
|
+
* conversion rules as per the IEEE 754-2008 specification for single-precision
|
|
18
|
+
* floating-point numbers (also known as `binary32`).
|
|
19
|
+
*
|
|
20
|
+
* @param x The number to round.
|
|
21
|
+
* @returns The 32-bit floating point rounded value of the number.
|
|
22
|
+
* @category Rounding
|
|
23
|
+
* @tags float, float32
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { roundFloat32 } from "@nick/math/float32/round";
|
|
27
|
+
* import { PI } from "@nick/math/constants";
|
|
28
|
+
* import assert from "node:assert";
|
|
29
|
+
*
|
|
30
|
+
* assert.strictEqual(roundFloat32(PI), Math.fround(PI)); // OK
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function roundFloat32(x) {
|
|
34
|
+
return (0, decode_js_1.decodeFloat32)((0, encode_js_1.encodeFloat32)(+x));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=round.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"round.js","sourceRoot":"","sources":["../../src/float32/round.ts"],"names":[],"mappings":";;AA8BA,oCAEC;AAhCD;;;;;GAKG;AACH,2CAA4C;AAC5C,2CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,YAAY,CAAC,CAAS;IACpC,OAAO,IAAA,yBAAa,EAAC,IAAA,yBAAa,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC"}
|
package/cjs/floor.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Performant local implementation of the `Math.floor` function.
|
|
3
|
+
*
|
|
4
|
+
* @param x The number to round down to the nearest whole number
|
|
5
|
+
* @returns The largest integer less than or equal to the provided number.
|
|
6
|
+
* @category Arithmetic
|
|
7
|
+
* @tags rounding, floor
|
|
8
|
+
*/
|
|
9
|
+
export declare function floor(x: number): number;
|
|
10
|
+
//# sourceMappingURL=floor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floor.d.ts","sourceRoot":"","sources":["../src/floor.ts"],"names":[],"mappings":"AASA;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAQvC"}
|
package/cjs/floor.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.floor = floor;
|
|
4
|
+
/**
|
|
5
|
+
* Performant local implementation of the `Math.floor` function.
|
|
6
|
+
*
|
|
7
|
+
* @category Arithmetic
|
|
8
|
+
* @module floor
|
|
9
|
+
*/
|
|
10
|
+
const negative_infinity_js_1 = require("./constants/negative_infinity.js");
|
|
11
|
+
const positive_infinity_js_1 = require("./constants/positive_infinity.js");
|
|
12
|
+
/**
|
|
13
|
+
* Performant local implementation of the `Math.floor` function.
|
|
14
|
+
*
|
|
15
|
+
* @param x The number to round down to the nearest whole number
|
|
16
|
+
* @returns The largest integer less than or equal to the provided number.
|
|
17
|
+
* @category Arithmetic
|
|
18
|
+
* @tags rounding, floor
|
|
19
|
+
*/
|
|
20
|
+
function floor(x) {
|
|
21
|
+
x = +x;
|
|
22
|
+
if (x !== x || x === positive_infinity_js_1.POSITIVE_INFINITY || x === negative_infinity_js_1.NEGATIVE_INFINITY)
|
|
23
|
+
return x;
|
|
24
|
+
if (x === 0)
|
|
25
|
+
return x;
|
|
26
|
+
const remainder = x % 1;
|
|
27
|
+
if (remainder === 0)
|
|
28
|
+
return x;
|
|
29
|
+
const truncated = x - remainder;
|
|
30
|
+
return x < 0 ? truncated - 1 : truncated;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=floor.js.map
|
package/cjs/floor.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"floor.js","sourceRoot":"","sources":["../src/floor.ts"],"names":[],"mappings":";;AAiBA,sBAQC;AAzBD;;;;;GAKG;AACH,2EAAqE;AACrE,2EAAqE;AAErE;;;;;;;GAOG;AACH,SAAgB,KAAK,CAAC,CAAS;IAC7B,CAAC,GAAG,CAAC,CAAC,CAAC;IACP,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,wCAAiB,IAAI,CAAC,KAAK,wCAAiB;QAAE,OAAO,CAAC,CAAC;IAC5E,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACtB,MAAM,SAAS,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,IAAI,SAAS,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,SAAS,GAAG,CAAC,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3C,CAAC"}
|
package/cjs/fround.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rounds a number to the nearest 32-bit floating point value (single
|
|
3
|
+
* precision).
|
|
4
|
+
*
|
|
5
|
+
* Based on `Math.fround` function, this function follows the same rounding and
|
|
6
|
+
* conversion rules as per the IEEE 754-2008 specification for single-precision
|
|
7
|
+
* floating-point numbers (also known as `binary32`).
|
|
8
|
+
*
|
|
9
|
+
* @param x The number to round.
|
|
10
|
+
* @returns The 32-bit floating point rounded value of the number.
|
|
11
|
+
* @category Rounding
|
|
12
|
+
* @tags float, float32
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { fround } from "@nick/math/fround";
|
|
16
|
+
* import { PI } from "@nick/math/constants";
|
|
17
|
+
*
|
|
18
|
+
* console.assert(fround(PI) === 3.1415927410125732); // OK
|
|
19
|
+
* console.assert(Math.fround(PI) === 3.1415927410125732); // OK
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function fround(x: number): number;
|
|
23
|
+
//# sourceMappingURL=fround.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fround.d.ts","sourceRoot":"","sources":["../src/fround.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAExC"}
|
package/cjs/fround.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fround = fround;
|
|
4
|
+
/**
|
|
5
|
+
* Rounds a number to the nearest 32-bit floating point value (single
|
|
6
|
+
* precision).
|
|
7
|
+
*
|
|
8
|
+
* @module fround
|
|
9
|
+
*/
|
|
10
|
+
const round_js_1 = require("./float32/round.js");
|
|
11
|
+
/**
|
|
12
|
+
* Rounds a number to the nearest 32-bit floating point value (single
|
|
13
|
+
* precision).
|
|
14
|
+
*
|
|
15
|
+
* Based on `Math.fround` function, this function follows the same rounding and
|
|
16
|
+
* conversion rules as per the IEEE 754-2008 specification for single-precision
|
|
17
|
+
* floating-point numbers (also known as `binary32`).
|
|
18
|
+
*
|
|
19
|
+
* @param x The number to round.
|
|
20
|
+
* @returns The 32-bit floating point rounded value of the number.
|
|
21
|
+
* @category Rounding
|
|
22
|
+
* @tags float, float32
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { fround } from "@nick/math/fround";
|
|
26
|
+
* import { PI } from "@nick/math/constants";
|
|
27
|
+
*
|
|
28
|
+
* console.assert(fround(PI) === 3.1415927410125732); // OK
|
|
29
|
+
* console.assert(Math.fround(PI) === 3.1415927410125732); // OK
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
function fround(x) {
|
|
33
|
+
return (0, round_js_1.roundFloat32)(x);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=fround.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fround.js","sourceRoot":"","sources":["../src/fround.ts"],"names":[],"mappings":";;AA6BA,wBAEC;AA/BD;;;;;GAKG;AACH,iDAAkD;AAElD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,MAAM,CAAC,CAAS;IAC9B,OAAO,IAAA,uBAAY,EAAC,CAAC,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Finite } from "../types/finite.js";
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a number is finite, meaning it is not infinite or `NaN`.
|
|
4
|
+
*
|
|
5
|
+
* This is a dependency-free, type-safe implementation of the `Number.isFinite`
|
|
6
|
+
* function. It is not dependent on the global `Number` object and will not be
|
|
7
|
+
* affected by global variable shadowing, reassignment, or malicious tampering.
|
|
8
|
+
*
|
|
9
|
+
* @param number The value to check.
|
|
10
|
+
* @returns `true` if the value is finite, `false` otherwise.
|
|
11
|
+
* @category Guards
|
|
12
|
+
* @tags Finite
|
|
13
|
+
*/
|
|
14
|
+
export declare function isFinite<N extends number>(number: N): number is Finite<N>;
|
|
15
|
+
/**
|
|
16
|
+
* Checks if a number is finite, meaning it is not infinite or `NaN`.
|
|
17
|
+
*
|
|
18
|
+
* @param number The value to check.
|
|
19
|
+
* @returns `true` if the value is finite, `false` otherwise.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isFinite(number: unknown): number is Finite;
|
|
22
|
+
export type { Finite };
|
|
23
|
+
//# sourceMappingURL=finite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finite.d.ts","sourceRoot":"","sources":["../../src/guards/finite.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EACvC,MAAM,EAAE,CAAC,GACR,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;AAEvB;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,MAAM,CAAC;AAQ5D,YAAY,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isFinite = isFinite;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a number is finite, meaning it is not infinite or `NaN`.
|
|
6
|
+
*
|
|
7
|
+
* This is a dependency-free, type-safe implementation of the `Number.isFinite`
|
|
8
|
+
* function. It is not dependent on the global `Number` object and will not be
|
|
9
|
+
* affected by global variable shadowing, reassignment, or malicious tampering.
|
|
10
|
+
*
|
|
11
|
+
* @module guards/finite
|
|
12
|
+
*/
|
|
13
|
+
const nan_js_1 = require("./nan.js");
|
|
14
|
+
const negative_infinity_js_1 = require("./negative_infinity.js");
|
|
15
|
+
const positive_infinity_js_1 = require("./positive_infinity.js");
|
|
16
|
+
/** @internal */
|
|
17
|
+
function isFinite(number) {
|
|
18
|
+
return typeof number === "number" && !(0, nan_js_1.isNaN)(number) &&
|
|
19
|
+
!(0, positive_infinity_js_1.isPositiveInfinity)(number) && !(0, negative_infinity_js_1.isNegativeInfinity)(number);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=finite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finite.js","sourceRoot":"","sources":["../../src/guards/finite.ts"],"names":[],"mappings":";;AAuCA,4BAGC;AA1CD;;;;;;;;GAQG;AACH,qCAAiC;AACjC,iEAA4D;AAC5D,iEAA4D;AA2B5D,gBAAgB;AAChB,SAAgB,QAAQ,CAAC,MAAe;IACtC,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,IAAA,cAAK,EAAC,MAAM,CAAC;QACjD,CAAC,IAAA,yCAAkB,EAAC,MAAM,CAAC,IAAI,CAAC,IAAA,yCAAkB,EAAC,MAAM,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guards for checking various numeric conditions, ensuring a value is of
|
|
3
|
+
* the expected type/value both at runtime and at compile-time.
|
|
4
|
+
*
|
|
5
|
+
* This module provides type-safe implementations for every native numeric
|
|
6
|
+
* guard in the ECMAScript specification, including all top-level global guards
|
|
7
|
+
* like [`isNaN`], and static `Number` methods like [`isFinite`].
|
|
8
|
+
*
|
|
9
|
+
* | Type Guard | Description | Native Equivalent |
|
|
10
|
+
* | ---------------------- | ------------------------------------------------------------- | --------------------------------------- |
|
|
11
|
+
* | [`isNaN`] | Checks if a value is `NaN` when coerced to a number. | [`isNaN`][native-isnan] |
|
|
12
|
+
* | [`isFinite`] | Checks if a number is finite (i.e., not `±Infinity` or `NaN`) | [`isFinite`][native-isfinite] |
|
|
13
|
+
* | [`isInteger`] | Checks if a value is an integer when coerced to a number. | `--` |
|
|
14
|
+
* | [`isSafeInteger`] | Checks if a number is a safe integer without coercion. | [`Number.isSafeInteger`][issafeinteger] |
|
|
15
|
+
* | [`isNumberInteger`] | Checks if a number is an integer without coercion. | [`Number.isInteger`][number-isint] |
|
|
16
|
+
* | [`isNumberNaN`] | Checks if a number is `NaN` without coercion. | [`Number.isNaN`][native-number-isnan] |
|
|
17
|
+
* | [`isNegativeZero`] | Checks if a number is `-0`. | [`Object.is`][native-object-is] |
|
|
18
|
+
* | [`isPositiveZero`] | Checks if a number is `+0` (and explicitly not `-0`). | [`Object.is`][native-object-is] |
|
|
19
|
+
* | [`isInfinity`] | Checks if a number is `+Infinity` or `-Infinity`. | `--` |
|
|
20
|
+
* | [`isNegativeInfinity`] | Checks if a number is `-Infinity`. | `--` |
|
|
21
|
+
* | [`isPositiveInfinity`] | Checks if a number is `+Infinity`. | `--` |
|
|
22
|
+
*
|
|
23
|
+
* [`isFinite`]: https://jsr.io/@nick/math/doc/guards/finite/~/isFinite
|
|
24
|
+
* [`isInfinity`]: https://jsr.io/@nick/math/doc/guards/infinity/~/isInfinity
|
|
25
|
+
* [`isInteger`]: https://jsr.io/@nick/math/doc/guards/integer/~/isInteger
|
|
26
|
+
* [`isSafeInteger`]: https://jsr.io/@nick/math/doc/guards/safe-integer/~/isSafeInteger
|
|
27
|
+
* [`isNumberInteger`]: https://jsr.io/@nick/math/doc/guards/integer/~/isNumberInteger
|
|
28
|
+
* [`isNaN`]: https://jsr.io/@nick/math/doc/guards/nan/~/isNaN
|
|
29
|
+
* [`isNumberNaN`]: https://jsr.io/@nick/math/doc/guards/nan/~/isNumberNaN
|
|
30
|
+
* [`isPositiveInfinity`]: https://jsr.io/@nick/math/doc/guards/positive-infinity/~/isPositiveInfinity
|
|
31
|
+
* [`isNegativeInfinity`]: https://jsr.io/@nick/math/doc/guards/negative-infinity/~/isNegativeInfinity
|
|
32
|
+
* [`isPositiveZero`]: https://jsr.io/@nick/math/doc/guards/positive-zero/~/isPositiveZero
|
|
33
|
+
* [`isNegativeZero`]: https://jsr.io/@nick/math/doc/guards/negative-zero/~/isNegativeZero
|
|
34
|
+
* [native-isfinite]: https://mdn.io/isFinite
|
|
35
|
+
* [issafeinteger]: https://mdn.io/Number.isSafeInteger
|
|
36
|
+
* [number-isint]: https://mdn.io/Number.isInteger
|
|
37
|
+
* [native-isnan]: https://mdn.io/isNaN
|
|
38
|
+
* [native-number-isnan]: https://mdn.io/Number.isNaN
|
|
39
|
+
* [native-object-is]: https://mdn.io/Object.is
|
|
40
|
+
*
|
|
41
|
+
* @module guards
|
|
42
|
+
*/
|
|
43
|
+
export * from "./finite.js";
|
|
44
|
+
export * from "./infinity.js";
|
|
45
|
+
export * from "./integer.js";
|
|
46
|
+
export * from "./nan.js";
|
|
47
|
+
export * from "./negative_zero.js";
|
|
48
|
+
export * from "./positive_zero.js";
|
|
49
|
+
export * from "./safe_integer.js";
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* Type guards for checking various numeric conditions, ensuring a value is of
|
|
19
|
+
* the expected type/value both at runtime and at compile-time.
|
|
20
|
+
*
|
|
21
|
+
* This module provides type-safe implementations for every native numeric
|
|
22
|
+
* guard in the ECMAScript specification, including all top-level global guards
|
|
23
|
+
* like [`isNaN`], and static `Number` methods like [`isFinite`].
|
|
24
|
+
*
|
|
25
|
+
* | Type Guard | Description | Native Equivalent |
|
|
26
|
+
* | ---------------------- | ------------------------------------------------------------- | --------------------------------------- |
|
|
27
|
+
* | [`isNaN`] | Checks if a value is `NaN` when coerced to a number. | [`isNaN`][native-isnan] |
|
|
28
|
+
* | [`isFinite`] | Checks if a number is finite (i.e., not `±Infinity` or `NaN`) | [`isFinite`][native-isfinite] |
|
|
29
|
+
* | [`isInteger`] | Checks if a value is an integer when coerced to a number. | `--` |
|
|
30
|
+
* | [`isSafeInteger`] | Checks if a number is a safe integer without coercion. | [`Number.isSafeInteger`][issafeinteger] |
|
|
31
|
+
* | [`isNumberInteger`] | Checks if a number is an integer without coercion. | [`Number.isInteger`][number-isint] |
|
|
32
|
+
* | [`isNumberNaN`] | Checks if a number is `NaN` without coercion. | [`Number.isNaN`][native-number-isnan] |
|
|
33
|
+
* | [`isNegativeZero`] | Checks if a number is `-0`. | [`Object.is`][native-object-is] |
|
|
34
|
+
* | [`isPositiveZero`] | Checks if a number is `+0` (and explicitly not `-0`). | [`Object.is`][native-object-is] |
|
|
35
|
+
* | [`isInfinity`] | Checks if a number is `+Infinity` or `-Infinity`. | `--` |
|
|
36
|
+
* | [`isNegativeInfinity`] | Checks if a number is `-Infinity`. | `--` |
|
|
37
|
+
* | [`isPositiveInfinity`] | Checks if a number is `+Infinity`. | `--` |
|
|
38
|
+
*
|
|
39
|
+
* [`isFinite`]: https://jsr.io/@nick/math/doc/guards/finite/~/isFinite
|
|
40
|
+
* [`isInfinity`]: https://jsr.io/@nick/math/doc/guards/infinity/~/isInfinity
|
|
41
|
+
* [`isInteger`]: https://jsr.io/@nick/math/doc/guards/integer/~/isInteger
|
|
42
|
+
* [`isSafeInteger`]: https://jsr.io/@nick/math/doc/guards/safe-integer/~/isSafeInteger
|
|
43
|
+
* [`isNumberInteger`]: https://jsr.io/@nick/math/doc/guards/integer/~/isNumberInteger
|
|
44
|
+
* [`isNaN`]: https://jsr.io/@nick/math/doc/guards/nan/~/isNaN
|
|
45
|
+
* [`isNumberNaN`]: https://jsr.io/@nick/math/doc/guards/nan/~/isNumberNaN
|
|
46
|
+
* [`isPositiveInfinity`]: https://jsr.io/@nick/math/doc/guards/positive-infinity/~/isPositiveInfinity
|
|
47
|
+
* [`isNegativeInfinity`]: https://jsr.io/@nick/math/doc/guards/negative-infinity/~/isNegativeInfinity
|
|
48
|
+
* [`isPositiveZero`]: https://jsr.io/@nick/math/doc/guards/positive-zero/~/isPositiveZero
|
|
49
|
+
* [`isNegativeZero`]: https://jsr.io/@nick/math/doc/guards/negative-zero/~/isNegativeZero
|
|
50
|
+
* [native-isfinite]: https://mdn.io/isFinite
|
|
51
|
+
* [issafeinteger]: https://mdn.io/Number.isSafeInteger
|
|
52
|
+
* [number-isint]: https://mdn.io/Number.isInteger
|
|
53
|
+
* [native-isnan]: https://mdn.io/isNaN
|
|
54
|
+
* [native-number-isnan]: https://mdn.io/Number.isNaN
|
|
55
|
+
* [native-object-is]: https://mdn.io/Object.is
|
|
56
|
+
*
|
|
57
|
+
* @module guards
|
|
58
|
+
*/
|
|
59
|
+
__exportStar(require("./finite.js"), exports);
|
|
60
|
+
__exportStar(require("./infinity.js"), exports);
|
|
61
|
+
__exportStar(require("./integer.js"), exports);
|
|
62
|
+
__exportStar(require("./nan.js"), exports);
|
|
63
|
+
__exportStar(require("./negative_zero.js"), exports);
|
|
64
|
+
__exportStar(require("./positive_zero.js"), exports);
|
|
65
|
+
__exportStar(require("./safe_integer.js"), exports);
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,8CAA4B;AAC5B,gDAA8B;AAC9B,+CAA6B;AAC7B,2CAAyB;AACzB,qDAAmC;AACnC,qDAAmC;AACnC,oDAAkC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infinity.d.ts","sourceRoot":"","sources":["../../src/guards/infinity.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./negative_infinity.js"), exports);
|
|
18
|
+
__exportStar(require("./positive_infinity.js"), exports);
|
|
19
|
+
//# sourceMappingURL=infinity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"infinity.js","sourceRoot":"","sources":["../../src/guards/infinity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,yDAAuC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the provided number is a whole number (integer), in a way that is
|
|
3
|
+
* immune to any global variable shadowing or reassignment.
|
|
4
|
+
*
|
|
5
|
+
* @param it The number to check for being an integer.
|
|
6
|
+
* @returns `true` if the provided number is an integer, otherwise `false`.
|
|
7
|
+
* @category Arithmetic
|
|
8
|
+
* @module isInteger
|
|
9
|
+
*/
|
|
10
|
+
import type { Integer } from "../types/integer.js";
|
|
11
|
+
/**
|
|
12
|
+
* Checks if the provided number is a whole number (integer), similar to
|
|
13
|
+
* `Number.isInteger`, but values are coerced into numbers before checking.
|
|
14
|
+
* For a check that matches `Number.isInteger` (no input coercion), see
|
|
15
|
+
* {@linkcode isNumberInteger}.
|
|
16
|
+
*
|
|
17
|
+
* @param it The number to check for being an integer.
|
|
18
|
+
* @returns `true` if the provided number is an integer, otherwise `false`.
|
|
19
|
+
* @category Guards
|
|
20
|
+
* @tags Integer
|
|
21
|
+
*/
|
|
22
|
+
export declare function isInteger<const N extends number>(number: N): number is Integer<N>;
|
|
23
|
+
/**
|
|
24
|
+
* Checks if the provided number is a whole number (integer), similar to
|
|
25
|
+
* `Number.isInteger`, but values are coerced into numbers before checking.
|
|
26
|
+
* For a check that matches `Number.isInteger` (no input coercion), see
|
|
27
|
+
* {@linkcode isNumberInteger}.
|
|
28
|
+
*
|
|
29
|
+
* @param number The value to check.
|
|
30
|
+
* @returns `true` if the provided number is an integer, otherwise `false`.
|
|
31
|
+
* @category Guards
|
|
32
|
+
* @tags Integer
|
|
33
|
+
*/
|
|
34
|
+
export declare function isInteger(number: unknown): number is Integer<number>;
|
|
35
|
+
/**
|
|
36
|
+
* Checks if a given number is a whole number (integer), in a way that is
|
|
37
|
+
* identical to the native `Number.isInteger` method (i.e., no coercion is
|
|
38
|
+
* performed on inputs).
|
|
39
|
+
*
|
|
40
|
+
* @param number The value to check.
|
|
41
|
+
* @returns `true` if the number is integral, otherwise `false`.
|
|
42
|
+
* @category Guards
|
|
43
|
+
* @tags Number, Integer
|
|
44
|
+
*/
|
|
45
|
+
export declare function isNumberInteger<const N extends number>(number: N): number is Integer<N>;
|
|
46
|
+
export type { Integer };
|
|
47
|
+
//# sourceMappingURL=integer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integer.d.ts","sourceRoot":"","sources":["../../src/guards/integer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EAC9C,MAAM,EAAE,CAAC,GACR,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;AAExB;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;AAQtE;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EACpD,MAAM,EAAE,CAAC,GACR,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,CAEtB;AAED,YAAY,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isInteger = isInteger;
|
|
4
|
+
exports.isNumberInteger = isNumberInteger;
|
|
5
|
+
/** @internal */
|
|
6
|
+
// deno-lint-ignore no-explicit-any
|
|
7
|
+
function isInteger(number) {
|
|
8
|
+
return (number = +number) % 1 === 0;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a given number is a whole number (integer), in a way that is
|
|
12
|
+
* identical to the native `Number.isInteger` method (i.e., no coercion is
|
|
13
|
+
* performed on inputs).
|
|
14
|
+
*
|
|
15
|
+
* @param number The value to check.
|
|
16
|
+
* @returns `true` if the number is integral, otherwise `false`.
|
|
17
|
+
* @category Guards
|
|
18
|
+
* @tags Number, Integer
|
|
19
|
+
*/
|
|
20
|
+
function isNumberInteger(number) {
|
|
21
|
+
return number % 1 === 0;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=integer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integer.js","sourceRoot":"","sources":["../../src/guards/integer.ts"],"names":[],"mappings":";;AAyCA,8BAEC;AAYD,0CAIC;AApBD,gBAAgB;AAChB,mCAAmC;AACnC,SAAgB,SAAS,CAAC,MAAW;IACnC,OAAO,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,eAAe,CAC7B,MAAS;IAET,OAAO,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the provided number is `NaN` (Not a Number), in a way that is
|
|
3
|
+
* immune to any global variable shadowing or reassignment.
|
|
4
|
+
*
|
|
5
|
+
* Unlike the global `isNaN` function, this one narrows its input to a special
|
|
6
|
+
* nominal type `NAN`, which allows you to distinguish between `NaN` and other
|
|
7
|
+
* `number` values on the type level.
|
|
8
|
+
*
|
|
9
|
+
* @param it The number to check for NaN.
|
|
10
|
+
* @returns `true` if the provided number is `NaN`, otherwise `false`.
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { isNaN, NAN } from "@nick/math";
|
|
14
|
+
* import assert from "node:assert";
|
|
15
|
+
*
|
|
16
|
+
* function assertNotNaN<T extends number>(
|
|
17
|
+
* value: T
|
|
18
|
+
* ): asserts value is Exclude<T, NAN> {
|
|
19
|
+
* if (isNaN(value)) throw new TypeError("Expected value to be non-NaN");
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* const x = 42, y = NAN;
|
|
23
|
+
*
|
|
24
|
+
* assertNotNaN(x); // OK
|
|
25
|
+
* assert.throws(() => assertNotNaN(y)); // Error: Expected value to be non-NaN
|
|
26
|
+
* ```
|
|
27
|
+
* @category Arithmetic
|
|
28
|
+
* @module isNaN
|
|
29
|
+
*/
|
|
30
|
+
import { NAN } from "../constants/nan.js";
|
|
31
|
+
/**
|
|
32
|
+
* Checks if the provided number is `NaN` (Not a Number), in a way that is
|
|
33
|
+
* immune to any global variable shadowing or reassignment.
|
|
34
|
+
*
|
|
35
|
+
* Unlike the global `isNaN` function, this one narrows its input to a special
|
|
36
|
+
* nominal type `NAN`, which allows you to distinguish between `NaN` and other
|
|
37
|
+
* `number` values on the type level.
|
|
38
|
+
*
|
|
39
|
+
* @param it The number to check for NaN.
|
|
40
|
+
* @returns `true` if the provided number is `NaN`, otherwise `false`.
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { isNaN, NAN } from "@nick/math";
|
|
44
|
+
* import assert from "node:assert";
|
|
45
|
+
*
|
|
46
|
+
* function assertNotNaN<T extends number>(
|
|
47
|
+
* value: T
|
|
48
|
+
* ): asserts value is Exclude<T, NAN> {
|
|
49
|
+
* if (isNaN(value)) throw new TypeError("Expected value to be non-NaN");
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* const x = 42, y = NAN;
|
|
53
|
+
*
|
|
54
|
+
* assertNotNaN(x); // OK
|
|
55
|
+
* assert.throws(() => assertNotNaN(y)); // Error: Expected value to be non-NaN
|
|
56
|
+
* ```
|
|
57
|
+
* @category Arithmetic
|
|
58
|
+
*/
|
|
59
|
+
export declare function isNaN(it: number): it is NAN;
|
|
60
|
+
export { NAN, NAN as NaN };
|
|
61
|
+
//# sourceMappingURL=nan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nan.d.ts","sourceRoot":"","sources":["../../src/guards/nan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,EAAE,IAAI,GAAG,CAE3C;AAED,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the provided number is `NaN` (Not a Number), in a way that is
|
|
4
|
+
* immune to any global variable shadowing or reassignment.
|
|
5
|
+
*
|
|
6
|
+
* Unlike the global `isNaN` function, this one narrows its input to a special
|
|
7
|
+
* nominal type `NAN`, which allows you to distinguish between `NaN` and other
|
|
8
|
+
* `number` values on the type level.
|
|
9
|
+
*
|
|
10
|
+
* @param it The number to check for NaN.
|
|
11
|
+
* @returns `true` if the provided number is `NaN`, otherwise `false`.
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { isNaN, NAN } from "@nick/math";
|
|
15
|
+
* import assert from "node:assert";
|
|
16
|
+
*
|
|
17
|
+
* function assertNotNaN<T extends number>(
|
|
18
|
+
* value: T
|
|
19
|
+
* ): asserts value is Exclude<T, NAN> {
|
|
20
|
+
* if (isNaN(value)) throw new TypeError("Expected value to be non-NaN");
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* const x = 42, y = NAN;
|
|
24
|
+
*
|
|
25
|
+
* assertNotNaN(x); // OK
|
|
26
|
+
* assert.throws(() => assertNotNaN(y)); // Error: Expected value to be non-NaN
|
|
27
|
+
* ```
|
|
28
|
+
* @category Arithmetic
|
|
29
|
+
* @module isNaN
|
|
30
|
+
*/
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.NaN = exports.NAN = void 0;
|
|
33
|
+
exports.isNaN = isNaN;
|
|
34
|
+
const nan_js_1 = require("../constants/nan.js");
|
|
35
|
+
Object.defineProperty(exports, "NAN", { enumerable: true, get: function () { return nan_js_1.NAN; } });
|
|
36
|
+
Object.defineProperty(exports, "NaN", { enumerable: true, get: function () { return nan_js_1.NAN; } });
|
|
37
|
+
/**
|
|
38
|
+
* Checks if the provided number is `NaN` (Not a Number), in a way that is
|
|
39
|
+
* immune to any global variable shadowing or reassignment.
|
|
40
|
+
*
|
|
41
|
+
* Unlike the global `isNaN` function, this one narrows its input to a special
|
|
42
|
+
* nominal type `NAN`, which allows you to distinguish between `NaN` and other
|
|
43
|
+
* `number` values on the type level.
|
|
44
|
+
*
|
|
45
|
+
* @param it The number to check for NaN.
|
|
46
|
+
* @returns `true` if the provided number is `NaN`, otherwise `false`.
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { isNaN, NAN } from "@nick/math";
|
|
50
|
+
* import assert from "node:assert";
|
|
51
|
+
*
|
|
52
|
+
* function assertNotNaN<T extends number>(
|
|
53
|
+
* value: T
|
|
54
|
+
* ): asserts value is Exclude<T, NAN> {
|
|
55
|
+
* if (isNaN(value)) throw new TypeError("Expected value to be non-NaN");
|
|
56
|
+
* }
|
|
57
|
+
*
|
|
58
|
+
* const x = 42, y = NAN;
|
|
59
|
+
*
|
|
60
|
+
* assertNotNaN(x); // OK
|
|
61
|
+
* assert.throws(() => assertNotNaN(y)); // Error: Expected value to be non-NaN
|
|
62
|
+
* ```
|
|
63
|
+
* @category Arithmetic
|
|
64
|
+
*/
|
|
65
|
+
function isNaN(it) {
|
|
66
|
+
return (it = +it) !== it;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=nan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nan.js","sourceRoot":"","sources":["../../src/guards/nan.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AAgCH,sBAEC;AAhCD,gDAA0C;AAkCjC,oFAlCA,YAAG,OAkCA;AAAS,oFAlCZ,YAAG,OAkCY;AAhCxB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,KAAK,CAAC,EAAU;IAC9B,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the provided number is `-Infinity` (negative infinity), in a way
|
|
3
|
+
* that is immune to any global variable shadowing or reassignment.
|
|
4
|
+
*
|
|
5
|
+
* @module negative-infinity
|
|
6
|
+
*/
|
|
7
|
+
import { NEGATIVE_INFINITY } from "../constants/negative_infinity.js";
|
|
8
|
+
/**
|
|
9
|
+
* Checks if the provided number is `-Infinity` (negative infinity), in a way
|
|
10
|
+
* that is immune to any global variable shadowing or reassignment.
|
|
11
|
+
*
|
|
12
|
+
* @param it The number to check for negative infinity.
|
|
13
|
+
* @returns `true` if the provided number is `-Infinity`, otherwise `false`.
|
|
14
|
+
* @category Guards
|
|
15
|
+
* @tags Negative Infinity
|
|
16
|
+
*/
|
|
17
|
+
export declare function isNegativeInfinity(it: number): it is NEGATIVE_INFINITY;
|
|
18
|
+
export { NEGATIVE_INFINITY };
|
|
19
|
+
//# sourceMappingURL=negative_infinity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negative_infinity.d.ts","sourceRoot":"","sources":["../../src/guards/negative_infinity.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,EAAE,IAAI,iBAAiB,CAEtE;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NEGATIVE_INFINITY = void 0;
|
|
4
|
+
exports.isNegativeInfinity = isNegativeInfinity;
|
|
5
|
+
/**
|
|
6
|
+
* Checks if the provided number is `-Infinity` (negative infinity), in a way
|
|
7
|
+
* that is immune to any global variable shadowing or reassignment.
|
|
8
|
+
*
|
|
9
|
+
* @module negative-infinity
|
|
10
|
+
*/
|
|
11
|
+
const negative_infinity_js_1 = require("../constants/negative_infinity.js");
|
|
12
|
+
Object.defineProperty(exports, "NEGATIVE_INFINITY", { enumerable: true, get: function () { return negative_infinity_js_1.NEGATIVE_INFINITY; } });
|
|
13
|
+
/**
|
|
14
|
+
* Checks if the provided number is `-Infinity` (negative infinity), in a way
|
|
15
|
+
* that is immune to any global variable shadowing or reassignment.
|
|
16
|
+
*
|
|
17
|
+
* @param it The number to check for negative infinity.
|
|
18
|
+
* @returns `true` if the provided number is `-Infinity`, otherwise `false`.
|
|
19
|
+
* @category Guards
|
|
20
|
+
* @tags Negative Infinity
|
|
21
|
+
*/
|
|
22
|
+
function isNegativeInfinity(it) {
|
|
23
|
+
return +it === negative_infinity_js_1.NEGATIVE_INFINITY;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=negative_infinity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"negative_infinity.js","sourceRoot":"","sources":["../../src/guards/negative_infinity.ts"],"names":[],"mappings":";;;AAiBA,gDAEC;AAnBD;;;;;GAKG;AACH,4EAAsE;AAe7D,kGAfA,wCAAiB,OAeA;AAb1B;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAC,EAAU;IAC3C,OAAO,CAAC,EAAE,KAAK,wCAAiB,CAAC;AACnC,CAAC"}
|