Repolode
fastfloat

fastfloat/fast_float

Header-only C++ library for fast, exact parsing of float, double and integer values from strings, a drop-in style from_chars implementation.

Stars
2,134
Forks
200
Open issues
29
Last commit
5 days ago

What is it?

fast_float is a header-only C++ library that implements the C++17-style from_chars functions for float, double and integer types. It converts ASCII decimal strings such as "1.3e10" into binary numbers using exact IEEE rounding, including round-to-even. The implementation does not throw and does not allocate memory.

Beyond the standard interface, the library offers options for a custom decimal separator, Fortran-style numbers, and strict JSON or JavaScript grammars. It also accepts UTF-16 and UTF-32 input, supports fixed-width float types, and can be used at compile time under C++20.

The project targets C++11 and is usable with Visual Studio, macOS, Linux and FreeBSD on both 32-bit and 64-bit, big- and little-endian systems. It can be added via CMake, CPM, Conan, Homebrew or as a single-header file.

Key features

  • 01Parses float and double with exact round-to-nearest-even results.
  • 02Parses signed and unsigned integer types in bases such as 2, 10 and 16.
  • 03Reports errors through std::errc without throwing or allocating memory.
  • 04Offers JSON, JavaScript, Fortran and custom decimal-separator grammars.
  • 05Accepts ASCII, UTF-8, UTF-16 and UTF-32 input.
  • 06Can be consumed as a header-only library or a single header file.

Use cases

  • Parsing large volumes of numeric text in database engines or data pipelines.
  • Reading numbers in JSON or JavaScript parsers that need strict grammar checks.
  • Adding fast numeric conversion to C++ projects that target C++11 or later.
  • Parsing numbers from CSV or log files where speed matters.

Quick start

  1. 1

    Copy the fast_float directory into your project's include path and include the header

Things to know

  • Only decimal input is supported; hexadecimal strings are not parsed.
  • The long double type is not supported.
  • It assumes the floating-point rounding mode is set to round-to-nearest.

Topics

FAQ

What is fast_float?
Header-only C++ library for fast, exact parsing of float, double and integer values from strings, a drop-in style from_chars implementation. fast_float is a header-only C++ library that implements the C++17-style from_chars functions for float, double and integer types. It converts ASCII decimal strings such as "1.3e10" into binary numbers using exact IEEE rounding, including round-to-even. The implementation does not throw and does not allocate memory.
Is fast_float free to use? What license does it have?
fast_float is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is fast_float still maintained?
Actively maintained. The last commit to fast_float was on Oct 19, 2026.
What can I use fast_float for?
Parsing large volumes of numeric text in database engines or data pipelines. Reading numbers in JSON or JavaScript parsers that need strict grammar checks. Adding fast numeric conversion to C++ projects that target C++11 or later. Parsing numbers from CSV or log files where speed matters.
How do I install fast_float?
Copy the fast_float directory into your project's include path and include the header
Where can I get fast_float?
The source code and installation instructions are on GitHub: https://github.com/fastfloat/fast_float

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects