2024-08-28 19:17:00 +00:00
|
|
|
use fixed_wide_traits::wide::WideMul;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_wide_mul(){
|
|
|
|
let a=crate::types::I32F32::ONE;
|
|
|
|
let aa=a.wide_mul(a);
|
|
|
|
assert_eq!(aa,crate::types::I64F64::ONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_bint(){
|
|
|
|
let a=crate::types::I32F32::ONE;
|
|
|
|
assert_eq!(a*2,crate::types::I32F32::from(2));
|
|
|
|
}
|
2024-08-29 17:12:08 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn test_sqrt(){
|
|
|
|
let a=crate::types::I32F32::ONE*4;
|
|
|
|
assert_eq!(a.sqrt(),crate::types::I32F32::from(2));
|
|
|
|
}
|
2024-08-29 19:13:42 +00:00
|
|
|
#[test]
|
|
|
|
fn test_sqrt_low(){
|
|
|
|
let a=crate::types::I32F32::HALF;
|
|
|
|
let b=a*a;
|
|
|
|
assert_eq!(b.sqrt(),a);
|
|
|
|
}
|