Commit 4475600
V3.99: supporting cross-platform BlockType == uint64_t (#511)
* Incrementing SEMVER to v3.99
* Fix blockbinary operator[] vs test() misuse in posit components
blockbinary::operator[] is a block/limb index accessor, not a bit
index accessor. Four locations used it with bit indices, causing
stack-buffer-overflow for posit configurations where fbits > nrBlocks
(e.g., posit<16,1,uint8_t> with fbits=12 and only 2 blocks).
Fixed positFraction::operator<<, get_fixed_point(), denormalize(),
and posit reciprocal sign extraction to use _block.test(bitIndex).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add comprehensive documentation for all number systems
Why/what/how markdown guides for each of the 29 number systems
with regression tests, covering integer, fixed-point, rational,
configurable floats, posit family, logarithmic, multi-component
extended precision, block-scaled AI formats, interval arithmetic,
and compressed floating-point. Includes README.md index with
category tables and selection guide.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* adding details about uint32_t for limb carry arithmetic
* adding uint64_t limb support
* fix headers in SORN tests
* Fix nibble() UB in all block types for uint64_t limbs
0x0Fu is a 32-bit unsigned int, so shifting it by nibbleIndexInWord*4
when nibbleIndexInWord >= 8 (i.e., shift >= 32) is undefined behavior.
On MSVC this caused corrupt to_hex() output and cascading test failures
in bb_uint64_limbs. Fix by casting to bt before shifting, ensuring the
shift operates on the block type width.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix MSVC intrinsic output via reference-derived pointers in carry.hpp
_umul128, _addcarry_u64, and _subborrow_u64 write results through
pointer parameters. When these pointers were derived from reference
parameters via reinterpret_cast, the MSVC optimizer could lose the
writes after inlining, causing mul128 to always return hi=0. This
produced systematically wrong multiplication results (block[1] only
contained the addcarry carry-out bit, not the mul128 high product).
Fix: use local variables for all intrinsic output pointers, then
assign to the reference parameters after the intrinsic returns.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix blockbinary mul with uint64_t limbs passing multi-bit carry to addcarry
The multiplication loop accumulated carries as full 64-bit values
(hi + c1) then passed them as carry_in to addcarry(). On MSVC,
_addcarry_u64 truncates carry_in to unsigned char, silently losing
the upper bits. Split into two separate addcarry calls each with
carry_in=0 so the multi-bit carry is added as a regular operand.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix MSVC build failures for long double ambiguity and M_PI undeclared
Posit: add long double constructor/operator= in the #else branch of
LONG_DOUBLE_SUPPORT so MSVC (where long double is a distinct type but
same precision as double) no longer hits ambiguous overload resolution.
Directives: define _USE_MATH_DEFINES for MSVC so M_PI is available
from <cmath> without per-file defines.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Fix MSVC posit long double constructor ambiguity and zfpblock shift UB
Remove redundant long double constructor/assignment in posit #else branch
that caused ambiguous overload on MSVC where long double == double.
Replace ternary with if-constexpr helper in zfp_codec encode/decode to
avoid C4293 warning when N == 64.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Restore long double overloads for MSVC where long double != double for overload resolution
MSVC treats long double and double as distinct types for overload
resolution despite identical representation. Without explicit long
double overloads, assignment from long double is ambiguous among
float/double/integer candidates.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 2e6e678 commit 4475600
File tree
52 files changed
+4593
-162
lines changed- .github/workflows
- docs
- number-systems
- sessions
- include/sw/universal
- internal
- blockbinary
- blockdecimal
- blockfraction
- blocksignificand
- blocktype
- number
- integer
- posit
- zfpblock
- utility
- internal/blockbinary/arithmetic
- static
- integer/binary/api
- sorn
- api
- arithmetic
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
52 files changed
+4593
-162
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
0 commit comments