Expand description
§IEEE 754 Floating Point Binary Representation Converter
A comprehensive Rust library for converting various number representations to IEEE 754 floating-point binary format and vice versa. This library supports standard IEEE 754 formats (binary16, binary32, binary64) as well as custom bit configurations.
§Overview
This library implements the IEEE 754-2019 standard for floating-point arithmetic, providing accurate conversions between decimal, binary, hexadecimal, and octal representations with proper handling of special values (NaN, Infinity, Zero).
§Features
- Standard Formats: Full support for IEEE 754 binary16 (FP16), binary32 (FP32), and binary64 (FP64)
- Custom Precision: User-defined bit configurations for exponent and significand
- Multiple Input Formats: Convert from decimal, binary, hexadecimal, and octal
- Automatic Accuracy: Intelligent precision handling with configurable tolerance
- Comprehensive Error Handling: Detailed error types for all edge cases
- CLI Interface: Command-line tool for quick conversions (feature:
cli)
§Quick Start
use ieee754_converter::ieee754::{FP32, FloatingPoint};
use ieee754_converter::converter::decimal;
// Convert decimal to IEEE 754 binary32
let fp32 = FP32::from_f64(3.14159);
let binary_string = fp32.to_binary_string();
// Convert binary string back to decimal
let bits = fp32.to_bits();
let value = fp32.to_f64();§IEEE 754-2019 Compliance
This library follows the IEEE 754-2019 standard specifications:
- Section 3.4: Binary interchange format encodings
- Section 3.6: Interchange format parameters (Table 3.5)
- Section 4: Attributes and rounding
- Section 6: Infinity, NaNs, and sign bit handling
§Architecture
The library is organized into modular components:
ieee754: Core floating-point format implementationsconverter: Format conversion utilities (decimal, binary, hex, octal)utils: Supporting utilities (rounding, validation)error: Comprehensive error types
§Safety
All operations are safe and handle edge cases explicitly. Special values (NaN, Infinity) are properly represented according to IEEE 754-2019.
Re-exports§
pub use error::Ieee754Error;pub use error::Result;pub use ieee754::CustomFloat;pub use ieee754::FP16;pub use ieee754::FP32;pub use ieee754::FP64;pub use ieee754::FloatingPoint;pub use ieee754::Precision;
Modules§
- converter
- Format Conversion Module
- error
- Error Handling Module
- ieee754
- IEEE 754 Floating-Point Format Implementations
- utils
- Utility Functions Module
Constants§
- IEEE_
754_ VERSION - IEEE 754-2019 standard compliance marker.
- VERSION
- Library version following semantic versioning.