multitype 0.21.1

Arithmetic type traits.
Documentation
// Copyright 2025-2026 Gabriel Bjørnager Jensen.
//
// SPDX: MIT OR Apache-2.0

#![cfg(test)]

use core::f32;
use core::f64;
use multitype::FloatingPoint;

#[test]
fn test_floating_point_next_up() {
	fn next_up<T: FloatingPoint>(value: T) -> T {
		value.next_up()
	}

	assert_eq!(next_up(1.0_f32).to_bits(), (1.0 + f32::EPSILON).to_bits());
	assert_eq!(next_up(1.0_f64).to_bits(), (1.0 + f64::EPSILON).to_bits());

	#[cfg(feature = "f16")]
	assert_eq!(next_up(1.0_f16).to_bits(), (1.0 + f16::EPSILON).to_bits());

	#[cfg(feature = "f128")]
	assert_eq!(next_up(1.0_f128).to_bits(), (1.0 + f128::EPSILON).to_bits());
}