{"_id":"@afegmdg/wasm-math","_rev":"6-76b9b5d5fd3e8837bececae8f18cc129","name":"@afegmdg/wasm-math","dist-tags":{"latest":"0.1.5-beta"},"versions":{"0.1.0-beta":{"name":"@afegmdg/wasm-math","version":"0.1.0-beta","author":{"name":"Andreas Friedel","email":"opensource@afe-gmdg.de"},"license":"MIT","_id":"@afegmdg/wasm-math@0.1.0-beta","maintainers":[{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"}],"dist":{"shasum":"6bb4301b2dd4948f31dbf1abb81aa410ca1ce11d","tarball":"https://registry.npmjs.org/@afegmdg/wasm-math/-/wasm-math-0.1.0-beta.tgz","fileCount":11,"integrity":"sha512-Z6S7l0Z0h8m/G5phHT9Y/7hxgGB2VtJt+udMI7l0fld5kiFBehNqW5dJGDWjjPGmth06sFbexnSWoh5WfroVnQ==","signatures":[{"sig":"MEQCIFlzC3QVN9ljd1JX6+X2QNWh+zcKQpALae4UwnJNGSskAiB6wZpbwCoQ/y/OOlzSTvUJEB9aeU0S57cyHYYTrVQrTA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":33885},"type":"module","types":"./dist/wasm-math.d.ts","module":"./dist/wasm-math.js","scripts":{"rr":"rimraf dist node_modules yarn.lock","lint":"eslint","test":"vitest --run","build":"rollup -c","pretest":"yarn build","prebuild":"rimraf dist","buildwasm":"wat2wasm src/wat/math.wat -o src/wasm/math.wasm"},"_npmUser":{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"},"repository":{"url":"https://github.com/AFE-GmdG/wasm-math.git","type":"git"},"description":"WebAssembly Math Library","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2025 AFE-GmdG\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"2.8.1","eslint":"9.22.0","rimraf":"6.0.1","rollup":"4.35.0","vitest":"3.0.8","typescript":"5.8.2","@types/node":"22.13.10","@rollup/plugin-wasm":"6.2.2","eslint-plugin-import":"2.31.0","@rollup/plugin-terser":"0.4.4","@typescript-eslint/parser":"8.26.1","rollup-plugin-typescript2":"0.36.0","@stylistic/eslint-plugin-ts":"4.2.0","@typescript-eslint/eslint-plugin":"8.26.1"},"_npmOperationalInternal":{"tmp":"tmp/wasm-math_0.1.0-beta_1741983794078_0.8955945702163102","host":"s3://npm-registry-packages-npm-production"}},"0.1.1-beta":{"name":"@afegmdg/wasm-math","version":"0.1.1-beta","author":{"name":"Andreas Friedel","email":"opensource@afe-gmdg.de"},"license":"MIT","_id":"@afegmdg/wasm-math@0.1.1-beta","maintainers":[{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"}],"dist":{"shasum":"4e470f7701f4cf9ab1373f3ba48560ac42d6ad94","tarball":"https://registry.npmjs.org/@afegmdg/wasm-math/-/wasm-math-0.1.1-beta.tgz","fileCount":11,"integrity":"sha512-CMpddOwCfR9xkbc8/KZQQSOMSsuYpsNNJ4xnS3C45DUh4MCT8hHyaIRZvxlhbO7W2UhtmQVKZoZ2YmF3rf/7XA==","signatures":[{"sig":"MEYCIQC5JmnCmSRKBbUE1tN2mWCCFhwUxObZsjqB4jtBx0R/HQIhAImXttX5wfnlwlLjTwdJmplvnZFdhjjmIeM4UNBQb5Vw","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":44485},"type":"module","types":"./dist/wasm-math.d.ts","module":"./dist/wasm-math.js","scripts":{"rr":"rimraf dist node_modules yarn.lock","lint":"eslint","test":"vitest --run","build":"rollup -c","pretest":"yarn build","prebuild":"rimraf dist","buildwasm":"wat2wasm src/wat/math.wat -o src/wasm/math.wasm"},"_npmUser":{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"},"repository":{"url":"https://github.com/AFE-GmdG/wasm-math.git","type":"git"},"description":"WebAssembly Math Library","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2025 AFE-GmdG\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"2.8.1","eslint":"9.22.0","rimraf":"6.0.1","rollup":"4.35.0","vitest":"3.0.8","typescript":"5.8.2","@types/node":"22.13.10","@rollup/plugin-wasm":"6.2.2","eslint-plugin-import":"2.31.0","@rollup/plugin-terser":"0.4.4","@typescript-eslint/parser":"8.26.1","rollup-plugin-typescript2":"0.36.0","@stylistic/eslint-plugin-ts":"4.2.0","@typescript-eslint/eslint-plugin":"8.26.1"},"_npmOperationalInternal":{"tmp":"tmp/wasm-math_0.1.1-beta_1742196131693_0.7884320879941822","host":"s3://npm-registry-packages-npm-production"}},"0.1.2-beta":{"name":"@afegmdg/wasm-math","version":"0.1.2-beta","author":{"name":"Andreas Friedel","email":"opensource@afe-gmdg.de"},"license":"MIT","_id":"@afegmdg/wasm-math@0.1.2-beta","maintainers":[{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"}],"dist":{"shasum":"0f44f1157161f5dc9ef91d33a41629315f962c62","tarball":"https://registry.npmjs.org/@afegmdg/wasm-math/-/wasm-math-0.1.2-beta.tgz","fileCount":12,"integrity":"sha512-SCHckF7JR5kgJM75PTLdb8Hx6vv28WNfT5lXD2FMjXuoASC5IXMh3L5ssDrAjxlYjvxNl8MNYrFrm8OOWneOtQ==","signatures":[{"sig":"MEUCIAIG7z6FJU1+uScVNT2OUiGYLCq5HiR8tCCSxm07PcR8AiEAgdiUXfPMT9wMfS/nMKd9PjIXXUHsIq3IFotHu7o6f1w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":51521},"type":"module","types":"./dist/wasm-math.d.ts","module":"./dist/wasm-math.js","scripts":{"rr":"rimraf dist node_modules yarn.lock","lint":"eslint","test":"vitest --run","build":"rollup -c","pretest":"yarn build","prebuild":"rimraf dist","buildwasm":"wat2wasm src/wat/math.wat -o src/wasm/math.wasm"},"_npmUser":{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"},"repository":{"url":"https://github.com/AFE-GmdG/wasm-math.git","type":"git"},"description":"WebAssembly Math Library","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2025 AFE-GmdG\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tslib":"2.8.1","eslint":"9.22.0","rimraf":"6.0.1","rollup":"4.35.0","vitest":"3.0.8","typescript":"5.8.2","@types/node":"22.13.10","@rollup/plugin-wasm":"6.2.2","eslint-plugin-import":"2.31.0","@rollup/plugin-terser":"0.4.4","@typescript-eslint/parser":"8.26.1","rollup-plugin-typescript2":"0.36.0","@stylistic/eslint-plugin-ts":"4.2.0","@typescript-eslint/eslint-plugin":"8.26.1"},"_npmOperationalInternal":{"tmp":"tmp/wasm-math_0.1.2-beta_1742317490269_0.3793106556625119","host":"s3://npm-registry-packages-npm-production"}},"0.1.3-beta":{"name":"@afegmdg/wasm-math","version":"0.1.3-beta","author":{"name":"Andreas Friedel","email":"opensource@afe-gmdg.de"},"license":"MIT","_id":"@afegmdg/wasm-math@0.1.3-beta","maintainers":[{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"}],"dist":{"shasum":"a7d9b4eeaca1483423a747e8046d1100b59b4156","tarball":"https://registry.npmjs.org/@afegmdg/wasm-math/-/wasm-math-0.1.3-beta.tgz","fileCount":4,"integrity":"sha512-QOAuUQz5mLPu68hU1Kc0v+k3OzxXsTspndbehAe3UOypzjRI0szOGzsQI25b0zsgVxXS71caSOfoywf3oQ+Gqw==","signatures":[{"sig":"MEUCIQDP/ezw6UsyNg1Nl6InpE605yBf9Ekpo83Zjgqqx61r0AIgLRTVSFbD7emDwvCUVkoImQdrotna+cjafiAxXYBXZCU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13923},"type":"module","types":"./dist/wasm-math.d.ts","module":"./dist/wasm-math.js","scripts":{"rr":"rimraf dist node_modules yarn.lock","lint":"eslint src test","test":"vitest --run","build":"rollup -c","pretest":"yarn build","prebuild":"rimraf dist","buildwasm":"wat2wasm src/wat/math.wat -o src/wasm/math.wasm"},"_npmUser":{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"},"repository":{"url":"https://github.com/AFE-GmdG/wasm-math.git","type":"git"},"description":"WebAssembly Math Library","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2025 AFE-GmdG\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"6.2.6","eslint":"9.24.0","rimraf":"6.0.1","rollup":"4.39.0","vitest":"3.1.1","typescript":"5.8.3","@types/node":"22.14.1","@rollup/plugin-wasm":"6.2.2","eslint-plugin-import":"2.31.0","@rollup/plugin-terser":"0.4.4","@typescript-eslint/parser":"8.29.1","rollup-plugin-typescript2":"0.36.0","@stylistic/eslint-plugin-ts":"4.2.0","@typescript-eslint/eslint-plugin":"8.29.1"},"_npmOperationalInternal":{"tmp":"tmp/wasm-math_0.1.3-beta_1744447744289_0.8528030511104543","host":"s3://npm-registry-packages-npm-production"}},"0.1.4-beta":{"name":"@afegmdg/wasm-math","version":"0.1.4-beta","author":{"name":"Andreas Friedel","email":"opensource@afe-gmdg.de"},"license":"MIT","_id":"@afegmdg/wasm-math@0.1.4-beta","maintainers":[{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"}],"dist":{"shasum":"1dab851f2aadb80d770bf515f0b10e54d1313650","tarball":"https://registry.npmjs.org/@afegmdg/wasm-math/-/wasm-math-0.1.4-beta.tgz","fileCount":13,"integrity":"sha512-yZlACWldP7nM04+Vnxu1VSgsVJCw/SkmB8ZLwKgq5DVMU0H7On3UAi0UDtudA6i9tw8M63OGqYD6BYP7l9BM5w==","signatures":[{"sig":"MEUCIQDiQXV/oETaddAaJ9Ao2aTwFT7AtT+GhdOPz/bQFHQO6QIgOmQMDfU6IH6dJUsiS3XnyNn4r0mDUqNNWe/W4WrEbjs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":132743},"type":"module","types":"./dist/wasm-math.d.ts","module":"./dist/wasm-math.js","scripts":{"rr":"rimraf dist node_modules yarn.lock","lint":"eslint src test","test":"vitest --run","build":"rollup -c","pretest":"yarn build","prebuild":"rimraf dist","buildwasm":"wat2wasm src/wat/math.wat -o src/wasm/math.wasm"},"_npmUser":{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"},"repository":{"url":"https://github.com/AFE-GmdG/wasm-math.git","type":"git"},"description":"WebAssembly Math Library","directories":{},"licenseText":"MIT License\n\nCopyright (c) 2025 AFE-GmdG\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"6.2.6","eslint":"9.24.0","rimraf":"6.0.1","rollup":"4.39.0","vitest":"3.1.1","typescript":"5.8.3","@types/node":"22.14.1","@rollup/plugin-wasm":"6.2.2","eslint-plugin-import":"2.31.0","@rollup/plugin-terser":"0.4.4","@typescript-eslint/parser":"8.29.1","rollup-plugin-typescript2":"0.36.0","@stylistic/eslint-plugin-ts":"4.2.0","@typescript-eslint/eslint-plugin":"8.29.1"},"_npmOperationalInternal":{"tmp":"tmp/wasm-math_0.1.4-beta_1744615519436_0.934979939027571","host":"s3://npm-registry-packages-npm-production"}},"0.1.5-beta":{"name":"@afegmdg/wasm-math","version":"0.1.5-beta","description":"WebAssembly Math Library","type":"module","module":"./dist/wasm-math.js","types":"./dist/wasm-math.d.ts","license":"MIT","author":{"name":"Andreas Friedel","email":"opensource@afe-gmdg.de"},"repository":{"type":"git","url":"https://github.com/AFE-GmdG/wasm-math.git"},"publishConfig":{"access":"public"},"scripts":{"prebuild":"rimraf dist","build":"rollup -c","buildwasm":"wat2wasm src/wat/math.wat -o src/wasm/math.wasm","pretest":"yarn build","test":"vitest --run","lint":"eslint src test","rr":"rimraf dist node_modules yarn.lock"},"dependencies":{},"devDependencies":{"@rollup/plugin-terser":"0.4.4","@rollup/plugin-wasm":"6.2.2","@stylistic/eslint-plugin-ts":"4.2.0","@types/node":"22.14.1","@typescript-eslint/eslint-plugin":"8.29.1","@typescript-eslint/parser":"8.29.1","eslint":"9.24.0","eslint-plugin-import":"2.31.0","rimraf":"6.0.1","rollup":"4.39.0","rollup-plugin-typescript2":"0.36.0","typescript":"5.8.3","vite":"6.2.6","vitest":"3.1.1"},"licenseText":"MIT License\n\nCopyright (c) 2025 AFE-GmdG\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"@afegmdg/wasm-math@0.1.5-beta","dist":{"shasum":"a0e6d5e742b850b172f903618217ae196f76821f","integrity":"sha512-q51Lnf6WFRpRZqv0bVyA5cvYdsfkEQAUCOUeKTod9tAx7Nn3mymYAJ39/JYj56wJx35HJ0JOtHt86xYuDiNVQg==","tarball":"https://registry.npmjs.org/@afegmdg/wasm-math/-/wasm-math-0.1.5-beta.tgz","fileCount":13,"unpackedSize":137854,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGU3G3BpMafjt/VqynH0KnGrFTCy7T73DwYh6z1rJUiMAiAsqjFKHFzbbaYyCbQjRSsq76p08xmEpSe4GThZYFuX7g=="}]},"_npmUser":{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"},"directories":{},"maintainers":[{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wasm-math_0.1.5-beta_1744705977016_0.4064255852024712"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-14T20:23:13.972Z","modified":"2025-04-15T08:32:57.413Z","0.1.0-beta":"2025-03-14T20:23:14.260Z","0.1.1-beta":"2025-03-17T07:22:12.009Z","0.1.2-beta":"2025-03-18T17:04:50.479Z","0.1.3-beta":"2025-04-12T08:49:04.467Z","0.1.4-beta":"2025-04-14T07:25:19.613Z","0.1.5-beta":"2025-04-15T08:32:57.228Z"},"author":{"name":"Andreas Friedel","email":"opensource@afe-gmdg.de"},"license":"MIT","repository":{"type":"git","url":"https://github.com/AFE-GmdG/wasm-math.git"},"description":"WebAssembly Math Library","maintainers":[{"name":"afe-gmdg","email":"afe-gmdg@gmx.de"}],"readme":"[![Node.js CI](https://github.com/AFE-GmdG/wasm-math/workflows/Node.js%20CI/badge.svg)](https://github.com/AFE-GmdG/wasm-math/actions?query=workflow:\"Node.js+CI\")\n[![GitHub tag](https://img.shields.io/github/tag/AFE-GmdG/wasm-math?include_prereleases=&sort=semver&color=blue)](https://github.com/AFE-GmdG/wasm-math/releases/)\n[![License](https://img.shields.io/badge/License-MIT-blue)](#license)\n\n# wasm-math - WebAssembly Math Library\n\n`wasm-math` is a powerful library for vector, quaternion, and matrix operations, developed with TypeScript and handwritten WebAssembly (\\*.wat). It is specifically optimized for WebGPU-based games and web applications, utilizing the [SIMD (Single Instruction, Multiple Data)](https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md) instruction extension of WebAssembly for maximum performance. It's tested against the latest Chrome and Firefox versions.\n\n## Features\n- **Vector Operations**:\n  - addition and subtraction (WASM & TS)\n  - cross and dot product (WASM & TS)\n  - squared and normal vector length (WASM & TS)\n  - normalization (WASM & TS)\n  - scale (WASM & TS)\n  - angle between two vectors (WASM & TS)\n  - pretty print\n- **Quaternion Operations**: *TODO*\n  - pretty print\n- **Matrix Operations**: *TODO*\n  - createTranslation (TS only, wasm would be slower)\n  - createRotationX, Y and Z (TS only, wasm would be slower)\n  - createRotation (Quaternion) (WASM & TS, wasm is slightly slower becaue of imporing `Math.acos` from JavaScript)\n  - *TODO*: createFromEuler with EulerOrder and a useful default\n  - *TODO*: createScale\n  - createInverse (WASM & TS) (WASM is 1.55 times faster, needs more optimization)\n  - *TODO*: createOrthographic\n  - *TODO*: createPerspective\n  - *TODO*: createLookAt\n  - multiply (WASM & TS) (WASM is 4.22 times faster)\n  - multiplyVector (WASM & TS) (WASM is 2.25 times faster)\n  - pretty print\n- **SIMD WebAssembly**: Handwritten SIMD operations ensure maximum performance. The assembly code is kept to an absolute minimum to optimize execution speed. Comparisons with `Emscripten` and `C` code showed significantly longer code, more frequent read and write accesses, and thus lower performance.\n- **TypeScript**: The library is developed with TypeScript, providing a clean and easy-to-use API as well as type safety.\n\n## Intended target platforms\n- **WebGPU**: The library is specifically designed for use with WebGPU-based applications and games.\n- **Chrome and Firefox**: The library is tested against Chrome version 134 and Firefox version 136.\n\n## Installation\n**npm**\n```bash\nnpm install wasm-math\n```\n**yarn**\n```bash\nyarn add wasm-math\n```\n\n## Build from source\n### Dependencies\n- Node ^22.5.1\n- Rollup\n- TypeScript ^5.8.2\n\n### Additional dependency\nTo build the **wasm** from the **wat** file, you need the `wat2wasm` tool.\n- [WABT: The WebAssembly Binary Toolkit](https://github.com/WebAssembly/wabt) ^1.0.36 (external tool, contains `wat2wasm`)\n\n## Usage\n**TypeScript example**\n```typescript\nimport { Vector3 } from 'wasm-math';\n\nfunction main() {\n    // Create two vectors with initial values\n    using v1 = new Vector3(1, 2, 3);\n    using v2 = new Vector3(4, 5, 6);\n\n    // Create an additional vector for temporary storage\n    // This is a hint. For more information, see\n    // `Memory management insights and challenges` below.\n    using result = new Vector3(); // temporary\n\n    // Calculate the cross product of v1 and v2\n    Vector3.cross(v1, v2, result);\n\n    // Print the result\n    console.log(result.print(3)); // Output: [3.000, -6.000, 3.000]\n\n    // Get internal Vector3 statistics\n    // There should be 3 Vector instances in total,\n    // 2 long time and 1 for temporary purposes.\n    console.log(Vector3.getStatistics());\n}\n\nmain();\n\n// Get internal Vector3 statistics\n// This time, there should be no Vector instances left.\nconsole.log(Vector3.getStatistics());\n```\n\n## Performance comparison example\nTo maximize speed, the library stores vector, quaternion, and matrix data directly in WebAssembly memory. This ensures that operations on these data in WebAssembly are extremely fast.\n\n### Comparable TypeScript implementation of a cross product:\n```ts\nfunction cross_ts([x1, y1, z1]: number[], [x2, y2, z2]: number[]): number[] {\n    return [\n        y1 * z2 - z1 * y2,\n        z1 * x2 - x1 * z2,\n        x1 * y2 - y1 * x2\n    ];\n}\n```\n### Used WebAssembly code in this library:\n```\n  (func $vCross (export \"vCross\") (type $offsetX3) (param $offsetA i32) (param $offsetB i32) (param $offsetResult i32)\n    (local $vecA v128)\n    (local $vecB v128)\n\n    local.get $offsetResult  ;; S offsetResult\n\n    ;; Calculate (y1, z1, x1, 0) * (z2, x2, y2, 0) - (z1, x1, y1, 0) * (y2, z2, x2, 0)\n\n    ;; Load vecA from memory offsetA\n    local.get $offsetA       ;; S offsetResult, offsetA\n    v128.load                ;; S offsetResult, A\n    ;; Store vecA and let it on the stack\n    local.tee $vecA          ;; S offsetResult, A\n\n    ;; Swizzle A on Stack to (y1, z1, x1, _w1)\n    v128.const i32x4 0x07060504 0x0b0a0908 0x03020100 0x0f0e0d0c ;; S offsetResult, A, swizzle params\n    i8x16.swizzle            ;; S offsetResult, A (swizzled)\n\n    ;; Load vecB from memory offsetB\n    local.get $offsetB       ;; S offsetResult, A (swizzled), offsetB\n    v128.load                ;; S offsetResult, A (swizzled), B\n    ;; Store vecB and let it on the stack\n    local.tee $vecB          ;; S offsetResult, A (swizzled), B\n\n    ;; Swizzle B on Stack to (z2, x2, y2, _w2)\n    v128.const i32x4 0x0b0a0908 0x03020100 0x07060504 0x0f0e0d0c ;; S offsetResult, A (swizzled), B, swizzle params\n    i8x16.swizzle            ;; S offsetResult, A (swizzled), B (swizzled)\n\n    ;; Calculate (y1 * z2, z1 * x2, x1 * y2, 0)\n    f32x4.mul                ;; S offsetResult, (first multiply part)\n\n    ;; Load vecA from stack\n    local.get $vecA          ;; S offsetResult, (first multiply part), A\n    ;; Swizzle A on Stack to (z1, x1, y1, _w1)\n    v128.const i32x4 0x0b0a0908 0x03020100 0x07060504 0x0f0e0d0c ;; S offsetResult, (first multiply part), A, swizzle params\n    i8x16.swizzle            ;; S offsetResult, (first multiply part), A (swizzled)\n\n    ;; Load vecB from stack\n    local.get $vecB          ;; S offsetResult, (first multiply part), A (swizzled), B\n    ;; Swizzle B on Stack to (y2, z2, x2, _w2)\n    v128.const i32x4 0x07060504 0x0b0a0908 0x03020100 0x0f0e0d0c ;; S offsetResult, (first multiply part), A (swizzled), B, swizzle params\n    i8x16.swizzle            ;; S offsetResult, (first multiply part), A (swizzled), B (swizzled)\n\n    ;; Calculate (z1 * y2, x1 * z2, y1 * x2, 0)\n    f32x4.mul                ;; S offsetResult, (first multiply part), (second multiply part)\n\n    ;; Subtract the two multiplied vectors\n    f32x4.sub                ;; S offsetResult, result\n\n    ;; store result in memory offsetResult\n    v128.store               ;; S -\n  )\n```\n### Performance comparison on my machine\n\nAMD Ryzen 9 7900X3D, 64 GB RAM, Windows 11, Chrome 134\n\n100 million cross products:\n\nEngine      | Time         | Relative to JS | Relative to WASM\n------------|--------------|------|-----\nJavaScript  | 2.89 seconds | 100% | 301%\nWebAssembly | 0.96 seconds |  33% | 100%\n\nA comparison to an `Emscripten`-compiled C implementation will be added soon.\n\nA cross product isn't that complex. However, if the performance gain is already 3x for this simple operation, the gain for more complex operations like matrix-matrix multiplication will be even higher.\n\n### Update: Matrix-Matrix Multiplication\n```ts\nimport { Matrix4, Matrix4Data } from \"wasm-math\";\n\n(() => {\n  const a: Matrix4Data = [\n    -0.232, 0.123, 0.456, 0.789,\n    0.321, 0.654, -0.987, 0.123,\n    0.456, -0.789, 0.123, 0.456,\n    0.654, 0.987, 0.123, -0.456,\n  ];\n  const b: Matrix4Data = [\n    0.123, 0.456, 0.789, -0.232,\n    0.654, -0.987, 0.123, 0.321,\n    -0.789, 0.123, 0.456, 0.654,\n    0.987, 0.123, -0.456, 0.987,\n  ];\n\n  using ma = new Matrix4(a);\n  using mb = new Matrix4(b);\n  using mr = new Matrix4();\n\n  const t0 = performance.now();\n  for (let i = 0; i < 100_000_000; ++i) {\n    Matrix4.multiply(ma, mb, mr);\n  }\n  const t1 = performance.now();\n  for (let i = 0; i < 100_000_000; ++i) {\n    Matrix4.multiply_ts(ma, mb, mr);\n  }\n  const t2 = performance.now();\n\n  console.log(`WASM Time: ${(t1 - t0).toFixed(3)}ms`);\n  console.log(`TS Time: ${(t2 - t1).toFixed(3)}ms`);\n  console.log(`Speedup: ${((t2 - t1) / (t1 - t0)).toFixed(2)}`);\n})();\n```\nOutput:\n```\nWASM Time: 2058.740ms\nTS Time: 8691.420ms\nSpeedup: 4.22\n```\nThe results are exceptional. The WebAssembly implementation is 4.22 times as fast as the TypeScript implementation!\n\n## Memory management insights and challenges\nTests have shown that if the Vector3, Quaternion, and Matrix4 classes are not written with efficient memory management in mind from the start, any speed advantage gained by using WebAssembly is negated by the necessary marshaling between JavaScript and WebAssembly.\n\nTherefore each class has a dedicated memory space within the WebAssembly memory. In this configuration there are 6 pages, each 64 KB in size. Each part could hold up to 4096 instances of the respective class.\n\nWebAssembly Text: **math.wat**\n```\n(memory (export \"memory\") 6) ;; 6 pages each 64 KB in size, 384 KB total\n;; Page   0: 0x00000 - 0x0FFFF  (64 KB): Vector3 storage\n;; Page   1: 0x10000 - 0x1FFFF  (64 KB): Quaternion storage\n;; Page 2-5: 0x20000 - 0x5FFFF (256 KB): Matrix4 storage\n```\nInstances meant for long-term storage are placed at the top of the storage space for each class. Temporary instances are placed at the bottom with an additional offset counter. This way, the \"free space search\" algorithm leads to less fragmentation and faster allocation.\n\n### Disposable instances and the using keyword\nYou can create up to 4096 instances of each class. Classes cannot be automatically garbage collected because each JavaScript instance is married to a memory area in the WebAssembly. If you create a new instance, you must also dispose of it manually. The easiest way to do this, is to use the `using` keyword.\n\nExample:\n```ts\nfunction calculateSomething() {\n  using v1 = new Vector3(1, 2, 3);\n  using v2 = new Vector3(4, 5, 6);\n  using result = new Vector3(); // provided result instance\n\n  Vector3.cross(v1, v2, result);\n  console.log(result.print());\n}\n```\nAll functions, that produce a result of a Vector3, Quaternion, or Matrix4 instance, have an optional parameter for the result. This way you can reuse instances and avoid creating unnecessary temporary ones. But even then, you are responsible for deleting these instances.\n\nExample:\n```ts\nfunction calculateSomething() {\n  using v1 = new Vector3(1, 2, 3);\n  using v2 = new Vector3(4, 5, 6);\n\n  // An automatically created result instance is used.\n  // This instance still needs to be cleaned up manually.\n  using result = Vector3.cross(v1, v2);\n  console.log(result.print());\n}\n```\nYou can't use the `using` keyword, if you want to return an instance from a function created inside the function itself. In this case you can either create a new instance before and pass it to the function or use `const` inside and `using` outside the function.\n\nExample:\n```ts\nfunction calculateSomething() {\n  using v1 = new Vector3(1, 2, 3);\n  using v2 = new Vector3(4, 5, 6);\n\n  return Vector3.cross(v1, v2);\n}\n\nfunction main() {\n  using result = calculateSomething();\n  console.log(result.print());\n}\n```\nIf you really have to, you can manually call the `Symbol.dispose` method of an instance. However you cannot use the instance afterwards.\n\nExample:\n```ts\nconst v1 = new Vector3(1, 2, 3);\n// Do something with v1\nv1[Symbol.dispose]();\n// v1 is now unusable\n```\n\n## License\n[MIT License](./LICENSE)\n","readmeFilename":"README.md"}