@ohos-ports/stdlib-number 0.0.0-stage → 0.4.1-beta.1
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 +68 -4
- 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,374 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
@license Apache-2.0
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2025 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
|
+
# Float16
|
|
22
|
+
|
|
23
|
+
> 16-bit half-precision floating-point number.
|
|
24
|
+
|
|
25
|
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
26
|
+
|
|
27
|
+
<section class="intro">
|
|
28
|
+
|
|
29
|
+
</section>
|
|
30
|
+
|
|
31
|
+
<!-- /.intro -->
|
|
32
|
+
|
|
33
|
+
<!-- Package usage documentation. -->
|
|
34
|
+
|
|
35
|
+
<section class="usage">
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
var Float16 = require( '@stdlib/number/float16/ctor' );
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Float16( value )
|
|
44
|
+
|
|
45
|
+
16-bit half-precision floating-point number constructor.
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
var x = new Float16( 5.0 );
|
|
49
|
+
// returns <Float16>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
* * *
|
|
53
|
+
|
|
54
|
+
## Properties
|
|
55
|
+
|
|
56
|
+
#### Float16.name
|
|
57
|
+
|
|
58
|
+
Static property returning the constructor name.
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
var str = Float16.name;
|
|
62
|
+
// returns 'Float16'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Float16.BYTES_PER_ELEMENT
|
|
66
|
+
|
|
67
|
+
Size (in bytes) of the underlying value.
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
var nbytes = Float16.BYTES_PER_ELEMENT;
|
|
71
|
+
// returns 2
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
#### Float16.prototype.BYTES_PER_ELEMENT
|
|
75
|
+
|
|
76
|
+
Size (in bytes) of the underlying value.
|
|
77
|
+
|
|
78
|
+
```javascript
|
|
79
|
+
var x = new Float16( 5.0 );
|
|
80
|
+
|
|
81
|
+
var nbytes = x.BYTES_PER_ELEMENT;
|
|
82
|
+
// returns 2
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Instance
|
|
86
|
+
|
|
87
|
+
A `Float16` instance has the following properties...
|
|
88
|
+
|
|
89
|
+
#### value
|
|
90
|
+
|
|
91
|
+
A **read-only** property returning the underlying value as a number.
|
|
92
|
+
|
|
93
|
+
```javascript
|
|
94
|
+
var x = new Float16( 5.0 );
|
|
95
|
+
|
|
96
|
+
var v = x.value;
|
|
97
|
+
// returns 5.0
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
* * *
|
|
101
|
+
|
|
102
|
+
## Methods
|
|
103
|
+
|
|
104
|
+
### Accessor Methods
|
|
105
|
+
|
|
106
|
+
These methods do **not** mutate a `Float16` instance and, instead return a half-precision floating-point number representation.
|
|
107
|
+
|
|
108
|
+
#### Float16.prototype.toString()
|
|
109
|
+
|
|
110
|
+
Returns a string representation of a `Float16` instance.
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
var x = new Float16( 5.0 );
|
|
114
|
+
var str = x.toString();
|
|
115
|
+
// returns '5'
|
|
116
|
+
|
|
117
|
+
x = new Float16( -3.14 );
|
|
118
|
+
str = x.toString();
|
|
119
|
+
// returns '-3.140625'
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### Float16.prototype.toJSON()
|
|
123
|
+
|
|
124
|
+
Returns a [JSON][json] representation of a `Float16` instance. [`JSON.stringify()`][mdn-json-stringify] implicitly calls this method when stringifying a `Float16` instance.
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
var x = new Float16( 5.0 );
|
|
128
|
+
|
|
129
|
+
var o = x.toJSON();
|
|
130
|
+
/*
|
|
131
|
+
{
|
|
132
|
+
"type": "Float16",
|
|
133
|
+
"value": 5.0
|
|
134
|
+
}
|
|
135
|
+
*/
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
To [revive][mdn-json-parse] a `Float16` number from a [JSON][json] `string`, see [@stdlib/number/float16/reviver][@stdlib/number/float16/reviver].
|
|
139
|
+
|
|
140
|
+
#### Float16.prototype.valueOf()
|
|
141
|
+
|
|
142
|
+
Converts a `Float16` instance to a primitive value.
|
|
143
|
+
|
|
144
|
+
```javascript
|
|
145
|
+
var x = new Float16( 5.0 );
|
|
146
|
+
var v = x.valueOf();
|
|
147
|
+
// returns 5.0
|
|
148
|
+
|
|
149
|
+
x = new Float16( 3.14 );
|
|
150
|
+
v = x.valueOf();
|
|
151
|
+
// returns 3.140625
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
</section>
|
|
155
|
+
|
|
156
|
+
<!-- /.usage -->
|
|
157
|
+
|
|
158
|
+
* * *
|
|
159
|
+
|
|
160
|
+
<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
161
|
+
|
|
162
|
+
<section class="notes">
|
|
163
|
+
|
|
164
|
+
## Notes
|
|
165
|
+
|
|
166
|
+
- The underlying value is stored as a half-precision floating-point number [IEEE 754][ieee754] with 1 sign bit, 5 exponent bits, and 10 significand bits.
|
|
167
|
+
- A half-precision floating-point number has a range of approximately `±6.55e4` and a precision of about 3-4 decimal digits.
|
|
168
|
+
|
|
169
|
+
</section>
|
|
170
|
+
|
|
171
|
+
<!-- /.notes -->
|
|
172
|
+
|
|
173
|
+
* * *
|
|
174
|
+
|
|
175
|
+
<!-- Package usage examples. -->
|
|
176
|
+
|
|
177
|
+
<section class="examples">
|
|
178
|
+
|
|
179
|
+
## Examples
|
|
180
|
+
|
|
181
|
+
<!-- eslint no-undef: "error" -->
|
|
182
|
+
|
|
183
|
+
```javascript
|
|
184
|
+
var Float16 = require( '@stdlib/number/float16/ctor' );
|
|
185
|
+
|
|
186
|
+
var x = new Float16( 3.14 );
|
|
187
|
+
|
|
188
|
+
console.log( 'type: %s', typeof x );
|
|
189
|
+
// => 'type: object'
|
|
190
|
+
|
|
191
|
+
console.log( 'str: %s', x );
|
|
192
|
+
// => 'str: 3.140625'
|
|
193
|
+
|
|
194
|
+
console.log( 'value: %d', x.value );
|
|
195
|
+
// => 'value: 3.140625'
|
|
196
|
+
|
|
197
|
+
console.log( 'JSON: %s', JSON.stringify( x ) );
|
|
198
|
+
// => 'JSON: {"type":"Float16","value":3.140625}'
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
</section>
|
|
202
|
+
|
|
203
|
+
<!-- /.examples -->
|
|
204
|
+
|
|
205
|
+
<!-- C interface documentation. -->
|
|
206
|
+
|
|
207
|
+
* * *
|
|
208
|
+
|
|
209
|
+
<section class="c">
|
|
210
|
+
|
|
211
|
+
## C APIs
|
|
212
|
+
|
|
213
|
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
214
|
+
|
|
215
|
+
<section class="intro">
|
|
216
|
+
|
|
217
|
+
</section>
|
|
218
|
+
|
|
219
|
+
<!-- /.intro -->
|
|
220
|
+
|
|
221
|
+
<!-- C usage documentation. -->
|
|
222
|
+
|
|
223
|
+
<section class="usage">
|
|
224
|
+
|
|
225
|
+
### Usage
|
|
226
|
+
|
|
227
|
+
```c
|
|
228
|
+
#include "stdlib/number/float16/ctor.h"
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
#### stdlib_float16_t
|
|
232
|
+
|
|
233
|
+
An opaque type definition for a half-precision floating-point number.
|
|
234
|
+
|
|
235
|
+
```c
|
|
236
|
+
stdlib_float16_t v = stdlib_float16_from_bits( 51648 );
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### stdlib_float16_bits_t
|
|
240
|
+
|
|
241
|
+
An opaque type definition for a union for accessing the underlying binary representation of a half-precision floating-point number.
|
|
242
|
+
|
|
243
|
+
```c
|
|
244
|
+
#include <stdint.h>
|
|
245
|
+
|
|
246
|
+
stdlib_float16_t x = stdlib_float16_from_bits( 51648 );
|
|
247
|
+
|
|
248
|
+
stdlib_float16_bits_t y;
|
|
249
|
+
y.value = x;
|
|
250
|
+
|
|
251
|
+
uint16_t bits = y.bits;
|
|
252
|
+
// returns 51648
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
The union has the following members:
|
|
256
|
+
|
|
257
|
+
- **value**: `stdlib_float16_t` half-precision floating-point number.
|
|
258
|
+
- **bits**: `uint16_t` binary representation.
|
|
259
|
+
|
|
260
|
+
The union allows "type punning"; however, while (more or less) defined in C99, behavior is implementation-defined in C++. For more robust conversion, prefer using explicit helpers for converting to and from binary representation.
|
|
261
|
+
|
|
262
|
+
#### stdlib_float16_from_bits( bits )
|
|
263
|
+
|
|
264
|
+
Converts a 16-bit binary representation to a half-precision floating-point number.
|
|
265
|
+
|
|
266
|
+
```c
|
|
267
|
+
stdlib_float16_t v = stdlib_float16_from_bits( 51648 ); // => -11.5
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
The function accepts the following arguments:
|
|
271
|
+
|
|
272
|
+
- **bits**: `[in] uint16_t` 16-bit integer corresponding to a binary representation.
|
|
273
|
+
|
|
274
|
+
#### stdlib_float16_to_bits( x )
|
|
275
|
+
|
|
276
|
+
Converts a half-precision floating-point number to a 16-bit binary representation.
|
|
277
|
+
|
|
278
|
+
```c
|
|
279
|
+
#include <stdint.h>
|
|
280
|
+
|
|
281
|
+
stdlib_float16_t v = stdlib_float16_from_bits( 51648 ); // => -11.5
|
|
282
|
+
|
|
283
|
+
uint16_t bits = stdlib_float16_to_bits( v );
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
The function accepts the following arguments:
|
|
287
|
+
|
|
288
|
+
- **x**: `[in] stdlib_float16_t` half-precision floating-point number.
|
|
289
|
+
|
|
290
|
+
</section>
|
|
291
|
+
|
|
292
|
+
<!-- /.usage -->
|
|
293
|
+
|
|
294
|
+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
295
|
+
|
|
296
|
+
<section class="notes">
|
|
297
|
+
|
|
298
|
+
### Notes
|
|
299
|
+
|
|
300
|
+
- The `stdlib_float16_t` type should be treated as a storage and interchange type. Native hardware support for mathematical functions operating on half-precision floating-point numbers varies. As a consequence, for most operations, one should first promote to single-precision (i.e., `float`), perform the desired operation, and then downcast back to half-precision.
|
|
301
|
+
|
|
302
|
+
</section>
|
|
303
|
+
|
|
304
|
+
<!-- /.notes -->
|
|
305
|
+
|
|
306
|
+
<!-- C API usage examples. -->
|
|
307
|
+
|
|
308
|
+
<section class="examples">
|
|
309
|
+
|
|
310
|
+
### Examples
|
|
311
|
+
|
|
312
|
+
```c
|
|
313
|
+
#include "stdlib/number/float16/ctor.h"
|
|
314
|
+
#include <stdint.h>
|
|
315
|
+
#include <stdio.h>
|
|
316
|
+
|
|
317
|
+
int main( void ) {
|
|
318
|
+
const stdlib_float16_t x[] = {
|
|
319
|
+
stdlib_float16_from_bits( 51648 ), // -11.5
|
|
320
|
+
stdlib_float16_from_bits( 18880 ) // 11.5
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
int i;
|
|
324
|
+
for ( i = 0; i < 2; i++ ) {
|
|
325
|
+
printf( "%d\n", stdlib_float16_to_bits( x[ i ] ) );
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
</section>
|
|
331
|
+
|
|
332
|
+
<!-- /.examples -->
|
|
333
|
+
|
|
334
|
+
</section>
|
|
335
|
+
|
|
336
|
+
<!-- /.c -->
|
|
337
|
+
|
|
338
|
+
<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
339
|
+
|
|
340
|
+
<section class="references">
|
|
341
|
+
|
|
342
|
+
</section>
|
|
343
|
+
|
|
344
|
+
<!-- /.references -->
|
|
345
|
+
|
|
346
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
347
|
+
|
|
348
|
+
<section class="related">
|
|
349
|
+
|
|
350
|
+
</section>
|
|
351
|
+
|
|
352
|
+
<!-- /.related -->
|
|
353
|
+
|
|
354
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
355
|
+
|
|
356
|
+
<section class="links">
|
|
357
|
+
|
|
358
|
+
[ieee754]: https://en.wikipedia.org/wiki/IEEE_754-1985
|
|
359
|
+
|
|
360
|
+
[json]: http://www.json.org/
|
|
361
|
+
|
|
362
|
+
[mdn-json-stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
|
|
363
|
+
|
|
364
|
+
[mdn-json-parse]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
|
|
365
|
+
|
|
366
|
+
[@stdlib/number/float16/reviver]: https://github.com/stdlib-js/number/tree/main/float16/reviver
|
|
367
|
+
|
|
368
|
+
<!-- <related-links> -->
|
|
369
|
+
|
|
370
|
+
<!-- </related-links> -->
|
|
371
|
+
|
|
372
|
+
</section>
|
|
373
|
+
|
|
374
|
+
<!-- /.links -->
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
{{alias}}( value )
|
|
3
|
+
16-bit half-precision floating-point number constructor.
|
|
4
|
+
|
|
5
|
+
Parameters
|
|
6
|
+
----------
|
|
7
|
+
value: number
|
|
8
|
+
Numeric value.
|
|
9
|
+
|
|
10
|
+
Returns
|
|
11
|
+
-------
|
|
12
|
+
v: Float16
|
|
13
|
+
Half-precision floating-point number.
|
|
14
|
+
|
|
15
|
+
v.value: number
|
|
16
|
+
Read-only property returning the underlying value.
|
|
17
|
+
|
|
18
|
+
Examples
|
|
19
|
+
--------
|
|
20
|
+
> var x = new {{alias}}( 3.14 )
|
|
21
|
+
<Float16>
|
|
22
|
+
> x.value
|
|
23
|
+
3.140625
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
{{alias}}.name
|
|
27
|
+
Constructor name.
|
|
28
|
+
|
|
29
|
+
Examples
|
|
30
|
+
--------
|
|
31
|
+
> var str = {{alias}}.name
|
|
32
|
+
'Float16'
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
{{alias}}.BYTES_PER_ELEMENT
|
|
36
|
+
Size (in bytes) of the underlying value.
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
s: integer
|
|
41
|
+
Size (in bytes) of the underlying value.
|
|
42
|
+
|
|
43
|
+
Examples
|
|
44
|
+
--------
|
|
45
|
+
> var s = {{alias}}.BYTES_PER_ELEMENT
|
|
46
|
+
2
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
{{alias}}.prototype.BYTES_PER_ELEMENT
|
|
50
|
+
Size (in bytes) of the underlying value.
|
|
51
|
+
|
|
52
|
+
Returns
|
|
53
|
+
-------
|
|
54
|
+
s: integer
|
|
55
|
+
Size (in bytes) of the underlying value.
|
|
56
|
+
|
|
57
|
+
Examples
|
|
58
|
+
--------
|
|
59
|
+
> var x = new {{alias}}( 5.0 )
|
|
60
|
+
<Float16>
|
|
61
|
+
> var s = x.BYTES_PER_ELEMENT
|
|
62
|
+
2
|
|
63
|
+
|
|
64
|
+
See Also
|
|
65
|
+
--------
|
|
66
|
+
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 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
|
+
/**
|
|
22
|
+
* 16-bit half-precision floating-point number.
|
|
23
|
+
*/
|
|
24
|
+
declare class Float16 {
|
|
25
|
+
/**
|
|
26
|
+
* 16-bit half-precision floating-point number constructor.
|
|
27
|
+
*
|
|
28
|
+
* @param value - numeric value
|
|
29
|
+
* @returns half-precision floating-point number
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* var x = new Float16( 5.0 );
|
|
33
|
+
* // returns <Float16>
|
|
34
|
+
*/
|
|
35
|
+
constructor( value: number );
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Read-only property returning the value.
|
|
39
|
+
*
|
|
40
|
+
* @returns value
|
|
41
|
+
*/
|
|
42
|
+
readonly value: number;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Size (in bytes) of the underlying value.
|
|
46
|
+
*
|
|
47
|
+
* @returns size of the underlying value.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* var nbytes = Float16.BYTES_PER_ELEMENT;
|
|
51
|
+
* // returns 2
|
|
52
|
+
*/
|
|
53
|
+
readonly BYTES_PER_ELEMENT: 2;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Serializes a half-precision floating-point number as a string.
|
|
57
|
+
*
|
|
58
|
+
* @returns serialized half-precision floating-point number
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* var x = new Float16( 5.0 );
|
|
62
|
+
*
|
|
63
|
+
* var str = x.toString();
|
|
64
|
+
* // returns '5'
|
|
65
|
+
*/
|
|
66
|
+
toString(): string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Serializes a half-precision floating-point number as a JSON object.
|
|
70
|
+
*
|
|
71
|
+
* ## Notes
|
|
72
|
+
*
|
|
73
|
+
* - `JSON.stringify()` implicitly calls this method when stringifying a `Float16` instance.
|
|
74
|
+
*
|
|
75
|
+
*
|
|
76
|
+
* @returns serialized half-precision floating-point number
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* var x = new Float16( 5.0 );
|
|
80
|
+
*
|
|
81
|
+
* var obj = x.toJSON();
|
|
82
|
+
* // returns { 'type': 'Float16', 'value': 5.0 }
|
|
83
|
+
*/
|
|
84
|
+
toJSON(): any;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Converts a half-precision floating-point number to a primitive value.
|
|
88
|
+
*
|
|
89
|
+
* @returns primitive value
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* var x = new Float16( 5.0 );
|
|
93
|
+
*
|
|
94
|
+
* var v = x.valueOf();
|
|
95
|
+
* // returns 5.0
|
|
96
|
+
*/
|
|
97
|
+
valueOf(): number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
// EXPORTS //
|
|
102
|
+
|
|
103
|
+
export = Float16;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 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
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
20
|
+
|
|
21
|
+
import Float16 = require( './index' );
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
// TESTS //
|
|
25
|
+
|
|
26
|
+
// The function returns a 16-bit half-precision floating-point number with the expected properties...
|
|
27
|
+
{
|
|
28
|
+
const x = new Float16( 5.0 ); // $ExpectType Float16
|
|
29
|
+
|
|
30
|
+
x.value; // $ExpectType number
|
|
31
|
+
x.BYTES_PER_ELEMENT; // $ExpectType 2
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 16-bit half-precision floating-point number comes with a `toString` method to serialize a number as a string...
|
|
35
|
+
{
|
|
36
|
+
const x = new Float16( 5.0 ); // $ExpectType Float16
|
|
37
|
+
|
|
38
|
+
x.toString(); // $ExpectType string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 16-bit half-precision floating-point number comes with a `toJSON` method to serialize a number as a JSON object....
|
|
42
|
+
{
|
|
43
|
+
const x = new Float16( 5.0 ); // $ExpectType Float16
|
|
44
|
+
|
|
45
|
+
x.toJSON(); // $ExpectType any
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 16-bit half-precision floating-point number comes with a `valueOf` method to serialize a number to a primitive value...
|
|
49
|
+
{
|
|
50
|
+
const x = new Float16( 5.0 ); // $ExpectType Float16
|
|
51
|
+
|
|
52
|
+
x.valueOf(); // $ExpectType number
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// The compiler throws an error if the constructor is invoked without the `new` keyword...
|
|
56
|
+
{
|
|
57
|
+
Float16( 5.0 ); // $ExpectError
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// The compiler throws an error if the constructor is provided an unsupported number of arguments...
|
|
61
|
+
{
|
|
62
|
+
new Float16( ); // $ExpectError
|
|
63
|
+
new Float16( 5.0, 3.0 ); // $ExpectError
|
|
64
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2025 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_FLOAT16_CTOR_H
|
|
20
|
+
#define STDLIB_NUMBER_FLOAT16_CTOR_H
|
|
21
|
+
|
|
22
|
+
#include <stdint.h>
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
26
|
+
*/
|
|
27
|
+
#ifdef __cplusplus
|
|
28
|
+
extern "C" {
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Check for native Float16 support...
|
|
32
|
+
|
|
33
|
+
// First check the language standard first, as `_Float16` was standardized in C23...
|
|
34
|
+
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* An opaque type definition for a half-precision floating-point number.
|
|
38
|
+
*/
|
|
39
|
+
typedef _Float16 stdlib_float16_t;
|
|
40
|
+
|
|
41
|
+
// If the previous check failed, check for the GCC/Clang `_Float16` extension...
|
|
42
|
+
#elif defined(__FLT16_MANT_DIG__)
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* An opaque type definition for a half-precision floating-point number.
|
|
46
|
+
*/
|
|
47
|
+
typedef _Float16 stdlib_float16_t;
|
|
48
|
+
|
|
49
|
+
// If the previous check failed, check for Clang support...
|
|
50
|
+
#elif defined(__clang__) && (defined(__has_extension) || defined(__has_feature)) && (__has_extension(c_float16) || __has_feature(c_float16))
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* An opaque type definition for a half-precision floating-point number.
|
|
54
|
+
*/
|
|
55
|
+
typedef _Float16 stdlib_float16_t;
|
|
56
|
+
|
|
57
|
+
// Otherwise, if we aren't going to use the native half-precision floating-point number type, we need to define a half-precision floating-point number as an "opaque" struct (here, "opaque" means type consumers should **not** be operating with the value directly, but only through dedicated functions) for storing the number value...
|
|
58
|
+
#else
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* An opaque type definition for a half-precision floating-point number.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* #include "stdlib/number/float32/base/to_float16.h"
|
|
65
|
+
* #include "stdlib/number/float16/base/to_float32.h"
|
|
66
|
+
*
|
|
67
|
+
* stdlib_float16_t x = stdlib_float16_from_float32( 3.14f );
|
|
68
|
+
*
|
|
69
|
+
* float y = stdlib_float16_to_float32( x );
|
|
70
|
+
* // returns 3.140625f
|
|
71
|
+
*/
|
|
72
|
+
typedef struct {
|
|
73
|
+
/**
|
|
74
|
+
* Raw IEEE 754 binary representation.
|
|
75
|
+
*/
|
|
76
|
+
uint16_t bits;
|
|
77
|
+
} stdlib_float16_t;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* An opaque type definition for a union for accessing the underlying binary representation of a half-precision floating-point number.
|
|
81
|
+
*
|
|
82
|
+
* ## Notes
|
|
83
|
+
*
|
|
84
|
+
* - The union allows "type punning"; however, while (more or less) defined in C99, behavior is implementation-defined in C++. For more robust conversion, prefer using explicit helpers for converting to and from binary representation.
|
|
85
|
+
*/
|
|
86
|
+
typedef union {
|
|
87
|
+
// An opaque type for the output value (e.g., could be a `struct` or a native half-precision floating-point number):
|
|
88
|
+
stdlib_float16_t value;
|
|
89
|
+
|
|
90
|
+
// Raw IEEE 754 binary representation.
|
|
91
|
+
uint16_t bits;
|
|
92
|
+
} stdlib_float16_bits_t;
|
|
93
|
+
|
|
94
|
+
#endif
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Converts a half-precision floating-point number to its binary representation.
|
|
98
|
+
*/
|
|
99
|
+
uint16_t stdlib_float16_to_bits( stdlib_float16_t x );
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Converts a 16-bit binary representation to a half-precision floating-point number.
|
|
103
|
+
*/
|
|
104
|
+
stdlib_float16_t stdlib_float16_from_bits( uint16_t bits );
|
|
105
|
+
|
|
106
|
+
#ifdef __cplusplus
|
|
107
|
+
}
|
|
108
|
+
#endif
|
|
109
|
+
|
|
110
|
+
#endif // !STDLIB_NUMBER_FLOAT16_CTOR_H
|