ffc.h for Mac
ffc.h A direct and faithful c99 single-header port of Daniel Lemire's fastfloat library.
ffc.h — overview
ffc.h A direct and faithful c99 single-header port of Daniel Lemire's fast_float library.
Used by valkey and hiredis
See the original fast_float for much more information on the origin of the algorithm and other characteristics of the approach.
Example
For use within a larger parser, where you don't expect to reach the end of input, use the non-simple variants as the ffc_result includes the stopping point, just like in fast_float
Configuration Macros
Define these before including ffc.h to control compilation: FFC_IMPL — Include the implementation (define in exactly one translation unit). In that translation unit ffc_from_chars_double and ffc_from_chars_double_options are force-inlined at their call sites (Clang in C and C++, GCC in C), so the parser is specialized there. The functions remain ordinary external symbols for every other translation unit. FFC_ENABLE_FLOAT_INLINING — Define alongside FFC_IMPL to also force-inline ffc_from_chars_float and ffc_from_chars_float_options in that translation unit. Off by default: it speeds up float parsing (about 7–35% in the measurements on Apple M-series and Linux x86/ARM), but grows the caller and was measured to slow double parsing in the same translation unit by up to about 2%. Measure both precisions in your application before enabling it. FFC_ROUNDS_TO_NEAREST — Assert at compile time that the floating-point environment uses IEEE 754 round-to-nearest mode (the default on virtually all platforms). When defined, the runtime rounding-mode check is elided, removing a volatile-load/FCMP chain from the fast path. Only define this if you never change the rounding mode (e.g. via fesetround) before parsing.
API
Float Parsing double ffc_parse_double_simple(size_t len, const char s, ffc_outcome outcome) Parses a double from a string of given length. Returns the parsed value, outcome indicates success/failure. ffc_result ffc_parse_double(size_t len, const char s, double out) Parses a double from a string, storing result in out. Returns ffc_result with outcome and end pointer. float ffc_parse_float_simple(size_t len, const char s, ffc_outcome outcome) Parses a float from a string of given length. Returns the parsed value. ffc_result ffc_parse_float(size_t len, const char s, float out) Parses a float from a string, storing result in out.
Integer Parsing
Integer parsing function variants are available for i64 (signed 64-bit), u64 (unsigned 64-bit), i32 (signed 32-bit), and u32 (unsigned 32-bit). For brevity's sake, only the i64 version is written here, they all act the same way for their respective type.
All functions accept a base argument, supported bases are between 2 and 36. int64_t ffc_parse_i64_simple(size_t len, const char input, int base, ffc_outcome outcome) Parses a signed 64-bit integer from a string of given length. Returns the parsed value, outcome indicates success/failure. ffc_result ffc_parse_i64(size_t len, const char s, int base, int64_t out)
Details
单头文件 C99 加速浮点/双精度解析
How to install ffc.h
- Open Terminal (press ⌘ + Space and type “Terminal”).
- If Homebrew is not installed yet, run the command below first.
- Run this command:
Latest 10 releases
Last updated 2026-09-23; current version v26.09.01, with the latest 6 releases listed.
| Version | Released | Type | Size | macOS | Windows | Linux |
|---|---|---|---|---|---|---|
| v26.09.01 | 2026-09-23 | Stable | — | — | — | — |
| v26.07.01 | 2026-07-23 | Stable | — | — | — | — |
| v26.04.01 | 2026-04-22 | Stable | — | — | — | — |
| v26.03.03 | 2026-03-08 | Stable | — | — | — | — |
| v26.03.2 | 2026-03-07 | Stable | — | — | — | — |
| v26.03.1 | 2026-03-06 | Stable | — | — | — | — |
Data from GitHub Releases; stable releases first, each group sorted newest first.
Prebuilt bottle platforms
Official Homebrew bottles cover:
- all
⚠️ No prebuilt bottle for Intel Macs; Intel users need brew install --build-from-source to build from source.
Compared with similar apps
Only public metadata is compared, with no subjective recommendation; see the compare pages for field-by-field comparisons.
| App | Version | License | Architecture | 30-day installs |
|---|---|---|---|---|
| ffc.h | v26.09.01 | Apache-2.0 | CLI | 1 |
| libantlr3c | 3.5.3 | BSD-3-Clause | CLI | 1 |
| doublecpp | 0.6.3 | GPL-2.0-or-later | CLI | 0 |
| gnome-online-accounts | 3.58.1 | LGPL-2.0-or-later | CLI | 1 |
Similar apps: Command-line Tools
libantlr3c
ANTLRv3 parsing library for Cdoublecpp
doublecpp is a command-line tool for C developers that implements double dispatch in C code.gnome-online-accounts
GNOME Online Accounts is the single sign-on framework within the GNOME desktop environment…libabw
libabw is a library dedicated to parsing AbiWord documents, suited for developers who need to…pegtl
The Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency C++ header-only…datatype99
Safe, intuitive [algebraic data types] with exhaustive pattern matching & compile-time…Categories: Command-line Tools