sqrt + test
This commit is contained in:
parent
d18f2168e4
commit
2240b80656
@ -421,6 +421,9 @@ impl Planar64{
|
||||
pub const fn get(&self)->i64{
|
||||
self.0
|
||||
}
|
||||
pub fn sqrt(&self)->Self{
|
||||
Planar64(unsafe{(((self.0 as i128)<<32) as f64).sqrt().to_int_unchecked()})
|
||||
}
|
||||
}
|
||||
const PLANAR64_FLOAT32_ONE:f32=(1u64<<32) as f32;
|
||||
const PLANAR64_FLOAT32_MUL:f32=1.0/PLANAR64_FLOAT32_ONE;
|
||||
@ -912,3 +915,11 @@ impl std::fmt::Display for Planar64Affine3{
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sqrt(){
|
||||
let r=Planar64::int(400);
|
||||
println!("r{}",r.get());
|
||||
let s=r.sqrt();
|
||||
println!("s{}",s.get());
|
||||
}
|
Loading…
Reference in New Issue
Block a user