1. Arbitrary-Precision Integer Engine (BigInt)
Standard JavaScript numerical operations use IEEE 754 double-precision floating-point format (64 bits), which offers only 53 bits of integer precision (safe up to 9,007,199,254,740,991, or 0x1FFFFFFFFFFFFF). Calculations beyond this threshold quietly lose precision and corrupt data.
All arithmetic, radix conversions, and positional step expansions in HexConverter are powered by native ECMAScript BigInt primitives. BigInt allocations are constrained only by available browser memory, permitting exact conversions for cryptographic keys, SHA-256 hashes, and 128-bit IPv6 integers without loss of precision.
2. Two's Complement Signed Math Formulation
To evaluate signed numbers across standard hardware word sizes (8-bit, 16-bit, 32-bit, and 64-bit), we apply the formal two's complement definition:
Sign Bit Mask = 1 << (w - 1)
Unsigned Mask = (1 << w) - 1
If (UnsignedValue ≥ SignBitMask), SignedValue = UnsignedValue - (1 << w)
This accurately models real-world CPU registers in x86, ARM, and RISC-V architectures.
3. Character Encodings & Stream Decoding
Character encoding conversions utilize the standard TextEncoder and TextDecoder Web APIs compliant with IETF RFC 3629.
- Strict UTF-8 Verification: Decoders run in fatal mode first to catch invalid surrogate pairs, out-of-range code points, or illegal continuation bytes.
- Non-Fatal Inspection: If an error is detected, the decoder runs in non-fatal replacement mode, substituting invalid bytes with
�while notifying the user of the exact issue. - ISO-8859-1 (Latin-1): Strict boundary verification ensures that code points exceeding 255 (0xFF) fail with clear diagnostic notifications.
4. Build-Time Test Vector Verification
To fulfill our commitment that no worked example on this website can be erroneous, every single example component in our codebase is bound to a test vector file. During the build process, the conversion engine calculates and validates all example values against independent test suites; if any example mismatches, the build immediately aborts.
5. Current Scope & Known Limitations
The current version (v1.0) of HexConverter is optimized for integer arithmetic, bitwise logic, and character encodings. Fractional hexadecimal notation (e.g., IEEE 754 floating-point fractions) is currently excluded.