☰ Menu
CLI Open source 1 installs/mo

ffc.h for Mac

ffc.h

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

  1. Open Terminal (press ⌘ + Space and type “Terminal”).
  2. If Homebrew is not installed yet, run the command below first.
  3. Run this command:

Latest 10 releases

Last updated 2026-09-23; current version v26.09.01, with the latest 6 releases listed.

VersionReleasedTypeSizemacOSWindowsLinux
v26.09.012026-09-23Stable————
v26.07.012026-07-23Stable————
v26.04.012026-04-22Stable————
v26.03.032026-03-08Stable————
v26.03.22026-03-07Stable————
v26.03.12026-03-06Stable————

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.

Compared with similar apps
AppVersionLicenseArchitecture30-day installs
ffc.hv26.09.01Apache-2.0CLI1
libantlr3c3.5.3BSD-3-ClauseCLI1
doublecpp0.6.3GPL-2.0-or-laterCLI0
gnome-online-accounts3.58.1LGPL-2.0-or-laterCLI1

Similar apps: Command-line Tools

Leave a comment

评论表单加载中…