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