@ohos-ports/stdlib-number 0.0.0-stage → 0.4.1-beta.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 +177 -0
- package/NOTICE +1 -0
- package/README.md +205 -2
- package/SECURITY.md +5 -0
- package/ctor/README.md +121 -0
- package/ctor/docs/repl.txt +24 -0
- package/ctor/docs/types/index.d.ts +30 -0
- package/ctor/docs/types/test.ts +35 -0
- package/ctor/lib/index.js +40 -0
- package/ctor/lib/main.js +23 -0
- package/ctor/package.json +60 -0
- package/docs/types/index.d.ts +83 -0
- package/float16/base/assert/is-almost-equal/README.md +127 -0
- package/float16/base/assert/is-almost-equal/docs/repl.txt +45 -0
- package/float16/base/assert/is-almost-equal/docs/types/index.d.ts +63 -0
- package/float16/base/assert/is-almost-equal/docs/types/test.ts +71 -0
- package/float16/base/assert/is-almost-equal/lib/index.js +59 -0
- package/float16/base/assert/is-almost-equal/lib/main.js +73 -0
- package/float16/base/assert/is-almost-equal/package.json +75 -0
- package/float16/base/assert/is-nan/README.md +80 -0
- package/float16/base/assert/is-nan/docs/repl.txt +24 -0
- package/float16/base/assert/is-nan/docs/types/index.d.ts +40 -0
- package/float16/base/assert/is-nan/docs/types/test.ts +46 -0
- package/float16/base/assert/is-nan/lib/index.js +43 -0
- package/float16/base/assert/is-nan/lib/main.js +44 -0
- package/float16/base/assert/is-nan/package.json +75 -0
- package/float16/base/assert/is-negative-zero/README.md +92 -0
- package/float16/base/assert/is-negative-zero/docs/repl.txt +24 -0
- package/float16/base/assert/is-negative-zero/docs/types/index.d.ts +40 -0
- package/float16/base/assert/is-negative-zero/docs/types/test.ts +46 -0
- package/float16/base/assert/is-negative-zero/lib/index.js +43 -0
- package/float16/base/assert/is-negative-zero/lib/main.js +49 -0
- package/float16/base/assert/is-negative-zero/package.json +74 -0
- package/float16/base/assert/is-positive-zero/README.md +92 -0
- package/float16/base/assert/is-positive-zero/docs/repl.txt +24 -0
- package/float16/base/assert/is-positive-zero/docs/types/index.d.ts +40 -0
- package/float16/base/assert/is-positive-zero/docs/types/test.ts +46 -0
- package/float16/base/assert/is-positive-zero/lib/index.js +43 -0
- package/float16/base/assert/is-positive-zero/lib/main.js +49 -0
- package/float16/base/assert/is-positive-zero/package.json +74 -0
- package/float16/base/exponent/README.md +208 -0
- package/float16/base/exponent/docs/repl.txt +31 -0
- package/float16/base/exponent/docs/types/index.d.ts +58 -0
- package/float16/base/exponent/docs/types/test.ts +44 -0
- package/float16/base/exponent/include/stdlib/number/float16/base/exponent.h +41 -0
- package/float16/base/exponent/lib/index.js +53 -0
- package/float16/base/exponent/lib/main.js +76 -0
- package/float16/base/exponent/lib/native.js +68 -0
- package/float16/base/exponent/manifest.json +45 -0
- package/float16/base/exponent/package.json +76 -0
- package/float16/base/exponent/src/addon.c +90 -0
- package/float16/base/exponent/src/main.c +50 -0
- package/float16/base/from-binary-string/README.md +160 -0
- package/float16/base/from-binary-string/docs/repl.txt +55 -0
- package/float16/base/from-binary-string/docs/types/index.d.ts +58 -0
- package/float16/base/from-binary-string/docs/types/test.ts +44 -0
- package/float16/base/from-binary-string/lib/index.js +49 -0
- package/float16/base/from-binary-string/lib/main.js +108 -0
- package/float16/base/from-binary-string/lib/tofrac.js +57 -0
- package/float16/base/from-binary-string/package.json +73 -0
- package/float16/base/from-word/README.md +192 -0
- package/float16/base/from-word/docs/repl.txt +25 -0
- package/float16/base/from-word/docs/types/index.d.ts +38 -0
- package/float16/base/from-word/docs/types/test.ts +42 -0
- package/float16/base/from-word/include/stdlib/number/float16/base/from_word.h +41 -0
- package/float16/base/from-word/lib/index.js +42 -0
- package/float16/base/from-word/lib/main.js +105 -0
- package/float16/base/from-word/lib/native.js +47 -0
- package/float16/base/from-word/manifest.json +73 -0
- package/float16/base/from-word/package.json +81 -0
- package/float16/base/from-word/src/addon.c +92 -0
- package/float16/base/from-word/src/main.c +40 -0
- package/float16/base/mul/README.md +113 -0
- package/float16/base/mul/docs/repl.txt +33 -0
- package/float16/base/mul/docs/types/index.d.ts +53 -0
- package/float16/base/mul/docs/types/test.ts +58 -0
- package/float16/base/mul/lib/index.js +52 -0
- package/float16/base/mul/lib/main.js +62 -0
- package/float16/base/mul/package.json +183 -0
- package/float16/base/signbit/README.md +191 -0
- package/float16/base/signbit/docs/repl.txt +28 -0
- package/float16/base/signbit/docs/types/index.d.ts +52 -0
- package/float16/base/signbit/docs/types/test.ts +43 -0
- package/float16/base/signbit/include/stdlib/number/float16/base/signbit.h +41 -0
- package/float16/base/signbit/lib/index.js +50 -0
- package/float16/base/signbit/lib/main.js +65 -0
- package/float16/base/signbit/lib/native.js +63 -0
- package/float16/base/signbit/manifest.json +81 -0
- package/float16/base/signbit/package.json +76 -0
- package/float16/base/signbit/src/addon.c +90 -0
- package/float16/base/signbit/src/main.c +45 -0
- package/float16/base/significand/README.md +210 -0
- package/float16/base/significand/docs/repl.txt +31 -0
- package/float16/base/significand/docs/types/index.d.ts +58 -0
- package/float16/base/significand/docs/types/test.ts +43 -0
- package/float16/base/significand/include/stdlib/number/float16/base/significand.h +41 -0
- package/float16/base/significand/lib/index.js +53 -0
- package/float16/base/significand/lib/main.js +72 -0
- package/float16/base/significand/lib/native.js +70 -0
- package/float16/base/significand/manifest.json +81 -0
- package/float16/base/significand/package.json +79 -0
- package/float16/base/significand/src/addon.c +90 -0
- package/float16/base/significand/src/main.c +48 -0
- package/float16/base/sub/README.md +115 -0
- package/float16/base/sub/docs/repl.txt +33 -0
- package/float16/base/sub/docs/types/index.d.ts +53 -0
- package/float16/base/sub/docs/types/test.ts +58 -0
- package/float16/base/sub/lib/index.js +52 -0
- package/float16/base/sub/lib/main.js +62 -0
- package/float16/base/sub/package.json +182 -0
- package/float16/base/to-binary-string/README.md +153 -0
- package/float16/base/to-binary-string/docs/repl.txt +41 -0
- package/float16/base/to-binary-string/docs/types/index.d.ts +86 -0
- package/float16/base/to-binary-string/docs/types/test.ts +43 -0
- package/float16/base/to-binary-string/lib/div2.js +71 -0
- package/float16/base/to-binary-string/lib/index.js +70 -0
- package/float16/base/to-binary-string/lib/main.js +195 -0
- package/float16/base/to-binary-string/lib/mult2.js +81 -0
- package/float16/base/to-binary-string/package.json +72 -0
- package/float16/base/to-float32/README.md +193 -0
- package/float16/base/to-float32/docs/repl.txt +24 -0
- package/float16/base/to-float32/docs/types/index.d.ts +36 -0
- package/float16/base/to-float32/docs/types/test.ts +43 -0
- package/float16/base/to-float32/include/stdlib/number/float16/base/to_float32.h +41 -0
- package/float16/base/to-float32/lib/index.js +41 -0
- package/float16/base/to-float32/lib/main.js +48 -0
- package/float16/base/to-float32/lib/native.js +49 -0
- package/float16/base/to-float32/manifest.json +123 -0
- package/float16/base/to-float32/package.json +73 -0
- package/float16/base/to-float32/src/addon.c +91 -0
- package/float16/base/to-float32/src/main.c +96 -0
- package/float16/base/to-float64/README.md +193 -0
- package/float16/base/to-float64/docs/repl.txt +24 -0
- package/float16/base/to-float64/docs/types/index.d.ts +36 -0
- package/float16/base/to-float64/docs/types/test.ts +43 -0
- package/float16/base/to-float64/include/stdlib/number/float16/base/to_float64.h +40 -0
- package/float16/base/to-float64/lib/index.js +41 -0
- package/float16/base/to-float64/lib/main.js +47 -0
- package/float16/base/to-float64/lib/native.js +49 -0
- package/float16/base/to-float64/manifest.json +95 -0
- package/float16/base/to-float64/package.json +72 -0
- package/float16/base/to-float64/src/addon.c +90 -0
- package/float16/base/to-float64/src/main.c +37 -0
- package/float16/base/to-word/README.md +223 -0
- package/float16/base/to-word/docs/repl.txt +25 -0
- package/float16/base/to-word/docs/types/index.d.ts +41 -0
- package/float16/base/to-word/docs/types/test.ts +43 -0
- package/float16/base/to-word/include/stdlib/number/float16/base/to_word.h +62 -0
- package/float16/base/to-word/lib/index.js +44 -0
- package/float16/base/to-word/lib/main.js +187 -0
- package/float16/base/to-word/lib/native.js +51 -0
- package/float16/base/to-word/manifest.json +94 -0
- package/float16/base/to-word/package.json +80 -0
- package/float16/base/to-word/src/addon.c +91 -0
- package/float16/base/to-word/src/main.c +40 -0
- package/float16/base/ulp-difference/README.md +146 -0
- package/float16/base/ulp-difference/docs/repl.txt +45 -0
- package/float16/base/ulp-difference/docs/types/index.d.ts +59 -0
- package/float16/base/ulp-difference/docs/types/test.ts +58 -0
- package/float16/base/ulp-difference/lib/index.js +56 -0
- package/float16/base/ulp-difference/lib/main.js +105 -0
- package/float16/base/ulp-difference/package.json +68 -0
- package/float16/ctor/README.md +374 -0
- package/float16/ctor/docs/repl.txt +66 -0
- package/float16/ctor/docs/types/index.d.ts +103 -0
- package/float16/ctor/docs/types/test.ts +64 -0
- package/float16/ctor/include/stdlib/number/float16/ctor.h +110 -0
- package/float16/ctor/lib/index.js +40 -0
- package/float16/ctor/lib/main.js +186 -0
- package/float16/ctor/lib/tojson.js +37 -0
- package/float16/ctor/lib/tostring.js +34 -0
- package/float16/ctor/lib/valueof.js +34 -0
- package/float16/ctor/manifest.json +38 -0
- package/float16/ctor/package.json +70 -0
- package/float16/ctor/src/main.c +45 -0
- package/float32/README.md +97 -0
- package/float32/base/README.md +143 -0
- package/float32/base/add/README.md +221 -0
- package/float32/base/add/docs/repl.txt +33 -0
- package/float32/base/add/docs/types/index.d.ts +53 -0
- package/float32/base/add/docs/types/test.ts +58 -0
- package/float32/base/add/include/stdlib/number/float32/base/add.h +38 -0
- package/float32/base/add/lib/index.js +52 -0
- package/float32/base/add/lib/main.js +62 -0
- package/float32/base/add/lib/native.js +63 -0
- package/float32/base/add/manifest.json +67 -0
- package/float32/base/add/package.json +186 -0
- package/float32/base/add/src/addon.c +22 -0
- package/float32/base/add/src/main.c +34 -0
- package/float32/base/assert/README.md +114 -0
- package/float32/base/assert/docs/types/index.d.ts +192 -0
- package/float32/base/assert/docs/types/test.ts +29 -0
- package/float32/base/assert/is-almost-equal/README.md +134 -0
- package/float32/base/assert/is-almost-equal/docs/repl.txt +45 -0
- package/float32/base/assert/is-almost-equal/docs/types/index.d.ts +63 -0
- package/float32/base/assert/is-almost-equal/docs/types/test.ts +71 -0
- package/float32/base/assert/is-almost-equal/lib/index.js +59 -0
- package/float32/base/assert/is-almost-equal/lib/main.js +73 -0
- package/float32/base/assert/is-almost-equal/package.json +75 -0
- package/float32/base/assert/is-almost-same-value/README.md +136 -0
- package/float32/base/assert/is-almost-same-value/docs/repl.txt +43 -0
- package/float32/base/assert/is-almost-same-value/docs/types/index.d.ts +62 -0
- package/float32/base/assert/is-almost-same-value/docs/types/test.ts +71 -0
- package/float32/base/assert/is-almost-same-value/lib/index.js +59 -0
- package/float32/base/assert/is-almost-same-value/lib/main.js +79 -0
- package/float32/base/assert/is-almost-same-value/package.json +76 -0
- package/float32/base/assert/is-same-value/README.md +228 -0
- package/float32/base/assert/is-same-value/docs/repl.txt +36 -0
- package/float32/base/assert/is-same-value/docs/types/index.d.ts +61 -0
- package/float32/base/assert/is-same-value/docs/types/test.ts +58 -0
- package/float32/base/assert/is-same-value/include/stdlib/number/float32/base/assert/is_same_value.h +40 -0
- package/float32/base/assert/is-same-value/lib/index.js +50 -0
- package/float32/base/assert/is-same-value/lib/main.js +66 -0
- package/float32/base/assert/is-same-value/lib/native.js +60 -0
- package/float32/base/assert/is-same-value/manifest.json +69 -0
- package/float32/base/assert/is-same-value/package.json +79 -0
- package/float32/base/assert/is-same-value/src/addon.c +45 -0
- package/float32/base/assert/is-same-value/src/main.c +49 -0
- package/float32/base/assert/is-same-value-zero/README.md +230 -0
- package/float32/base/assert/is-same-value-zero/docs/repl.txt +36 -0
- package/float32/base/assert/is-same-value-zero/docs/types/index.d.ts +61 -0
- package/float32/base/assert/is-same-value-zero/docs/types/test.ts +58 -0
- package/float32/base/assert/is-same-value-zero/include/stdlib/number/float32/base/assert/is_same_value_zero.h +40 -0
- package/float32/base/assert/is-same-value-zero/lib/index.js +50 -0
- package/float32/base/assert/is-same-value-zero/lib/main.js +58 -0
- package/float32/base/assert/is-same-value-zero/lib/native.js +60 -0
- package/float32/base/assert/is-same-value-zero/manifest.json +69 -0
- package/float32/base/assert/is-same-value-zero/package.json +79 -0
- package/float32/base/assert/is-same-value-zero/src/addon.c +45 -0
- package/float32/base/assert/is-same-value-zero/src/main.c +43 -0
- package/float32/base/assert/lib/index.js +78 -0
- package/float32/base/assert/package.json +63 -0
- package/float32/base/div/README.md +221 -0
- package/float32/base/div/docs/repl.txt +33 -0
- package/float32/base/div/docs/types/index.d.ts +53 -0
- package/float32/base/div/docs/types/test.ts +58 -0
- package/float32/base/div/include/stdlib/number/float32/base/div.h +38 -0
- package/float32/base/div/lib/index.js +52 -0
- package/float32/base/div/lib/main.js +62 -0
- package/float32/base/div/lib/native.js +63 -0
- package/float32/base/div/manifest.json +67 -0
- package/float32/base/div/package.json +184 -0
- package/float32/base/div/src/addon.c +22 -0
- package/float32/base/div/src/main.c +34 -0
- package/float32/base/docs/types/index.d.ts +583 -0
- package/float32/base/docs/types/test.ts +29 -0
- package/float32/base/exponent/README.md +210 -0
- package/float32/base/exponent/docs/repl.txt +31 -0
- package/float32/base/exponent/docs/types/index.d.ts +58 -0
- package/float32/base/exponent/docs/types/test.ts +44 -0
- package/float32/base/exponent/include/stdlib/number/float32/base/exponent.h +40 -0
- package/float32/base/exponent/lib/index.js +53 -0
- package/float32/base/exponent/lib/main.js +81 -0
- package/float32/base/exponent/lib/native.js +68 -0
- package/float32/base/exponent/manifest.json +42 -0
- package/float32/base/exponent/package.json +76 -0
- package/float32/base/exponent/src/addon.c +89 -0
- package/float32/base/exponent/src/main.c +46 -0
- package/float32/base/from-binary-string/README.md +173 -0
- package/float32/base/from-binary-string/docs/repl.txt +55 -0
- package/float32/base/from-binary-string/docs/types/index.d.ts +58 -0
- package/float32/base/from-binary-string/docs/types/test.ts +42 -0
- package/float32/base/from-binary-string/lib/index.js +49 -0
- package/float32/base/from-binary-string/lib/main.js +108 -0
- package/float32/base/from-binary-string/lib/tofrac.js +57 -0
- package/float32/base/from-binary-string/package.json +73 -0
- package/float32/base/from-word/README.md +211 -0
- package/float32/base/from-word/docs/repl.txt +24 -0
- package/float32/base/from-word/docs/types/index.d.ts +38 -0
- package/float32/base/from-word/docs/types/test.ts +42 -0
- package/float32/base/from-word/include/stdlib/number/float32/base/from_word.h +40 -0
- package/float32/base/from-word/lib/index.js +42 -0
- package/float32/base/from-word/lib/main.js +55 -0
- package/float32/base/from-word/lib/native.js +48 -0
- package/float32/base/from-word/manifest.json +40 -0
- package/float32/base/from-word/package.json +81 -0
- package/float32/base/from-word/src/addon.c +90 -0
- package/float32/base/from-word/src/from_word.c +41 -0
- package/float32/base/identity/README.md +210 -0
- package/float32/base/identity/docs/img/equation_identity_function.svg +18 -0
- package/float32/base/identity/docs/repl.txt +31 -0
- package/float32/base/identity/docs/types/index.d.ts +52 -0
- package/float32/base/identity/docs/types/test.ts +44 -0
- package/float32/base/identity/include/stdlib/number/float32/base/identity.h +38 -0
- package/float32/base/identity/lib/index.js +52 -0
- package/float32/base/identity/lib/main.js +54 -0
- package/float32/base/identity/lib/native.js +62 -0
- package/float32/base/identity/manifest.json +67 -0
- package/float32/base/identity/package.json +66 -0
- package/float32/base/identity/src/addon.c +22 -0
- package/float32/base/identity/src/main.c +33 -0
- package/float32/base/lib/index.js +195 -0
- package/float32/base/mul/README.md +221 -0
- package/float32/base/mul/docs/repl.txt +33 -0
- package/float32/base/mul/docs/types/index.d.ts +53 -0
- package/float32/base/mul/docs/types/test.ts +58 -0
- package/float32/base/mul/include/stdlib/number/float32/base/mul.h +38 -0
- package/float32/base/mul/lib/index.js +52 -0
- package/float32/base/mul/lib/main.js +62 -0
- package/float32/base/mul/lib/native.js +63 -0
- package/float32/base/mul/manifest.json +67 -0
- package/float32/base/mul/package.json +187 -0
- package/float32/base/mul/src/addon.c +22 -0
- package/float32/base/mul/src/main.c +34 -0
- package/float32/base/normalize/README.md +268 -0
- package/float32/base/normalize/docs/repl.txt +80 -0
- package/float32/base/normalize/docs/types/index.d.ts +124 -0
- package/float32/base/normalize/docs/types/test.ts +109 -0
- package/float32/base/normalize/include/stdlib/number/float32/base/normalize.h +40 -0
- package/float32/base/normalize/lib/assign.js +98 -0
- package/float32/base/normalize/lib/index.js +68 -0
- package/float32/base/normalize/lib/main.js +67 -0
- package/float32/base/normalize/lib/native.js +73 -0
- package/float32/base/normalize/manifest.json +43 -0
- package/float32/base/normalize/package.json +75 -0
- package/float32/base/normalize/src/addon.c +116 -0
- package/float32/base/normalize/src/main.c +59 -0
- package/float32/base/package.json +71 -0
- package/float32/base/signbit/README.md +201 -0
- package/float32/base/signbit/docs/repl.txt +28 -0
- package/float32/base/signbit/docs/types/index.d.ts +52 -0
- package/float32/base/signbit/docs/types/test.ts +43 -0
- package/float32/base/signbit/include/stdlib/number/float32/base/signbit.h +40 -0
- package/float32/base/signbit/lib/index.js +50 -0
- package/float32/base/signbit/lib/main.js +65 -0
- package/float32/base/signbit/lib/native.js +63 -0
- package/float32/base/signbit/manifest.json +75 -0
- package/float32/base/signbit/package.json +76 -0
- package/float32/base/signbit/src/addon.c +89 -0
- package/float32/base/signbit/src/main.c +42 -0
- package/float32/base/significand/README.md +201 -0
- package/float32/base/significand/docs/repl.txt +31 -0
- package/float32/base/significand/docs/types/index.d.ts +58 -0
- package/float32/base/significand/docs/types/test.ts +43 -0
- package/float32/base/significand/include/stdlib/number/float32/base/significand.h +40 -0
- package/float32/base/significand/lib/index.js +53 -0
- package/float32/base/significand/lib/main.js +74 -0
- package/float32/base/significand/lib/native.js +54 -0
- package/float32/base/significand/manifest.json +40 -0
- package/float32/base/significand/package.json +79 -0
- package/float32/base/significand/src/addon.c +89 -0
- package/float32/base/significand/src/main.c +44 -0
- package/float32/base/sub/README.md +221 -0
- package/float32/base/sub/docs/repl.txt +33 -0
- package/float32/base/sub/docs/types/index.d.ts +53 -0
- package/float32/base/sub/docs/types/test.ts +58 -0
- package/float32/base/sub/include/stdlib/number/float32/base/sub.h +38 -0
- package/float32/base/sub/lib/index.js +52 -0
- package/float32/base/sub/lib/main.js +62 -0
- package/float32/base/sub/lib/native.js +63 -0
- package/float32/base/sub/manifest.json +67 -0
- package/float32/base/sub/package.json +186 -0
- package/float32/base/sub/src/addon.c +22 -0
- package/float32/base/sub/src/main.c +34 -0
- package/float32/base/to-binary-string/README.md +164 -0
- package/float32/base/to-binary-string/docs/repl.txt +41 -0
- package/float32/base/to-binary-string/docs/types/index.d.ts +86 -0
- package/float32/base/to-binary-string/docs/types/test.ts +43 -0
- package/float32/base/to-binary-string/lib/div2.js +71 -0
- package/float32/base/to-binary-string/lib/index.js +70 -0
- package/float32/base/to-binary-string/lib/main.js +193 -0
- package/float32/base/to-binary-string/lib/mult2.js +81 -0
- package/float32/base/to-binary-string/package.json +72 -0
- package/float32/base/to-float16/README.md +185 -0
- package/float32/base/to-float16/docs/repl.txt +24 -0
- package/float32/base/to-float16/docs/types/index.d.ts +36 -0
- package/float32/base/to-float16/docs/types/test.ts +43 -0
- package/float32/base/to-float16/include/stdlib/number/float32/base/to_float16.h +41 -0
- package/float32/base/to-float16/lib/index.js +52 -0
- package/float32/base/to-float16/lib/main.js +28 -0
- package/float32/base/to-float16/lib/native.js +49 -0
- package/float32/base/to-float16/lib/polyfill.js +99 -0
- package/float32/base/to-float16/manifest.json +110 -0
- package/float32/base/to-float16/package.json +73 -0
- package/float32/base/to-float16/src/addon.c +90 -0
- package/float32/base/to-float16/src/main.c +175 -0
- package/float32/base/to-int32/README.md +123 -0
- package/float32/base/to-int32/docs/repl.txt +32 -0
- package/float32/base/to-int32/docs/types/index.d.ts +68 -0
- package/float32/base/to-int32/docs/types/test.ts +43 -0
- package/float32/base/to-int32/lib/index.js +56 -0
- package/float32/base/to-int32/lib/main.js +67 -0
- package/float32/base/to-int32/package.json +75 -0
- package/float32/base/to-uint32/README.md +125 -0
- package/float32/base/to-uint32/docs/repl.txt +32 -0
- package/float32/base/to-uint32/docs/types/index.d.ts +68 -0
- package/float32/base/to-uint32/docs/types/test.ts +43 -0
- package/float32/base/to-uint32/lib/index.js +56 -0
- package/float32/base/to-uint32/lib/main.js +67 -0
- package/float32/base/to-uint32/package.json +75 -0
- package/float32/base/to-word/README.md +237 -0
- package/float32/base/to-word/docs/repl.txt +25 -0
- package/float32/base/to-word/docs/types/index.d.ts +41 -0
- package/float32/base/to-word/docs/types/test.ts +43 -0
- package/float32/base/to-word/include/stdlib/number/float32/base/to_word.h +60 -0
- package/float32/base/to-word/lib/index.js +44 -0
- package/float32/base/to-word/lib/main.js +58 -0
- package/float32/base/to-word/lib/native.js +51 -0
- package/float32/base/to-word/manifest.json +38 -0
- package/float32/base/to-word/package.json +81 -0
- package/float32/base/to-word/src/addon.c +90 -0
- package/float32/base/to-word/src/to_word.c +38 -0
- package/float32/base/ulp-difference/README.md +146 -0
- package/float32/base/ulp-difference/docs/repl.txt +45 -0
- package/float32/base/ulp-difference/docs/types/index.d.ts +59 -0
- package/float32/base/ulp-difference/docs/types/test.ts +58 -0
- package/float32/base/ulp-difference/lib/index.js +56 -0
- package/float32/base/ulp-difference/lib/main.js +104 -0
- package/float32/base/ulp-difference/package.json +68 -0
- package/float32/docs/types/index.d.ts +43 -0
- package/float32/docs/types/test.ts +29 -0
- package/float32/lib/index.js +51 -0
- package/float32/package.json +65 -0
- package/float64/README.md +103 -0
- package/float64/base/README.md +170 -0
- package/float64/base/add/README.md +220 -0
- package/float64/base/add/docs/repl.txt +33 -0
- package/float64/base/add/docs/types/index.d.ts +53 -0
- package/float64/base/add/docs/types/test.ts +58 -0
- package/float64/base/add/include/stdlib/number/float64/base/add.h +38 -0
- package/float64/base/add/lib/index.js +52 -0
- package/float64/base/add/lib/main.js +57 -0
- package/float64/base/add/lib/native.js +63 -0
- package/float64/base/add/manifest.json +67 -0
- package/float64/base/add/package.json +185 -0
- package/float64/base/add/src/addon.c +22 -0
- package/float64/base/add/src/main.c +34 -0
- package/float64/base/add3/README.md +218 -0
- package/float64/base/add3/docs/repl.txt +36 -0
- package/float64/base/add3/docs/types/index.d.ts +54 -0
- package/float64/base/add3/docs/types/test.ts +71 -0
- package/float64/base/add3/include/stdlib/number/float64/base/add3.h +38 -0
- package/float64/base/add3/lib/index.js +52 -0
- package/float64/base/add3/lib/main.js +58 -0
- package/float64/base/add3/lib/native.js +64 -0
- package/float64/base/add3/manifest.json +67 -0
- package/float64/base/add3/package.json +68 -0
- package/float64/base/add3/src/addon.c +22 -0
- package/float64/base/add3/src/main.c +35 -0
- package/float64/base/add4/README.md +221 -0
- package/float64/base/add4/docs/repl.txt +39 -0
- package/float64/base/add4/docs/types/index.d.ts +55 -0
- package/float64/base/add4/docs/types/test.ts +84 -0
- package/float64/base/add4/include/stdlib/number/float64/base/add4.h +38 -0
- package/float64/base/add4/lib/index.js +52 -0
- package/float64/base/add4/lib/main.js +59 -0
- package/float64/base/add4/lib/native.js +65 -0
- package/float64/base/add4/manifest.json +67 -0
- package/float64/base/add4/package.json +68 -0
- package/float64/base/add4/src/addon.c +22 -0
- package/float64/base/add4/src/main.c +36 -0
- package/float64/base/add5/README.md +224 -0
- package/float64/base/add5/docs/repl.txt +42 -0
- package/float64/base/add5/docs/types/index.d.ts +56 -0
- package/float64/base/add5/docs/types/test.ts +97 -0
- package/float64/base/add5/include/stdlib/number/float64/base/add5.h +38 -0
- package/float64/base/add5/lib/index.js +52 -0
- package/float64/base/add5/lib/main.js +60 -0
- package/float64/base/add5/lib/native.js +66 -0
- package/float64/base/add5/manifest.json +67 -0
- package/float64/base/add5/package.json +68 -0
- package/float64/base/add5/src/addon.c +22 -0
- package/float64/base/add5/src/main.c +37 -0
- package/float64/base/assert/README.md +114 -0
- package/float64/base/assert/docs/types/index.d.ts +176 -0
- package/float64/base/assert/docs/types/test.ts +29 -0
- package/float64/base/assert/is-almost-equal/README.md +134 -0
- package/float64/base/assert/is-almost-equal/docs/repl.txt +45 -0
- package/float64/base/assert/is-almost-equal/docs/types/index.d.ts +63 -0
- package/float64/base/assert/is-almost-equal/docs/types/test.ts +71 -0
- package/float64/base/assert/is-almost-equal/lib/index.js +59 -0
- package/float64/base/assert/is-almost-equal/lib/main.js +72 -0
- package/float64/base/assert/is-almost-equal/package.json +75 -0
- package/float64/base/assert/is-almost-same-value/README.md +136 -0
- package/float64/base/assert/is-almost-same-value/docs/repl.txt +43 -0
- package/float64/base/assert/is-almost-same-value/docs/types/index.d.ts +62 -0
- package/float64/base/assert/is-almost-same-value/docs/types/test.ts +71 -0
- package/float64/base/assert/is-almost-same-value/lib/index.js +59 -0
- package/float64/base/assert/is-almost-same-value/lib/main.js +79 -0
- package/float64/base/assert/is-almost-same-value/package.json +76 -0
- package/float64/base/assert/is-same-value/README.md +225 -0
- package/float64/base/assert/is-same-value/docs/repl.txt +33 -0
- package/float64/base/assert/is-same-value/docs/types/index.d.ts +53 -0
- package/float64/base/assert/is-same-value/docs/types/test.ts +58 -0
- package/float64/base/assert/is-same-value/include/stdlib/number/float64/base/assert/is_same_value.h +40 -0
- package/float64/base/assert/is-same-value/lib/index.js +49 -0
- package/float64/base/assert/is-same-value/lib/main.js +66 -0
- package/float64/base/assert/is-same-value/lib/native.js +60 -0
- package/float64/base/assert/is-same-value/manifest.json +69 -0
- package/float64/base/assert/is-same-value/package.json +79 -0
- package/float64/base/assert/is-same-value/src/addon.c +45 -0
- package/float64/base/assert/is-same-value/src/main.c +49 -0
- package/float64/base/assert/is-same-value-zero/README.md +227 -0
- package/float64/base/assert/is-same-value-zero/docs/repl.txt +33 -0
- package/float64/base/assert/is-same-value-zero/docs/types/index.d.ts +53 -0
- package/float64/base/assert/is-same-value-zero/docs/types/test.ts +58 -0
- package/float64/base/assert/is-same-value-zero/include/stdlib/number/float64/base/assert/is_same_value_zero.h +40 -0
- package/float64/base/assert/is-same-value-zero/lib/index.js +49 -0
- package/float64/base/assert/is-same-value-zero/lib/main.js +58 -0
- package/float64/base/assert/is-same-value-zero/lib/native.js +60 -0
- package/float64/base/assert/is-same-value-zero/manifest.json +69 -0
- package/float64/base/assert/is-same-value-zero/package.json +79 -0
- package/float64/base/assert/is-same-value-zero/src/addon.c +45 -0
- package/float64/base/assert/is-same-value-zero/src/main.c +43 -0
- package/float64/base/assert/lib/index.js +78 -0
- package/float64/base/assert/package.json +64 -0
- package/float64/base/div/README.md +218 -0
- package/float64/base/div/docs/repl.txt +33 -0
- package/float64/base/div/docs/types/index.d.ts +53 -0
- package/float64/base/div/docs/types/test.ts +58 -0
- package/float64/base/div/include/stdlib/number/float64/base/div.h +38 -0
- package/float64/base/div/lib/index.js +52 -0
- package/float64/base/div/lib/main.js +57 -0
- package/float64/base/div/lib/native.js +63 -0
- package/float64/base/div/manifest.json +67 -0
- package/float64/base/div/package.json +188 -0
- package/float64/base/div/src/addon.c +22 -0
- package/float64/base/div/src/main.c +34 -0
- package/float64/base/docs/types/index.d.ts +883 -0
- package/float64/base/docs/types/test.ts +29 -0
- package/float64/base/exponent/README.md +206 -0
- package/float64/base/exponent/docs/repl.txt +29 -0
- package/float64/base/exponent/docs/types/index.d.ts +48 -0
- package/float64/base/exponent/docs/types/test.ts +43 -0
- package/float64/base/exponent/include/stdlib/number/float64/base/exponent.h +40 -0
- package/float64/base/exponent/lib/index.js +49 -0
- package/float64/base/exponent/lib/main.js +66 -0
- package/float64/base/exponent/lib/native.js +58 -0
- package/float64/base/exponent/manifest.json +42 -0
- package/float64/base/exponent/package.json +76 -0
- package/float64/base/exponent/src/addon.c +89 -0
- package/float64/base/exponent/src/exponent.c +46 -0
- package/float64/base/from-binary-string/README.md +169 -0
- package/float64/base/from-binary-string/docs/repl.txt +56 -0
- package/float64/base/from-binary-string/docs/types/index.d.ts +83 -0
- package/float64/base/from-binary-string/docs/types/test.ts +42 -0
- package/float64/base/from-binary-string/lib/index.js +77 -0
- package/float64/base/from-binary-string/lib/main.js +132 -0
- package/float64/base/from-binary-string/lib/todouble.js +49 -0
- package/float64/base/from-binary-string/package.json +73 -0
- package/float64/base/from-int64-bytes/README.md +153 -0
- package/float64/base/from-int64-bytes/docs/repl.txt +31 -0
- package/float64/base/from-int64-bytes/docs/types/index.d.ts +49 -0
- package/float64/base/from-int64-bytes/docs/types/test.ts +73 -0
- package/float64/base/from-int64-bytes/lib/index.js +42 -0
- package/float64/base/from-int64-bytes/lib/main.js +92 -0
- package/float64/base/from-int64-bytes/package.json +75 -0
- package/float64/base/from-words/README.md +227 -0
- package/float64/base/from-words/docs/repl.txt +38 -0
- package/float64/base/from-words/docs/types/index.d.ts +100 -0
- package/float64/base/from-words/docs/types/test.ts +53 -0
- package/float64/base/from-words/include/stdlib/number/float64/base/from_words.h +40 -0
- package/float64/base/from-words/lib/index.js +58 -0
- package/float64/base/from-words/lib/indices.js +47 -0
- package/float64/base/from-words/lib/main.js +120 -0
- package/float64/base/from-words/lib/native.js +71 -0
- package/float64/base/from-words/manifest.json +40 -0
- package/float64/base/from-words/package.json +79 -0
- package/float64/base/from-words/src/addon.c +103 -0
- package/float64/base/from-words/src/main.c +44 -0
- package/float64/base/get-high-word/README.md +197 -0
- package/float64/base/get-high-word/docs/repl.txt +23 -0
- package/float64/base/get-high-word/docs/types/index.d.ts +36 -0
- package/float64/base/get-high-word/docs/types/test.ts +43 -0
- package/float64/base/get-high-word/include/stdlib/number/float64/base/get_high_word.h +41 -0
- package/float64/base/get-high-word/lib/high.js +38 -0
- package/float64/base/get-high-word/lib/index.js +40 -0
- package/float64/base/get-high-word/lib/main.js +91 -0
- package/float64/base/get-high-word/lib/native.js +46 -0
- package/float64/base/get-high-word/manifest.json +40 -0
- package/float64/base/get-high-word/package.json +80 -0
- package/float64/base/get-high-word/src/addon.c +90 -0
- package/float64/base/get-high-word/src/main.c +39 -0
- package/float64/base/get-low-word/README.md +197 -0
- package/float64/base/get-low-word/docs/repl.txt +23 -0
- package/float64/base/get-low-word/docs/types/index.d.ts +36 -0
- package/float64/base/get-low-word/docs/types/test.ts +43 -0
- package/float64/base/get-low-word/include/stdlib/number/float64/base/get_low_word.h +41 -0
- package/float64/base/get-low-word/lib/index.js +40 -0
- package/float64/base/get-low-word/lib/low.js +38 -0
- package/float64/base/get-low-word/lib/main.js +91 -0
- package/float64/base/get-low-word/lib/native.js +46 -0
- package/float64/base/get-low-word/manifest.json +40 -0
- package/float64/base/get-low-word/package.json +78 -0
- package/float64/base/get-low-word/src/addon.c +90 -0
- package/float64/base/get-low-word/src/main.c +39 -0
- package/float64/base/identity/README.md +210 -0
- package/float64/base/identity/docs/img/equation_identity_function.svg +18 -0
- package/float64/base/identity/docs/repl.txt +31 -0
- package/float64/base/identity/docs/types/index.d.ts +52 -0
- package/float64/base/identity/docs/types/test.ts +44 -0
- package/float64/base/identity/include/stdlib/number/float64/base/identity.h +38 -0
- package/float64/base/identity/lib/index.js +52 -0
- package/float64/base/identity/lib/main.js +54 -0
- package/float64/base/identity/lib/native.js +62 -0
- package/float64/base/identity/manifest.json +67 -0
- package/float64/base/identity/package.json +66 -0
- package/float64/base/identity/src/addon.c +22 -0
- package/float64/base/identity/src/main.c +33 -0
- package/float64/base/lib/index.js +276 -0
- package/float64/base/mul/README.md +218 -0
- package/float64/base/mul/docs/repl.txt +33 -0
- package/float64/base/mul/docs/types/index.d.ts +53 -0
- package/float64/base/mul/docs/types/test.ts +58 -0
- package/float64/base/mul/include/stdlib/number/float64/base/mul.h +38 -0
- package/float64/base/mul/lib/index.js +52 -0
- package/float64/base/mul/lib/main.js +57 -0
- package/float64/base/mul/lib/native.js +63 -0
- package/float64/base/mul/manifest.json +67 -0
- package/float64/base/mul/package.json +186 -0
- package/float64/base/mul/src/addon.c +22 -0
- package/float64/base/mul/src/mul.c +34 -0
- package/float64/base/normalize/README.md +253 -0
- package/float64/base/normalize/docs/repl.txt +74 -0
- package/float64/base/normalize/docs/types/index.d.ts +125 -0
- package/float64/base/normalize/docs/types/test.ts +109 -0
- package/float64/base/normalize/include/stdlib/number/float64/base/normalize.h +40 -0
- package/float64/base/normalize/lib/assign.js +97 -0
- package/float64/base/normalize/lib/index.js +66 -0
- package/float64/base/normalize/lib/main.js +73 -0
- package/float64/base/normalize/lib/native.js +77 -0
- package/float64/base/normalize/manifest.json +43 -0
- package/float64/base/normalize/package.json +76 -0
- package/float64/base/normalize/src/addon.c +116 -0
- package/float64/base/normalize/src/main.c +59 -0
- package/float64/base/package.json +70 -0
- package/float64/base/set-high-word/README.md +215 -0
- package/float64/base/set-high-word/docs/repl.txt +28 -0
- package/float64/base/set-high-word/docs/types/index.d.ts +86 -0
- package/float64/base/set-high-word/docs/types/test.ts +53 -0
- package/float64/base/set-high-word/include/stdlib/number/float64/base/set_high_word.h +40 -0
- package/float64/base/set-high-word/lib/high.js +38 -0
- package/float64/base/set-high-word/lib/index.js +52 -0
- package/float64/base/set-high-word/lib/main.js +104 -0
- package/float64/base/set-high-word/lib/native.js +58 -0
- package/float64/base/set-high-word/manifest.json +40 -0
- package/float64/base/set-high-word/package.json +81 -0
- package/float64/base/set-high-word/src/addon.c +102 -0
- package/float64/base/set-high-word/src/main.c +42 -0
- package/float64/base/set-low-word/README.md +227 -0
- package/float64/base/set-low-word/docs/repl.txt +45 -0
- package/float64/base/set-low-word/docs/types/index.d.ts +94 -0
- package/float64/base/set-low-word/docs/types/test.ts +53 -0
- package/float64/base/set-low-word/include/stdlib/number/float64/base/set_low_word.h +40 -0
- package/float64/base/set-low-word/lib/index.js +60 -0
- package/float64/base/set-low-word/lib/low.js +38 -0
- package/float64/base/set-low-word/lib/main.js +112 -0
- package/float64/base/set-low-word/lib/native.js +66 -0
- package/float64/base/set-low-word/manifest.json +40 -0
- package/float64/base/set-low-word/package.json +78 -0
- package/float64/base/set-low-word/src/addon.c +102 -0
- package/float64/base/set-low-word/src/main.c +42 -0
- package/float64/base/signbit/README.md +197 -0
- package/float64/base/signbit/docs/repl.txt +28 -0
- package/float64/base/signbit/docs/types/index.d.ts +48 -0
- package/float64/base/signbit/docs/types/test.ts +43 -0
- package/float64/base/signbit/include/stdlib/number/float64/base/signbit.h +40 -0
- package/float64/base/signbit/lib/index.js +49 -0
- package/float64/base/signbit/lib/main.js +61 -0
- package/float64/base/signbit/lib/native.js +59 -0
- package/float64/base/signbit/manifest.json +40 -0
- package/float64/base/signbit/package.json +76 -0
- package/float64/base/signbit/src/addon.c +89 -0
- package/float64/base/signbit/src/main.c +42 -0
- package/float64/base/sub/README.md +218 -0
- package/float64/base/sub/docs/repl.txt +33 -0
- package/float64/base/sub/docs/types/index.d.ts +53 -0
- package/float64/base/sub/docs/types/test.ts +58 -0
- package/float64/base/sub/include/stdlib/number/float64/base/sub.h +38 -0
- package/float64/base/sub/lib/index.js +52 -0
- package/float64/base/sub/lib/main.js +57 -0
- package/float64/base/sub/lib/native.js +63 -0
- package/float64/base/sub/manifest.json +67 -0
- package/float64/base/sub/package.json +185 -0
- package/float64/base/sub/src/addon.c +22 -0
- package/float64/base/sub/src/sub.c +34 -0
- package/float64/base/sub3/README.md +203 -0
- package/float64/base/sub3/docs/repl.txt +36 -0
- package/float64/base/sub3/docs/types/index.d.ts +54 -0
- package/float64/base/sub3/docs/types/test.ts +71 -0
- package/float64/base/sub3/include/stdlib/number/float64/base/sub3.h +38 -0
- package/float64/base/sub3/lib/index.js +52 -0
- package/float64/base/sub3/lib/main.js +58 -0
- package/float64/base/sub3/lib/native.js +64 -0
- package/float64/base/sub3/manifest.json +67 -0
- package/float64/base/sub3/package.json +68 -0
- package/float64/base/sub3/src/addon.c +22 -0
- package/float64/base/sub3/src/main.c +35 -0
- package/float64/base/to-binary-string/README.md +155 -0
- package/float64/base/to-binary-string/docs/repl.txt +41 -0
- package/float64/base/to-binary-string/docs/types/index.d.ts +72 -0
- package/float64/base/to-binary-string/docs/types/test.ts +43 -0
- package/float64/base/to-binary-string/lib/div2.js +71 -0
- package/float64/base/to-binary-string/lib/index.js +67 -0
- package/float64/base/to-binary-string/lib/main.js +183 -0
- package/float64/base/to-binary-string/lib/mult2.js +80 -0
- package/float64/base/to-binary-string/package.json +73 -0
- package/float64/base/to-float16/README.md +186 -0
- package/float64/base/to-float16/docs/repl.txt +22 -0
- package/float64/base/to-float16/docs/types/index.d.ts +36 -0
- package/float64/base/to-float16/docs/types/test.ts +43 -0
- package/float64/base/to-float16/include/stdlib/number/float64/base/to_float16.h +41 -0
- package/float64/base/to-float16/lib/index.js +51 -0
- package/float64/base/to-float16/lib/main.js +28 -0
- package/float64/base/to-float16/lib/native.js +47 -0
- package/float64/base/to-float16/lib/polyfill.js +93 -0
- package/float64/base/to-float16/manifest.json +94 -0
- package/float64/base/to-float16/package.json +75 -0
- package/float64/base/to-float16/src/addon.c +90 -0
- package/float64/base/to-float16/src/main.c +36 -0
- package/float64/base/to-float32/README.md +100 -0
- package/float64/base/to-float32/docs/repl.txt +22 -0
- package/float64/base/to-float32/docs/types/index.d.ts +36 -0
- package/float64/base/to-float32/docs/types/test.ts +43 -0
- package/float64/base/to-float32/lib/index.js +51 -0
- package/float64/base/to-float32/lib/main.js +28 -0
- package/float64/base/to-float32/lib/polyfill.js +51 -0
- package/float64/base/to-float32/package.json +72 -0
- package/float64/base/to-int32/README.md +120 -0
- package/float64/base/to-int32/docs/repl.txt +32 -0
- package/float64/base/to-int32/docs/types/index.d.ts +56 -0
- package/float64/base/to-int32/docs/types/test.ts +43 -0
- package/float64/base/to-int32/lib/index.js +55 -0
- package/float64/base/to-int32/lib/main.js +61 -0
- package/float64/base/to-int32/package.json +74 -0
- package/float64/base/to-int64-bytes/README.md +134 -0
- package/float64/base/to-int64-bytes/docs/repl.txt +59 -0
- package/float64/base/to-int64-bytes/docs/types/index.d.ts +94 -0
- package/float64/base/to-int64-bytes/docs/types/test.ts +111 -0
- package/float64/base/to-int64-bytes/lib/assign.js +100 -0
- package/float64/base/to-int64-bytes/lib/index.js +55 -0
- package/float64/base/to-int64-bytes/lib/main.js +85 -0
- package/float64/base/to-int64-bytes/package.json +75 -0
- package/float64/base/to-uint32/README.md +122 -0
- package/float64/base/to-uint32/docs/repl.txt +32 -0
- package/float64/base/to-uint32/docs/types/index.d.ts +56 -0
- package/float64/base/to-uint32/docs/types/test.ts +43 -0
- package/float64/base/to-uint32/lib/index.js +55 -0
- package/float64/base/to-uint32/lib/main.js +61 -0
- package/float64/base/to-uint32/package.json +74 -0
- package/float64/base/to-words/README.md +257 -0
- package/float64/base/to-words/docs/repl.txt +65 -0
- package/float64/base/to-words/docs/types/index.d.ts +79 -0
- package/float64/base/to-words/docs/types/test.ts +108 -0
- package/float64/base/to-words/include/stdlib/number/float64/base/to_words.h +71 -0
- package/float64/base/to-words/lib/assign.js +107 -0
- package/float64/base/to-words/lib/index.js +59 -0
- package/float64/base/to-words/lib/indices.js +47 -0
- package/float64/base/to-words/lib/main.js +45 -0
- package/float64/base/to-words/lib/native.js +55 -0
- package/float64/base/to-words/manifest.json +41 -0
- package/float64/base/to-words/package.json +80 -0
- package/float64/base/to-words/src/addon.c +116 -0
- package/float64/base/to-words/src/main.c +42 -0
- package/float64/base/ulp-difference/README.md +146 -0
- package/float64/base/ulp-difference/docs/repl.txt +45 -0
- package/float64/base/ulp-difference/docs/types/index.d.ts +59 -0
- package/float64/base/ulp-difference/docs/types/test.ts +58 -0
- package/float64/base/ulp-difference/lib/index.js +56 -0
- package/float64/base/ulp-difference/lib/main.js +210 -0
- package/float64/base/ulp-difference/package.json +68 -0
- package/float64/docs/types/index.d.ts +74 -0
- package/float64/docs/types/test.ts +29 -0
- package/float64/lib/index.js +69 -0
- package/float64/package.json +64 -0
- package/float64/reviver/README.md +129 -0
- package/float64/reviver/docs/repl.txt +38 -0
- package/float64/reviver/docs/types/index.d.ts +41 -0
- package/float64/reviver/docs/types/test.ts +47 -0
- package/float64/reviver/lib/index.js +43 -0
- package/float64/reviver/lib/main.js +66 -0
- package/float64/reviver/package.json +69 -0
- package/float64/to-json/README.md +113 -0
- package/float64/to-json/docs/repl.txt +36 -0
- package/float64/to-json/docs/types/index.d.ts +36 -0
- package/float64/to-json/docs/types/test.ts +41 -0
- package/float64/to-json/lib/index.js +40 -0
- package/float64/to-json/lib/main.js +69 -0
- package/float64/to-json/package.json +66 -0
- package/int16/base/README.md +95 -0
- package/int16/base/docs/types/index.d.ts +62 -0
- package/int16/base/docs/types/test.ts +29 -0
- package/int16/base/identity/README.md +208 -0
- package/int16/base/identity/docs/img/equation_identity_function.svg +18 -0
- package/int16/base/identity/docs/repl.txt +28 -0
- package/int16/base/identity/docs/types/index.d.ts +48 -0
- package/int16/base/identity/docs/types/test.ts +44 -0
- package/int16/base/identity/include/stdlib/number/int16/base/identity.h +40 -0
- package/int16/base/identity/lib/index.js +49 -0
- package/int16/base/identity/lib/main.js +50 -0
- package/int16/base/identity/lib/native.js +58 -0
- package/int16/base/identity/manifest.json +67 -0
- package/int16/base/identity/package.json +65 -0
- package/int16/base/identity/src/addon.c +22 -0
- package/int16/base/identity/src/main.c +36 -0
- package/int16/base/lib/index.js +51 -0
- package/int16/base/package.json +68 -0
- package/int32/README.md +97 -0
- package/int32/base/README.md +104 -0
- package/int32/base/docs/types/index.d.ts +113 -0
- package/int32/base/docs/types/test.ts +29 -0
- package/int32/base/identity/README.md +208 -0
- package/int32/base/identity/docs/img/equation_identity_function.svg +18 -0
- package/int32/base/identity/docs/repl.txt +28 -0
- package/int32/base/identity/docs/types/index.d.ts +48 -0
- package/int32/base/identity/docs/types/test.ts +44 -0
- package/int32/base/identity/include/stdlib/number/int32/base/identity.h +40 -0
- package/int32/base/identity/lib/index.js +49 -0
- package/int32/base/identity/lib/main.js +50 -0
- package/int32/base/identity/lib/native.js +58 -0
- package/int32/base/identity/manifest.json +67 -0
- package/int32/base/identity/package.json +65 -0
- package/int32/base/identity/src/addon.c +22 -0
- package/int32/base/identity/src/main.c +36 -0
- package/int32/base/lib/index.js +78 -0
- package/int32/base/mul/README.md +125 -0
- package/int32/base/mul/docs/repl.txt +25 -0
- package/int32/base/mul/docs/types/index.d.ts +37 -0
- package/int32/base/mul/docs/types/test.ts +56 -0
- package/int32/base/mul/lib/index.js +51 -0
- package/int32/base/mul/lib/main.js +28 -0
- package/int32/base/mul/lib/polyfill.js +132 -0
- package/int32/base/mul/package.json +189 -0
- package/int32/base/muldw/README.md +133 -0
- package/int32/base/muldw/docs/repl.txt +74 -0
- package/int32/base/muldw/docs/types/index.d.ts +87 -0
- package/int32/base/muldw/docs/types/test.ts +130 -0
- package/int32/base/muldw/lib/assign.js +86 -0
- package/int32/base/muldw/lib/index.js +47 -0
- package/int32/base/muldw/lib/main.js +46 -0
- package/int32/base/muldw/package.json +74 -0
- package/int32/base/package.json +68 -0
- package/int32/base/to-uint32/README.md +114 -0
- package/int32/base/to-uint32/docs/repl.txt +24 -0
- package/int32/base/to-uint32/docs/types/index.d.ts +42 -0
- package/int32/base/to-uint32/docs/types/test.ts +43 -0
- package/int32/base/to-uint32/lib/index.js +44 -0
- package/int32/base/to-uint32/lib/main.js +49 -0
- package/int32/base/to-uint32/package.json +73 -0
- package/int32/docs/types/index.d.ts +43 -0
- package/int32/docs/types/test.ts +29 -0
- package/int32/lib/index.js +51 -0
- package/int32/package.json +62 -0
- package/int8/base/README.md +95 -0
- package/int8/base/docs/types/index.d.ts +62 -0
- package/int8/base/docs/types/test.ts +29 -0
- package/int8/base/identity/README.md +208 -0
- package/int8/base/identity/docs/img/equation_identity_function.svg +18 -0
- package/int8/base/identity/docs/repl.txt +28 -0
- package/int8/base/identity/docs/types/index.d.ts +48 -0
- package/int8/base/identity/docs/types/test.ts +44 -0
- package/int8/base/identity/include/stdlib/number/int8/base/identity.h +40 -0
- package/int8/base/identity/lib/index.js +49 -0
- package/int8/base/identity/lib/main.js +50 -0
- package/int8/base/identity/lib/native.js +58 -0
- package/int8/base/identity/manifest.json +67 -0
- package/int8/base/identity/package.json +65 -0
- package/int8/base/identity/src/addon.c +22 -0
- package/int8/base/identity/src/main.c +36 -0
- package/int8/base/lib/index.js +51 -0
- package/int8/base/package.json +68 -0
- package/lib/index.js +105 -0
- package/package.json +64 -3
- package/uint16/README.md +97 -0
- package/uint16/base/README.md +110 -0
- package/uint16/base/add/README.md +207 -0
- package/uint16/base/add/docs/repl.txt +32 -0
- package/uint16/base/add/docs/types/index.d.ts +49 -0
- package/uint16/base/add/docs/types/test.ts +58 -0
- package/uint16/base/add/include/stdlib/number/uint16/base/add.h +40 -0
- package/uint16/base/add/lib/index.js +46 -0
- package/uint16/base/add/lib/main.js +56 -0
- package/uint16/base/add/lib/native.js +55 -0
- package/uint16/base/add/manifest.json +67 -0
- package/uint16/base/add/package.json +186 -0
- package/uint16/base/add/src/addon.c +22 -0
- package/uint16/base/add/src/main.c +35 -0
- package/uint16/base/docs/types/index.d.ts +198 -0
- package/uint16/base/docs/types/test.ts +29 -0
- package/uint16/base/from-binary-string/README.md +122 -0
- package/uint16/base/from-binary-string/docs/repl.txt +32 -0
- package/uint16/base/from-binary-string/docs/types/index.d.ts +53 -0
- package/uint16/base/from-binary-string/docs/types/test.ts +42 -0
- package/uint16/base/from-binary-string/lib/index.js +53 -0
- package/uint16/base/from-binary-string/lib/main.js +79 -0
- package/uint16/base/from-binary-string/package.json +74 -0
- package/uint16/base/identity/README.md +208 -0
- package/uint16/base/identity/docs/img/equation_identity_function.svg +18 -0
- package/uint16/base/identity/docs/repl.txt +28 -0
- package/uint16/base/identity/docs/types/index.d.ts +48 -0
- package/uint16/base/identity/docs/types/test.ts +44 -0
- package/uint16/base/identity/include/stdlib/number/uint16/base/identity.h +40 -0
- package/uint16/base/identity/lib/index.js +49 -0
- package/uint16/base/identity/lib/main.js +50 -0
- package/uint16/base/identity/lib/native.js +58 -0
- package/uint16/base/identity/manifest.json +67 -0
- package/uint16/base/identity/package.json +65 -0
- package/uint16/base/identity/src/addon.c +22 -0
- package/uint16/base/identity/src/main.c +36 -0
- package/uint16/base/lib/index.js +96 -0
- package/uint16/base/mul/README.md +207 -0
- package/uint16/base/mul/docs/repl.txt +32 -0
- package/uint16/base/mul/docs/types/index.d.ts +49 -0
- package/uint16/base/mul/docs/types/test.ts +58 -0
- package/uint16/base/mul/include/stdlib/number/uint16/base/mul.h +40 -0
- package/uint16/base/mul/lib/index.js +46 -0
- package/uint16/base/mul/lib/main.js +61 -0
- package/uint16/base/mul/lib/native.js +55 -0
- package/uint16/base/mul/manifest.json +67 -0
- package/uint16/base/mul/package.json +185 -0
- package/uint16/base/mul/src/addon.c +22 -0
- package/uint16/base/mul/src/main.c +35 -0
- package/uint16/base/package.json +68 -0
- package/uint16/base/sub/README.md +207 -0
- package/uint16/base/sub/docs/repl.txt +32 -0
- package/uint16/base/sub/docs/types/index.d.ts +49 -0
- package/uint16/base/sub/docs/types/test.ts +58 -0
- package/uint16/base/sub/include/stdlib/number/uint16/base/sub.h +40 -0
- package/uint16/base/sub/lib/index.js +46 -0
- package/uint16/base/sub/lib/main.js +56 -0
- package/uint16/base/sub/lib/native.js +55 -0
- package/uint16/base/sub/manifest.json +67 -0
- package/uint16/base/sub/package.json +185 -0
- package/uint16/base/sub/src/addon.c +22 -0
- package/uint16/base/sub/src/main.c +35 -0
- package/uint16/base/to-binary-string/README.md +150 -0
- package/uint16/base/to-binary-string/docs/repl.txt +36 -0
- package/uint16/base/to-binary-string/docs/types/index.d.ts +51 -0
- package/uint16/base/to-binary-string/docs/types/test.ts +43 -0
- package/uint16/base/to-binary-string/lib/div2.js +79 -0
- package/uint16/base/to-binary-string/lib/index.js +47 -0
- package/uint16/base/to-binary-string/lib/main.js +70 -0
- package/uint16/base/to-binary-string/package.json +74 -0
- package/uint16/docs/types/index.d.ts +43 -0
- package/uint16/docs/types/test.ts +29 -0
- package/uint16/lib/index.js +51 -0
- package/uint16/package.json +62 -0
- package/uint32/README.md +97 -0
- package/uint32/base/README.md +122 -0
- package/uint32/base/add/README.md +207 -0
- package/uint32/base/add/docs/repl.txt +32 -0
- package/uint32/base/add/docs/types/index.d.ts +49 -0
- package/uint32/base/add/docs/types/test.ts +58 -0
- package/uint32/base/add/include/stdlib/number/uint32/base/add.h +40 -0
- package/uint32/base/add/lib/index.js +46 -0
- package/uint32/base/add/lib/main.js +55 -0
- package/uint32/base/add/lib/native.js +55 -0
- package/uint32/base/add/manifest.json +67 -0
- package/uint32/base/add/package.json +186 -0
- package/uint32/base/add/src/addon.c +22 -0
- package/uint32/base/add/src/main.c +35 -0
- package/uint32/base/docs/types/index.d.ts +285 -0
- package/uint32/base/docs/types/test.ts +29 -0
- package/uint32/base/from-binary-string/README.md +122 -0
- package/uint32/base/from-binary-string/docs/repl.txt +32 -0
- package/uint32/base/from-binary-string/docs/types/index.d.ts +53 -0
- package/uint32/base/from-binary-string/docs/types/test.ts +42 -0
- package/uint32/base/from-binary-string/lib/index.js +53 -0
- package/uint32/base/from-binary-string/lib/main.js +80 -0
- package/uint32/base/from-binary-string/package.json +74 -0
- package/uint32/base/identity/README.md +208 -0
- package/uint32/base/identity/docs/img/equation_identity_function.svg +18 -0
- package/uint32/base/identity/docs/repl.txt +28 -0
- package/uint32/base/identity/docs/types/index.d.ts +48 -0
- package/uint32/base/identity/docs/types/test.ts +44 -0
- package/uint32/base/identity/include/stdlib/number/uint32/base/identity.h +40 -0
- package/uint32/base/identity/lib/index.js +49 -0
- package/uint32/base/identity/lib/main.js +50 -0
- package/uint32/base/identity/lib/native.js +58 -0
- package/uint32/base/identity/manifest.json +67 -0
- package/uint32/base/identity/package.json +65 -0
- package/uint32/base/identity/src/addon.c +22 -0
- package/uint32/base/identity/src/main.c +36 -0
- package/uint32/base/lib/index.js +132 -0
- package/uint32/base/mul/README.md +210 -0
- package/uint32/base/mul/docs/repl.txt +28 -0
- package/uint32/base/mul/docs/types/index.d.ts +41 -0
- package/uint32/base/mul/docs/types/test.ts +56 -0
- package/uint32/base/mul/include/stdlib/number/uint32/base/mul.h +40 -0
- package/uint32/base/mul/lib/index.js +40 -0
- package/uint32/base/mul/lib/main.js +46 -0
- package/uint32/base/mul/lib/native.js +55 -0
- package/uint32/base/mul/lib/polyfill.js +132 -0
- package/uint32/base/mul/manifest.json +67 -0
- package/uint32/base/mul/package.json +194 -0
- package/uint32/base/mul/src/addon.c +22 -0
- package/uint32/base/mul/src/main.c +35 -0
- package/uint32/base/muldw/README.md +136 -0
- package/uint32/base/muldw/docs/repl.txt +75 -0
- package/uint32/base/muldw/docs/types/index.d.ts +85 -0
- package/uint32/base/muldw/docs/types/test.ts +130 -0
- package/uint32/base/muldw/lib/assign.js +87 -0
- package/uint32/base/muldw/lib/index.js +47 -0
- package/uint32/base/muldw/lib/main.js +46 -0
- package/uint32/base/muldw/package.json +74 -0
- package/uint32/base/package.json +68 -0
- package/uint32/base/rotl/README.md +139 -0
- package/uint32/base/rotl/docs/repl.txt +35 -0
- package/uint32/base/rotl/docs/types/index.d.ts +52 -0
- package/uint32/base/rotl/docs/types/test.ts +53 -0
- package/uint32/base/rotl/lib/index.js +47 -0
- package/uint32/base/rotl/lib/main.js +67 -0
- package/uint32/base/rotl/package.json +77 -0
- package/uint32/base/rotr/README.md +139 -0
- package/uint32/base/rotr/docs/repl.txt +35 -0
- package/uint32/base/rotr/docs/types/index.d.ts +52 -0
- package/uint32/base/rotr/docs/types/test.ts +53 -0
- package/uint32/base/rotr/lib/index.js +47 -0
- package/uint32/base/rotr/lib/main.js +67 -0
- package/uint32/base/rotr/package.json +77 -0
- package/uint32/base/sub/README.md +207 -0
- package/uint32/base/sub/docs/repl.txt +32 -0
- package/uint32/base/sub/docs/types/index.d.ts +49 -0
- package/uint32/base/sub/docs/types/test.ts +58 -0
- package/uint32/base/sub/include/stdlib/number/uint32/base/sub.h +40 -0
- package/uint32/base/sub/lib/index.js +46 -0
- package/uint32/base/sub/lib/main.js +55 -0
- package/uint32/base/sub/lib/native.js +55 -0
- package/uint32/base/sub/manifest.json +67 -0
- package/uint32/base/sub/package.json +185 -0
- package/uint32/base/sub/src/addon.c +22 -0
- package/uint32/base/sub/src/main.c +35 -0
- package/uint32/base/to-binary-string/README.md +149 -0
- package/uint32/base/to-binary-string/docs/repl.txt +36 -0
- package/uint32/base/to-binary-string/docs/types/index.d.ts +51 -0
- package/uint32/base/to-binary-string/docs/types/test.ts +43 -0
- package/uint32/base/to-binary-string/lib/div2.js +79 -0
- package/uint32/base/to-binary-string/lib/index.js +47 -0
- package/uint32/base/to-binary-string/lib/main.js +70 -0
- package/uint32/base/to-binary-string/package.json +74 -0
- package/uint32/base/to-int32/README.md +96 -0
- package/uint32/base/to-int32/docs/repl.txt +24 -0
- package/uint32/base/to-int32/docs/types/index.d.ts +42 -0
- package/uint32/base/to-int32/docs/types/test.ts +43 -0
- package/uint32/base/to-int32/lib/index.js +44 -0
- package/uint32/base/to-int32/lib/main.js +47 -0
- package/uint32/base/to-int32/package.json +73 -0
- package/uint32/docs/types/index.d.ts +43 -0
- package/uint32/docs/types/test.ts +29 -0
- package/uint32/lib/index.js +51 -0
- package/uint32/package.json +62 -0
- package/uint64/ctor/README.md +262 -0
- package/uint64/ctor/docs/repl.txt +153 -0
- package/uint64/ctor/docs/types/index.d.ts +185 -0
- package/uint64/ctor/docs/types/test.ts +103 -0
- package/uint64/ctor/lib/index.js +40 -0
- package/uint64/ctor/lib/indices.js +47 -0
- package/uint64/ctor/lib/main.js +346 -0
- package/uint64/ctor/lib/to_string.js +170 -0
- package/uint64/ctor/package.json +65 -0
- package/uint8/README.md +97 -0
- package/uint8/base/README.md +110 -0
- package/uint8/base/add/README.md +207 -0
- package/uint8/base/add/docs/repl.txt +32 -0
- package/uint8/base/add/docs/types/index.d.ts +49 -0
- package/uint8/base/add/docs/types/test.ts +58 -0
- package/uint8/base/add/include/stdlib/number/uint8/base/add.h +40 -0
- package/uint8/base/add/lib/index.js +46 -0
- package/uint8/base/add/lib/main.js +56 -0
- package/uint8/base/add/lib/native.js +55 -0
- package/uint8/base/add/manifest.json +67 -0
- package/uint8/base/add/package.json +186 -0
- package/uint8/base/add/src/addon.c +22 -0
- package/uint8/base/add/src/main.c +35 -0
- package/uint8/base/docs/types/index.d.ts +198 -0
- package/uint8/base/docs/types/test.ts +29 -0
- package/uint8/base/from-binary-string/README.md +117 -0
- package/uint8/base/from-binary-string/docs/repl.txt +32 -0
- package/uint8/base/from-binary-string/docs/types/index.d.ts +53 -0
- package/uint8/base/from-binary-string/docs/types/test.ts +42 -0
- package/uint8/base/from-binary-string/lib/index.js +53 -0
- package/uint8/base/from-binary-string/lib/main.js +79 -0
- package/uint8/base/from-binary-string/package.json +74 -0
- package/uint8/base/identity/README.md +208 -0
- package/uint8/base/identity/docs/img/equation_identity_function.svg +18 -0
- package/uint8/base/identity/docs/repl.txt +28 -0
- package/uint8/base/identity/docs/types/index.d.ts +48 -0
- package/uint8/base/identity/docs/types/test.ts +44 -0
- package/uint8/base/identity/include/stdlib/number/uint8/base/identity.h +40 -0
- package/uint8/base/identity/lib/index.js +49 -0
- package/uint8/base/identity/lib/main.js +50 -0
- package/uint8/base/identity/lib/native.js +58 -0
- package/uint8/base/identity/manifest.json +67 -0
- package/uint8/base/identity/package.json +65 -0
- package/uint8/base/identity/src/addon.c +22 -0
- package/uint8/base/identity/src/main.c +36 -0
- package/uint8/base/lib/index.js +96 -0
- package/uint8/base/mul/README.md +207 -0
- package/uint8/base/mul/docs/repl.txt +32 -0
- package/uint8/base/mul/docs/types/index.d.ts +49 -0
- package/uint8/base/mul/docs/types/test.ts +58 -0
- package/uint8/base/mul/include/stdlib/number/uint8/base/mul.h +40 -0
- package/uint8/base/mul/lib/index.js +46 -0
- package/uint8/base/mul/lib/main.js +56 -0
- package/uint8/base/mul/lib/native.js +55 -0
- package/uint8/base/mul/manifest.json +67 -0
- package/uint8/base/mul/package.json +185 -0
- package/uint8/base/mul/src/addon.c +22 -0
- package/uint8/base/mul/src/main.c +35 -0
- package/uint8/base/package.json +68 -0
- package/uint8/base/sub/README.md +207 -0
- package/uint8/base/sub/docs/repl.txt +32 -0
- package/uint8/base/sub/docs/types/index.d.ts +49 -0
- package/uint8/base/sub/docs/types/test.ts +58 -0
- package/uint8/base/sub/include/stdlib/number/uint8/base/sub.h +40 -0
- package/uint8/base/sub/lib/index.js +46 -0
- package/uint8/base/sub/lib/main.js +56 -0
- package/uint8/base/sub/lib/native.js +55 -0
- package/uint8/base/sub/manifest.json +67 -0
- package/uint8/base/sub/package.json +185 -0
- package/uint8/base/sub/src/addon.c +22 -0
- package/uint8/base/sub/src/main.c +35 -0
- package/uint8/base/to-binary-string/README.md +147 -0
- package/uint8/base/to-binary-string/docs/repl.txt +36 -0
- package/uint8/base/to-binary-string/docs/types/index.d.ts +51 -0
- package/uint8/base/to-binary-string/docs/types/test.ts +43 -0
- package/uint8/base/to-binary-string/lib/div2.js +79 -0
- package/uint8/base/to-binary-string/lib/index.js +48 -0
- package/uint8/base/to-binary-string/lib/main.js +70 -0
- package/uint8/base/to-binary-string/package.json +74 -0
- package/uint8/docs/types/index.d.ts +43 -0
- package/uint8/docs/types/test.ts +29 -0
- package/uint8/lib/index.js +51 -0
- package/uint8/package.json +62 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
@license Apache-2.0
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2018 The Stdlib Authors.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
# Words
|
|
22
|
+
|
|
23
|
+
> Split a [double-precision floating-point number][ieee754] into a higher order word and a lower order word.
|
|
24
|
+
|
|
25
|
+
<section class="usage">
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
var toWords = require( '@stdlib/number/float64/base/to-words' );
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### toWords( x )
|
|
34
|
+
|
|
35
|
+
Splits a [double-precision floating-point number][ieee754] into a higher order word (unsigned 32-bit `integer`) and a lower order word (unsigned 32-bit `integer`).
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
var w = toWords( 3.14e201 );
|
|
39
|
+
// returns [ 1774486211, 2479577218 ]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
By default, the function returns an `array` containing two elements: a higher order word and a lower order word. The lower order word contains the less significant bits, while the higher order word contains the more significant bits and includes the exponent and sign.
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
var w = toWords( 3.14e201 );
|
|
46
|
+
// returns [ 1774486211, 2479577218 ]
|
|
47
|
+
|
|
48
|
+
var high = w[ 0 ];
|
|
49
|
+
// returns 1774486211
|
|
50
|
+
|
|
51
|
+
var low = w[ 1 ];
|
|
52
|
+
// returns 2479577218
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### toWords.assign( x, out, stride, offset )
|
|
56
|
+
|
|
57
|
+
Splits a [double-precision floating-point number][ieee754] into a higher order word (unsigned 32-bit `integer`) and a lower order word (unsigned 32-bit `integer`) and assigns results to a provided output array.
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
var Uint32Array = require( '@stdlib/array/uint32' );
|
|
61
|
+
|
|
62
|
+
var out = new Uint32Array( 2 );
|
|
63
|
+
|
|
64
|
+
var w = toWords.assign( 3.14e201, out, 1, 0 );
|
|
65
|
+
// returns <Uint32Array>[ 1774486211, 2479577218 ]
|
|
66
|
+
|
|
67
|
+
var bool = ( w === out );
|
|
68
|
+
// returns true
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
</section>
|
|
72
|
+
|
|
73
|
+
<!-- /.usage -->
|
|
74
|
+
|
|
75
|
+
<section class="examples">
|
|
76
|
+
|
|
77
|
+
## Examples
|
|
78
|
+
|
|
79
|
+
<!-- eslint no-undef: "error" -->
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
var floor = require( '@stdlib/math/base/special/floor' );
|
|
83
|
+
var randu = require( '@stdlib/random/base/randu' );
|
|
84
|
+
var pow = require( '@stdlib/math/base/special/pow' );
|
|
85
|
+
var toWords = require( '@stdlib/number/float64/base/to-words' );
|
|
86
|
+
|
|
87
|
+
var frac;
|
|
88
|
+
var exp;
|
|
89
|
+
var w;
|
|
90
|
+
var x;
|
|
91
|
+
var i;
|
|
92
|
+
|
|
93
|
+
// Generate random numbers and split into words...
|
|
94
|
+
for ( i = 0; i < 100; i++ ) {
|
|
95
|
+
frac = randu() * 10.0;
|
|
96
|
+
exp = -floor( randu()*324.0 );
|
|
97
|
+
x = frac * pow( 10.0, exp );
|
|
98
|
+
w = toWords( x );
|
|
99
|
+
console.log( 'x: %d. higher: %d. lower: %d.', x, w[ 0 ], w[ 1 ] );
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
</section>
|
|
104
|
+
|
|
105
|
+
<!-- /.examples -->
|
|
106
|
+
|
|
107
|
+
<!-- C interface documentation. -->
|
|
108
|
+
|
|
109
|
+
* * *
|
|
110
|
+
|
|
111
|
+
<section class="c">
|
|
112
|
+
|
|
113
|
+
## C APIs
|
|
114
|
+
|
|
115
|
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
116
|
+
|
|
117
|
+
<section class="intro">
|
|
118
|
+
|
|
119
|
+
</section>
|
|
120
|
+
|
|
121
|
+
<!-- /.intro -->
|
|
122
|
+
|
|
123
|
+
<!-- C usage documentation. -->
|
|
124
|
+
|
|
125
|
+
<section class="usage">
|
|
126
|
+
|
|
127
|
+
### Usage
|
|
128
|
+
|
|
129
|
+
```c
|
|
130
|
+
#include "stdlib/number/float64/base/to_words.h"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### stdlib_base_float64_to_words( x, \*high, \*low )
|
|
134
|
+
|
|
135
|
+
Splits a double-precision floating-point number into a higher order word and a lower order word.
|
|
136
|
+
|
|
137
|
+
```c
|
|
138
|
+
#include <stdint.h>
|
|
139
|
+
|
|
140
|
+
uint32_t high;
|
|
141
|
+
uint32_t low;
|
|
142
|
+
|
|
143
|
+
stdlib_base_float64_to_words( 3.14, &high, &low );
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The function accepts the following arguments:
|
|
147
|
+
|
|
148
|
+
- **x**: `[in] double` input value.
|
|
149
|
+
- **high**: `[out] uint32_t*` destination for higher order word.
|
|
150
|
+
- **low**: `[out] uint32_t*` destination for lower order word.
|
|
151
|
+
|
|
152
|
+
```c
|
|
153
|
+
void stdlib_base_float64_to_words( const double x, uint32_t *high, uint32_t *low );
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### stdlib_base_float64_words_t
|
|
157
|
+
|
|
158
|
+
An opaque type definition for a union for converting between a double-precision floating-point number and two unsigned 32-bit integers.
|
|
159
|
+
|
|
160
|
+
```c
|
|
161
|
+
#include <stdint.h>
|
|
162
|
+
|
|
163
|
+
stdlib_base_float64_words_t w;
|
|
164
|
+
|
|
165
|
+
// Assign a double-precision floating-point number:
|
|
166
|
+
w.value = 3.14;
|
|
167
|
+
|
|
168
|
+
// Extract the high and low words:
|
|
169
|
+
uint32_t high = w.words.high;
|
|
170
|
+
uint32_t low = w.words.low;
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The union has the following members:
|
|
174
|
+
|
|
175
|
+
- **value**: `double` double-precision floating-point number.
|
|
176
|
+
|
|
177
|
+
- **words**: `struct` struct having the following members:
|
|
178
|
+
|
|
179
|
+
- **high**: `uint32_t` higher order word.
|
|
180
|
+
- **low**: `uint32_t` lower order word.
|
|
181
|
+
|
|
182
|
+
</section>
|
|
183
|
+
|
|
184
|
+
<!-- /.usage -->
|
|
185
|
+
|
|
186
|
+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
187
|
+
|
|
188
|
+
<section class="notes">
|
|
189
|
+
|
|
190
|
+
</section>
|
|
191
|
+
|
|
192
|
+
<!-- /.notes -->
|
|
193
|
+
|
|
194
|
+
<!-- C API usage examples. -->
|
|
195
|
+
|
|
196
|
+
<section class="examples">
|
|
197
|
+
|
|
198
|
+
### Examples
|
|
199
|
+
|
|
200
|
+
```c
|
|
201
|
+
#include "stdlib/number/float64/base/to_words.h"
|
|
202
|
+
#include <stdint.h>
|
|
203
|
+
#include <stdio.h>
|
|
204
|
+
|
|
205
|
+
int main( void ) {
|
|
206
|
+
double x[] = { 3.14, -3.14, 0.0, 0.0/0.0 };
|
|
207
|
+
|
|
208
|
+
uint32_t high;
|
|
209
|
+
uint32_t low;
|
|
210
|
+
int i;
|
|
211
|
+
for ( i = 0; i < 4; i++ ) {
|
|
212
|
+
stdlib_base_float64_to_words( x[ i ], &high, &low );
|
|
213
|
+
printf( "%lf => high: %u, low: %u\n", x[ i ], high, low );
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
</section>
|
|
219
|
+
|
|
220
|
+
<!-- /.examples -->
|
|
221
|
+
|
|
222
|
+
</section>
|
|
223
|
+
|
|
224
|
+
<!-- /.c -->
|
|
225
|
+
|
|
226
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
227
|
+
|
|
228
|
+
<section class="related">
|
|
229
|
+
|
|
230
|
+
* * *
|
|
231
|
+
|
|
232
|
+
## See Also
|
|
233
|
+
|
|
234
|
+
- <span class="package-name">[`@stdlib/number/float64/base/from-words`][@stdlib/number/float64/base/from-words]</span><span class="delimiter">: </span><span class="description">create a double-precision floating-point number from a higher order word and a lower order word.</span>
|
|
235
|
+
- <span class="package-name">[`@stdlib/number/float32/base/to-word`][@stdlib/number/float32/base/to-word]</span><span class="delimiter">: </span><span class="description">return an unsigned 32-bit integer corresponding to the IEEE 754 binary representation of a single-precision floating-point number.</span>
|
|
236
|
+
|
|
237
|
+
</section>
|
|
238
|
+
|
|
239
|
+
<!-- /.related -->
|
|
240
|
+
|
|
241
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
242
|
+
|
|
243
|
+
<section class="links">
|
|
244
|
+
|
|
245
|
+
[ieee754]: https://en.wikipedia.org/wiki/IEEE_754-1985
|
|
246
|
+
|
|
247
|
+
<!-- <related-links> -->
|
|
248
|
+
|
|
249
|
+
[@stdlib/number/float64/base/from-words]: https://github.com/stdlib-js/number/tree/main/float64/base/from-words
|
|
250
|
+
|
|
251
|
+
[@stdlib/number/float32/base/to-word]: https://github.com/stdlib-js/number/tree/main/float32/base/to-word
|
|
252
|
+
|
|
253
|
+
<!-- </related-links> -->
|
|
254
|
+
|
|
255
|
+
</section>
|
|
256
|
+
|
|
257
|
+
<!-- /.links -->
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
|
|
2
|
+
{{alias}}( x )
|
|
3
|
+
Splits a double-precision floating-point number into a higher order word
|
|
4
|
+
(unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer).
|
|
5
|
+
|
|
6
|
+
When provided a destination object, the function returns an array with two
|
|
7
|
+
elements: a higher order word and a lower order word, respectively. The
|
|
8
|
+
lower order word contains the less significant bits, while the higher order
|
|
9
|
+
word contains the more significant bits and includes the exponent and sign.
|
|
10
|
+
|
|
11
|
+
Parameters
|
|
12
|
+
----------
|
|
13
|
+
x: number
|
|
14
|
+
Double-precision floating-point number.
|
|
15
|
+
|
|
16
|
+
Returns
|
|
17
|
+
-------
|
|
18
|
+
out: Array<integer>
|
|
19
|
+
Higher and lower order words.
|
|
20
|
+
|
|
21
|
+
Examples
|
|
22
|
+
--------
|
|
23
|
+
> var w = {{alias}}( 3.14e201 )
|
|
24
|
+
[ 1774486211, 2479577218 ]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
{{alias}}.assign( x, out, stride, offset )
|
|
28
|
+
Splits a double-precision floating-point number into a higher order word
|
|
29
|
+
(unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer)
|
|
30
|
+
and assigns results to a provided output array.
|
|
31
|
+
|
|
32
|
+
When provided a destination object, the function returns an array with two
|
|
33
|
+
elements: a higher order word and a lower order word, respectively. The
|
|
34
|
+
lower order word contains the less significant bits, while the higher order
|
|
35
|
+
word contains the more significant bits and includes the exponent and sign.
|
|
36
|
+
|
|
37
|
+
Parameters
|
|
38
|
+
----------
|
|
39
|
+
x: number
|
|
40
|
+
Double-precision floating-point number.
|
|
41
|
+
|
|
42
|
+
out: Array|TypedArray|Object
|
|
43
|
+
Output array.
|
|
44
|
+
|
|
45
|
+
stride: integer
|
|
46
|
+
Output array stride.
|
|
47
|
+
|
|
48
|
+
offset: integer
|
|
49
|
+
Output array index offset.
|
|
50
|
+
|
|
51
|
+
Returns
|
|
52
|
+
-------
|
|
53
|
+
out: Array|TypedArray|Object
|
|
54
|
+
Higher and lower order words.
|
|
55
|
+
|
|
56
|
+
Examples
|
|
57
|
+
--------
|
|
58
|
+
> var out = new {{alias:@stdlib/array/uint32}}( 2 );
|
|
59
|
+
> var w = {{alias}}.assign( 3.14e201, out, 1, 0 )
|
|
60
|
+
<Uint32Array>[ 1774486211, 2479577218 ]
|
|
61
|
+
> var bool = ( w === out )
|
|
62
|
+
true
|
|
63
|
+
|
|
64
|
+
See Also
|
|
65
|
+
--------
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2021 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// TypeScript Version: 4.1
|
|
20
|
+
|
|
21
|
+
/// <reference types="@stdlib/types"/>
|
|
22
|
+
|
|
23
|
+
import { Collection } from '@stdlib/types/array';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Interface describing `toWords`.
|
|
27
|
+
*/
|
|
28
|
+
interface ToWords {
|
|
29
|
+
/**
|
|
30
|
+
* Splits a double-precision floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer).
|
|
31
|
+
*
|
|
32
|
+
* @param x - input value
|
|
33
|
+
* @returns output array
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* var w = toWords( 3.14e201 );
|
|
37
|
+
* // returns [ 1774486211, 2479577218 ]
|
|
38
|
+
*/
|
|
39
|
+
( x: number ): Array<number>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Splits a double-precision floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer) and assigns results to a provided output array.
|
|
43
|
+
*
|
|
44
|
+
* @param x - input value
|
|
45
|
+
* @param out - output array
|
|
46
|
+
* @param stride - output array stride
|
|
47
|
+
* @param offset - output array index offset
|
|
48
|
+
* @returns output array
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* var Uint32Array = require( '@stdlib/array/uint32' );
|
|
52
|
+
*
|
|
53
|
+
* var out = new Uint32Array( 2 );
|
|
54
|
+
*
|
|
55
|
+
* var w = toWords.assign( 3.14e201, out, 1, 0 );
|
|
56
|
+
* // returns <Uint32Array>[ 1774486211, 2479577218 ]
|
|
57
|
+
*
|
|
58
|
+
* var bool = ( w === out );
|
|
59
|
+
* // returns true
|
|
60
|
+
*/
|
|
61
|
+
assign<T = unknown>( x: number, out: Collection<T>, stride: number, offset: number ): Collection<T | number>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Splits a double-precision floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer).
|
|
66
|
+
*
|
|
67
|
+
* @param x - input value
|
|
68
|
+
* @returns output array
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* var w = toWords( 3.14e201 );
|
|
72
|
+
* // returns [ 1774486211, 2479577218 ]
|
|
73
|
+
*/
|
|
74
|
+
declare var toWords: ToWords;
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
// EXPORTS //
|
|
78
|
+
|
|
79
|
+
export = toWords;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2021 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import toWords = require( './index' );
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
// TESTS //
|
|
23
|
+
|
|
24
|
+
// The function returns an array...
|
|
25
|
+
{
|
|
26
|
+
toWords( 3.14e201 ); // $ExpectType number[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// The compiler throws an error if the function is provided a last argument that is not a number...
|
|
30
|
+
{
|
|
31
|
+
toWords( '5' ); // $ExpectError
|
|
32
|
+
toWords( true ); // $ExpectError
|
|
33
|
+
toWords( false ); // $ExpectError
|
|
34
|
+
toWords( null ); // $ExpectError
|
|
35
|
+
toWords( {} ); // $ExpectError
|
|
36
|
+
toWords( ( x: number ): number => x ); // $ExpectError
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// The compiler throws an error if the function is provided insufficient arguments...
|
|
40
|
+
{
|
|
41
|
+
toWords(); // $ExpectError
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Attached to the main export is an `assign` method which returns an array-like object containing numbers...
|
|
45
|
+
{
|
|
46
|
+
const out = [ 0.0, 0.0 ];
|
|
47
|
+
|
|
48
|
+
toWords.assign( 3.14e-319, out, 1, 0 ); // $ExpectType Collection<number>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// The compiler throws an error if the `assign` method is provided a first argument which is not a number...
|
|
52
|
+
{
|
|
53
|
+
const out = [ 0.0, 0.0 ];
|
|
54
|
+
|
|
55
|
+
toWords.assign( true, out, 1, 0 ); // $ExpectError
|
|
56
|
+
toWords.assign( false, out, 1, 0 ); // $ExpectError
|
|
57
|
+
toWords.assign( '5', out, 1, 0 ); // $ExpectError
|
|
58
|
+
toWords.assign( null, out, 1, 0 ); // $ExpectError
|
|
59
|
+
toWords.assign( [], out, 1, 0 ); // $ExpectError
|
|
60
|
+
toWords.assign( {}, out, 1, 0 ); // $ExpectError
|
|
61
|
+
toWords.assign( ( x: number ): number => x, out, 1, 0 ); // $ExpectError
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// The compiler throws an error if the `assign` method is provided a second argument which is not an array-like object...
|
|
65
|
+
{
|
|
66
|
+
toWords.assign( 1.0, 1, 1, 0 ); // $ExpectError
|
|
67
|
+
toWords.assign( 1.0, true, 1, 0 ); // $ExpectError
|
|
68
|
+
toWords.assign( 1.0, false, 1, 0 ); // $ExpectError
|
|
69
|
+
toWords.assign( 1.0, null, 1, 0 ); // $ExpectError
|
|
70
|
+
toWords.assign( 1.0, {}, 1, 0 ); // $ExpectError
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// The compiler throws an error if the `assign` method is provided a third argument which is not a number...
|
|
74
|
+
{
|
|
75
|
+
const out = [ 0.0, 0.0 ];
|
|
76
|
+
|
|
77
|
+
toWords.assign( 1.0, out, '5', 0 ); // $ExpectError
|
|
78
|
+
toWords.assign( 1.0, out, true, 0 ); // $ExpectError
|
|
79
|
+
toWords.assign( 1.0, out, false, 0 ); // $ExpectError
|
|
80
|
+
toWords.assign( 1.0, out, null, 0 ); // $ExpectError
|
|
81
|
+
toWords.assign( 1.0, out, [], 0 ); // $ExpectError
|
|
82
|
+
toWords.assign( 1.0, out, {}, 0 ); // $ExpectError
|
|
83
|
+
toWords.assign( 1.0, out, ( x: number ): number => x, 0 ); // $ExpectError
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// The compiler throws an error if the `assign` method is provided a fourth argument which is not a number...
|
|
87
|
+
{
|
|
88
|
+
const out = [ 0.0, 0.0 ];
|
|
89
|
+
|
|
90
|
+
toWords.assign( 1.0, out, 1, '5' ); // $ExpectError
|
|
91
|
+
toWords.assign( 1.0, out, 1, true ); // $ExpectError
|
|
92
|
+
toWords.assign( 1.0, out, 1, false ); // $ExpectError
|
|
93
|
+
toWords.assign( 1.0, out, 1, null ); // $ExpectError
|
|
94
|
+
toWords.assign( 1.0, out, 1, [] ); // $ExpectError
|
|
95
|
+
toWords.assign( 1.0, out, 1, {} ); // $ExpectError
|
|
96
|
+
toWords.assign( 1.0, out, 1, ( x: number ): number => x ); // $ExpectError
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// The compiler throws an error if the `assign` method is provided an unsupported number of arguments...
|
|
100
|
+
{
|
|
101
|
+
const out = [ 0.0, 0.0 ];
|
|
102
|
+
|
|
103
|
+
toWords.assign(); // $ExpectError
|
|
104
|
+
toWords.assign( 1.0 ); // $ExpectError
|
|
105
|
+
toWords.assign( 1.0, out ); // $ExpectError
|
|
106
|
+
toWords.assign( 1.0, out, 1 ); // $ExpectError
|
|
107
|
+
toWords.assign( 1.0, out, 1, 0, 1 ); // $ExpectError
|
|
108
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
#ifndef STDLIB_NUMBER_FLOAT64_BASE_TO_WORDS_H
|
|
20
|
+
#define STDLIB_NUMBER_FLOAT64_BASE_TO_WORDS_H
|
|
21
|
+
|
|
22
|
+
#include "stdlib/os/float_word_order.h"
|
|
23
|
+
#include "stdlib/os/byte_order.h"
|
|
24
|
+
#include <stdint.h>
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
28
|
+
*/
|
|
29
|
+
#ifdef __cplusplus
|
|
30
|
+
extern "C" {
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* An opaque type definition for a union for converting between a double-precision floating-point number and two unsigned 32-bit integers.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* #include <stdint.h>
|
|
38
|
+
*
|
|
39
|
+
* stdlib_base_float64_words_t w;
|
|
40
|
+
*
|
|
41
|
+
* // Assign a double-precision floating-point number:
|
|
42
|
+
* w.value = 3.14;
|
|
43
|
+
*
|
|
44
|
+
* // Extract the high and low words:
|
|
45
|
+
* uint32_t high = w.words.high;
|
|
46
|
+
* uint32_t low = w.words.low;
|
|
47
|
+
*/
|
|
48
|
+
typedef union {
|
|
49
|
+
double value;
|
|
50
|
+
struct {
|
|
51
|
+
#if STDLIB_OS_FLOAT_WORD_ORDER == STDLIB_OS_ORDER_LITTLE_ENDIAN
|
|
52
|
+
uint32_t low;
|
|
53
|
+
uint32_t high;
|
|
54
|
+
#elif STDLIB_OS_FLOAT_WORD_ORDER == STDLIB_OS_ORDER_BIG_ENDIAN
|
|
55
|
+
uint32_t high;
|
|
56
|
+
uint32_t low;
|
|
57
|
+
#endif
|
|
58
|
+
} words;
|
|
59
|
+
} stdlib_base_float64_words_t;
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Splits a double-precision floating-point number into a higher order word and a lower order word.
|
|
64
|
+
*/
|
|
65
|
+
void stdlib_base_float64_to_words( const double x, uint32_t *high, uint32_t *low );
|
|
66
|
+
|
|
67
|
+
#ifdef __cplusplus
|
|
68
|
+
}
|
|
69
|
+
#endif
|
|
70
|
+
|
|
71
|
+
#endif // !STDLIB_NUMBER_FLOAT64_BASE_TO_WORDS_H
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2018 The Stdlib Authors.
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var Uint32Array = require( '@stdlib/array/uint32' );
|
|
24
|
+
var Float64Array = require( '@stdlib/array/float64' );
|
|
25
|
+
var indices = require( './indices.js' );
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// VARIABLES //
|
|
29
|
+
|
|
30
|
+
var FLOAT64_VIEW = new Float64Array( 1 );
|
|
31
|
+
var UINT32_VIEW = new Uint32Array( FLOAT64_VIEW.buffer );
|
|
32
|
+
|
|
33
|
+
var HIGH = indices.HIGH;
|
|
34
|
+
var LOW = indices.LOW;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// MAIN //
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Splits a double-precision floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer).
|
|
41
|
+
*
|
|
42
|
+
* ## Notes
|
|
43
|
+
*
|
|
44
|
+
* ```text
|
|
45
|
+
* float64 (64 bits)
|
|
46
|
+
* f := fraction (significand/mantissa) (52 bits)
|
|
47
|
+
* e := exponent (11 bits)
|
|
48
|
+
* s := sign bit (1 bit)
|
|
49
|
+
*
|
|
50
|
+
* |-------- -------- -------- -------- -------- -------- -------- --------|
|
|
51
|
+
* | Float64 |
|
|
52
|
+
* |-------- -------- -------- -------- -------- -------- -------- --------|
|
|
53
|
+
* | Uint32 | Uint32 |
|
|
54
|
+
* |-------- -------- -------- -------- -------- -------- -------- --------|
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* If little endian (more significant bits last):
|
|
58
|
+
*
|
|
59
|
+
* ```text
|
|
60
|
+
* <-- lower higher -->
|
|
61
|
+
* | f7 f6 f5 f4 f3 f2 e2 | f1 |s| e1 |
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* If big endian (more significant bits first):
|
|
65
|
+
*
|
|
66
|
+
* ```text
|
|
67
|
+
* <-- higher lower -->
|
|
68
|
+
* |s| e1 e2 | f1 f2 f3 f4 f5 f6 f7 |
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* In which Uint32 can we find the higher order bits? If little endian, the second; if big endian, the first.
|
|
72
|
+
*
|
|
73
|
+
* ## References
|
|
74
|
+
*
|
|
75
|
+
* - [Open Group][1]
|
|
76
|
+
*
|
|
77
|
+
* [1]: http://pubs.opengroup.org/onlinepubs/9629399/chap14.htm
|
|
78
|
+
*
|
|
79
|
+
* @private
|
|
80
|
+
* @param {number} x - input value
|
|
81
|
+
* @param {Collection} out - output array
|
|
82
|
+
* @param {integer} stride - output array stride
|
|
83
|
+
* @param {NonNegativeInteger} offset - output array index offset
|
|
84
|
+
* @returns {Collection} output array
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* var Uint32Array = require( '@stdlib/array/uint32' );
|
|
88
|
+
*
|
|
89
|
+
* var out = new Uint32Array( 2 );
|
|
90
|
+
*
|
|
91
|
+
* var w = toWords( 3.14e201, out, 1, 0 );
|
|
92
|
+
* // returns <Uint32Array>[ 1774486211, 2479577218 ]
|
|
93
|
+
*
|
|
94
|
+
* var bool = ( w === out );
|
|
95
|
+
* // returns true
|
|
96
|
+
*/
|
|
97
|
+
function toWords( x, out, stride, offset ) {
|
|
98
|
+
FLOAT64_VIEW[ 0 ] = x;
|
|
99
|
+
out[ offset ] = UINT32_VIEW[ HIGH ];
|
|
100
|
+
out[ offset + stride ] = UINT32_VIEW[ LOW ];
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
// EXPORTS //
|
|
106
|
+
|
|
107
|
+
module.exports = toWords;
|