Skip to content

[Task] Replace Grisu2 with Zmij for float-to-string conversion #3012

@MaxGraey

Description

@MaxGraey

AssemblyScript currently uses a pretty old Grisu2-based algorithm for f32/f64 to string conversion. Will be great to rewrite this using Zmij, which is a newer shortest-roundtrip algorithm and should be much faster and probably more precise in some rare cases. SIMD should be optional.

Current implementation: https://github.com/AssemblyScript/assemblyscript/blob/main/std/assembly/util/number.ts#L729
Tests: https://github.com/AssemblyScript/assemblyscript/blob/main/tests/compiler/std/string.ts#L736

C++ Reference: https://github.com/vitaut/zmij
Rust port: https://github.com/dtolnay/zmij

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions