Skip to content

0.1.0

Choose a tag to compare

@coenttb coenttb released this 20 Nov 23:16
· 25 commits to main since this release

IEEE 754 v0.1.0

Swift implementation of IEEE 754-2019 binary floating-point standard for canonical serialization.

Features

  • Binary32 and Binary64 formats: Full support for Float and Double serialization
  • Endianness control: Little-endian and big-endian byte order support
  • Zero-copy deserialization: High-performance unsafe memory operations
  • Cross-module inlining: Optimized with @inlinable and @_transparent
  • Special values: Comprehensive handling of NaN, infinity, subnormals, and signed zero
  • Pure Swift: No Foundation dependencies, suitable for Swift Embedded

Installation

dependencies: [
    .package(url: "https://github.com/swift-standards/swift-ieee-754.git", from: "0.1.0")
]

Quick Start

import IEEE_754

// Double to bytes
let bytes = (3.14159).bytes()

// Bytes to Double
let value = Double(bytes: bytes)

Testing

181 tests across 11 suites covering:

  • Round-trip conversions
  • Special values and edge cases
  • Performance benchmarks
  • Concurrent access safety

Performance

Benchmarked on Apple Silicon:

  • Serialization: 0.5 microseconds per Double
  • Deserialization: 0.5 microseconds per Double
  • Round-trip 10,000 conversions: 5ms

Requirements

  • Swift 6.0+
  • macOS 15.0+ / iOS 18.0+ / tvOS 18.0+ / watchOS 11.0+