Wuffs the Language has no floating point types, but some reference implementations (notably the brotli encoder) make decisions with double and float arithmetic and libm's log2. Porting them with byte-identical output needs bit-exact floating point results. This package implements f64 and f32 add, sub, mul, div, fma, comparisons, min/max, integer conversions and f64<->f32 conversions on bit patterns, with round-to-nearest-even, subnormals, infinities and NaNs, following the structure of Berkeley SoftFloat 3. It also ports glibc 2.39's x86-64 __log2_fma log2 implementation (the variant selected on CPUs with FMA and AVX2), following the shipped machine code's fused operations. Verification: test/c/std/softfloat.c checks every operation against the C compiler's native arithmetic on edge cases and random operands. The script/manual-test-softfloat-*.c programs run 10^8 random operations per operation group and compare log2_u64 against libm for every integer in [1, 2^32) plus 10^7 larger values; all with zero mismatches. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011NoosQNe7DKWnqDCBeqw1p
Releases (in the C Programming Language)
Wuffs the Library ships as a "single file C library", also known as a "header file library".
To use that library in your C/C++ project, you just need to copy one file from
this directory, or otherwise integrate that one file into your build system.
Typically, pick the latest stable version (but not the unsupported snapshot),
with a filename like wuffs-vMAJOR.MINOR.c for version MAJOR.MINOR.
To use that single file as a "foo.c"-like implementation, instead of a
"foo.h"-like header, #define WUFFS_IMPLEMENTATION before #include'ing or
compiling it.
Latest Stable Version
Version 0.3 (April 2023) is the latest stable version. Stable means that its API won't change any further, but being a "version 0.x" means that:
- It will not have long term support.
- Newer versions make no promises about compatibility.
Mirror
Wuffs' canonical repository is located at
github.com/google/wuffs. If you just want to
use Wuffs-the-library in its C form (instead of modifying its Wuffs form or
otherwise needing Wuffs-the-language tools), a mirror of just the release/c
directory is located at
github.com/google/wuffs-mirror-release-c.
By excluding everything else, the mirror is much smaller than and changes much
less frequently than the canonical repository.