use super::*;
use crate::scalar::Scalar;
+ #[test]
+ #[cfg_attr(
+ not(feature = "f16"),
+ should_panic(expected = "f16 feature is not enabled")
+ )]
+ fn test_ilogb_f16() {
+ fn ilogb(arg: f32) -> i16 {
+ let arg: F16 = arg.to();
+ ilogb_f16(Scalar, arg)
+ }
+ assert_eq!(ilogb(0.), ILOGB_UNDERFLOW_RESULT_F16);
+ assert_eq!(ilogb(1.), 0);
+ assert_eq!(ilogb(2.), 1);
+ assert_eq!(ilogb(3.), 1);
+ assert_eq!(ilogb(3.998), 1);
+ assert_eq!(ilogb(0.5), -1);
+ assert_eq!(ilogb(0.5f32.powi(20)), -20);
+ assert_eq!(ilogb(f32::INFINITY), ILOGB_OVERFLOW_RESULT_F16);
+ assert_eq!(ilogb(f32::NAN), ILOGB_NAN_RESULT_F16);
+ }
+
#[test]
fn test_ilogb_f32() {
assert_eq!(ilogb_f32(Scalar, 0f32), ILOGB_UNDERFLOW_RESULT_F32);