Hi,

just checking performance wise, is num::cast() doing a dynamic type cast or
a static cast.

I'm writing some template code that works on Real and I need sometime to
divide T:Real by 2 or compate with 0 or 1.

I've been using num::zero() and num::one() so far but how about dividing by
2?

should I write something like this:

let two = num::one::<T>()+ num::one::<T>();
let res:T = aVariable / two;

or would be just as efficient?
let res:T = aVariable / num::cast::<float, T>(2.0);

 or is there an even better alternative?

with rust 0.8.

cheers,

Rémi

-- 
Rémi Fontan : [email protected]
mobile: +64 21 855 351
93 Otaki Street, Miramar 6022
Wellington, New Zealand
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to