{"id":25765744,"url":"https://github.com/sctg-development/scientific-notation","last_synced_at":"2025-07-06T06:40:47.594Z","repository":{"id":279192646,"uuid":"938001218","full_name":"sctg-development/scientific-notation","owner":"sctg-development","description":"A TypeScript library for formatting numbers in various scientific notation representations including HTML, LaTeX, and MathML.","archived":false,"fork":false,"pushed_at":"2025-03-08T09:45:15.000Z","size":110,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-11T20:45:58.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sctg-development.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yaml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["sctg-development"]}},"created_at":"2025-02-24T09:07:56.000Z","updated_at":"2025-03-08T09:45:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"2c2301ab-ca8b-446b-8bff-3a99501babf4","html_url":"https://github.com/sctg-development/scientific-notation","commit_stats":null,"previous_names":["sctg-development/scientific-notation"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sctg-development/scientific-notation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sctg-development%2Fscientific-notation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sctg-development%2Fscientific-notation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sctg-development%2Fscientific-notation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sctg-development%2Fscientific-notation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sctg-development","download_url":"https://codeload.github.com/sctg-development/scientific-notation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sctg-development%2Fscientific-notation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260549900,"owners_count":23026326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-26T22:27:29.502Z","updated_at":"2025-07-06T06:40:47.587Z","avatar_url":"https://github.com/sctg-development.png","language":"TypeScript","funding_links":["https://github.com/sponsors/sctg-development"],"categories":[],"sub_categories":[],"readme":"# Scientific Notation Formatter\n\nA TypeScript library for formatting numbers in various scientific notation representations including HTML, LaTeX, and MathML.\n\n## Features\n\n- Convert numbers to scientific notation with configurable precision\n- Multiple output formats:\n  - Standard scientific notation (e.g., `1.23e6`)\n  - LaTeX (`1.23 \\times 10^{6}`)\n  - MathML (`\u003cmath\u003e\u003cmrow\u003e\u003cmn\u003e1.23\u003c/mn\u003e\u003cmo\u003e×\u003c/mo\u003e\u003cmsup\u003e\u003cmn\u003e10\u003c/mn\u003e\u003cmn\u003e6\u003c/mn\u003e\u003c/msup\u003e\u003c/mrow\u003e\u003c/math\u003e`)\n  - HTML (`1.23 × 10\u003csup\u003e6\u003c/sup\u003e`)\n- Precise control over significant figures\n- Standardized exponents (steps of 3)\n- Zero handling\n- Typescript types included\n\n## Installation\n\n```bash\nnpm install @sctg/scientific-notation\n```\n\n## Usage\n\n```typescript\nimport { ScientificNotation } from '@sctg/scientific-notation';\n\n// Basic usage\nconst number = 1234567.89;\nconst precision = 4;\n\n// Standard scientific notation\nconsole.log(ScientificNotation.toScientificNotationString(number, precision));\n// Output: \"1.235e6\"\n\n// LaTeX format\nconsole.log(ScientificNotation.toScientificNotationLatex(number, precision));\n// Output: \"1.235 \\times 10^{6}\"\n\n// HTML format\nconsole.log(ScientificNotation.toScientificNotationHTML(number, precision));\n// Output: \"1.235 × 10\u003csup\u003e6\u003c/sup\u003e\"\n\n// MathML format\nconsole.log(ScientificNotation.toScientificNotationMathML(number, precision));\n// Output: \"\u003cmath\u003e\u003cmrow\u003e\u003cmn\u003e1.235\u003c/mn\u003e\u003cmo\u003e×\u003c/mo\u003e\u003cmsup\u003e\u003cmn\u003e10\u003c/mn\u003e\u003cmn\u003e6\u003c/mn\u003e\u003c/msup\u003e\u003c/mrow\u003e\u003c/math\u003e\"\n```\n\n## API Reference\n\n### `toScientificNotation(value: number, precision?: number): ScientificNotationNumber`\n\nConverts a number to scientific notation components.\n\n```typescript\nconst result = ScientificNotation.toScientificNotation(1234.56, 3);\n// Returns: { mantissa: 1.23, exponent: 3 }\n```\n\n### `toScientificNotationString(value: number, precision?: number): string`\n\nReturns a string representation in scientific notation.\n\n### `toScientificNotationLatex(value: number, precision?: number): string`\n\nReturns a LaTeX formatted string.\n\n### `toScientificNotationMathML(value: number, precision?: number): string`\n\nReturns a MathML formatted string.\n\n### `toScientificNotationHTML(value: number, precision?: number): string`\n\nReturns an HTML formatted string.\n\n## Types\n\n```typescript\ntype ScientificNotationNumber = {\n  mantissa: number;  // The coefficient\n  exponent: number;  // The power of 10\n};\n```\n\n## Features\n\n- Standardizes exponents in steps of 3\n- Maintains precision with trailing zeros\n- Handles special cases (zero, small numbers)\n- Type-safe with TypeScript\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nCopyright (c) 2024-2025 Ronan LE MEILLAT\n\nThis project is licensed under the GNU Affero General Public License v3.0 - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\nRonan LE MEILLAT  \nSCTG Development\n\n## Related Projects\n\n- [@sctg/aga8-js](https://github.com/sctg-development/aga8-js) - GERG-2008 equations of state\n- [flow-dilution](https://github.com/sctg-development/flow-dilution) - Gas flow dilution calculator\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsctg-development%2Fscientific-notation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsctg-development%2Fscientific-notation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsctg-development%2Fscientific-notation/lists"}