The GitHub Actions job "npm_and_yarn in /javascript for ajv - Update 
#1252805865" on fory.git/main has failed.
Run started by GitHub user dependabot[bot] (triggered by dependabot[bot]).

Head commit for run:
b050ba326f7cf2a3fe493a391930c780a63458b5 / Ashhar Ahmad Khan 
<[email protected]>
feat: Add IEEE 754 float16 (binary16) support to Rust runtime (#3252)

## Summary

This PR implements full IEEE 754 half-precision (binary16) `float16`
support for the Rust runtime as requested in issue #3207.

## Implementation Details

### Core Type (`fory-core/src/float16.rs`)
- **New type**: `#[repr(transparent)] pub struct float16(u16)` - 614
lines
- **IEEE 754 compliant** f32 ↔ float16 conversions with proper rounding
- **Round-to-nearest, ties-to-even** rounding mode
- **Complete special value handling**: NaN (payload preservation), ±Inf,
±0, subnormals
- **Overflow/underflow**: Overflow → Infinity, Underflow →
Subnormal/Zero
- **Policy A comparison**: Bitwise Eq/Hash (usable in HashMap) +
separate IEEE helpers
- **Arithmetic**: Implemented via f32 round-back
- **Classification methods**: is_nan, is_infinite, is_finite, is_normal,
is_subnormal, is_zero, is_sign_negative
- **Operator traits**: Add, Sub, Mul, Div, Neg, PartialOrd
- **Display/Debug**: Format via to_f32()

### Integration
- **Buffer methods** (`buffer.rs`): `write_f16()` and `read_f16()` using
little-endian
- **Serializer** (`serializer/number.rs`): Full `Serializer` trait +
`ForyDefault` implementation
- **Type system** (`types.rs`): Added to `BASIC_TYPES`,
`PRIMITIVE_TYPES`, `PRIMITIVE_ARRAY_TYPES`, `BASIC_TYPE_NAMES`,
`PRIMITIVE_ARRAY_TYPE_MAP`, `is_primitive_type_id()`
- **Module export** (`lib.rs`): Public module with `Float16` alias

### Testing
- ✅ **11 comprehensive unit tests** covering all edge cases (ALL
PASSING)
- ✅ **Full test suite** (135 tests, ALL PASSING)
- Test coverage includes:
  - Special values (±0, ±Inf, NaN)
  - Boundary values (max 65504, min normal 2^-14, min subnormal 2^-24)
  - Overflow/underflow behavior
  - Round-to-nearest ties-to-even
  - Arithmetic operations
  - Classification methods
  - Comparison semantics (bitwise & IEEE)

## Why?

Support for half-precision floats is essential for:
- **Reduced payload size** and memory footprint
- **ML/graphics interoperability** where float16 is common
- **Cross-language compatibility** with other Fory implementations

## What does this PR do?

Adds production-ready IEEE 754 binary16 support to Rust runtime matching
the exact specification in #3207, including:
- Strong type safety (no raw u16 in public API)
- Stable Rust only (no nightly features)
- Zero external dependencies
- Complete IEEE 754 compliance
- Comprehensive test coverage

## Related issues

Closes #3207

## Does this PR introduce any user-facing change?

- [x] **Does this PR introduce any public API change?**
  - Yes: Adds new public type `float16` (exported as `Float16`)
- New methods: `from_bits`, `to_bits`, `from_f32`, `to_f32`,
classification methods, arithmetic methods
- New constant values: `ZERO`, `NEG_ZERO`, `INFINITY`, `NEG_INFINITY`,
`NAN`, `MAX`, `MIN_POSITIVE`, `MIN_POSITIVE_SUBNORMAL`
  
- [x] **Does this PR introduce any binary protocol compatibility
change?**
- Yes: Adds `FLOAT16` (TypeId = 16) and `FLOAT16_ARRAY` (TypeId = 50) to
wire format
- Encoded as 2 bytes (little-endian u16 representing IEEE 754 binary16
bits)
  - Backward compatible: Existing code unaffected, new type opt-in only

## Benchmark

Not applicable - this PR adds new functionality without modifying
existing code paths. No performance impact on existing f32/f64 usage.

Report URL: https://github.com/apache/fory/actions/runs/22270767624

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to