Lines Matching refs:ty
93 ($ty:ident, $uty:ident, $f_scalar:ident, $u_scalar:ty,
96 type F = $ty;
98 fn into_float_with_exponent(self, exponent: i32) -> $ty {
102 $ty::from_bits(self | exponent_bits)
106 impl Distribution<$ty> for Standard {
107 fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> $ty {
117 scale * $ty::cast_from_int(value)
121 impl Distribution<$ty> for OpenClosed01 {
122 fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> $ty {
133 scale * $ty::cast_from_int(value + 1)
137 impl Distribution<$ty> for Open01 {
138 fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> $ty {
182 ($fnn:ident, $ty:ident, $ZERO:expr, $EPSILON:expr) => {
187 assert_eq!(zeros.gen::<$ty>(), $ZERO);
189 assert_eq!(one.gen::<$ty>(), $EPSILON / 2.0);
191 assert_eq!(max.gen::<$ty>(), 1.0 - $EPSILON / 2.0);
195 assert_eq!(zeros.sample::<$ty, _>(OpenClosed01), 0.0 + $EPSILON / 2.0);
197 assert_eq!(one.sample::<$ty, _>(OpenClosed01), $EPSILON);
199 assert_eq!(max.sample::<$ty, _>(OpenClosed01), $ZERO + 1.0);
203 assert_eq!(zeros.sample::<$ty, _>(Open01), 0.0 + $EPSILON / 2.0);
205 assert_eq!(one.sample::<$ty, _>(Open01), $EPSILON / 2.0 * 3.0);
207 assert_eq!(max.sample::<$ty, _>(Open01), 1.0 - $EPSILON / 2.0);
222 ($fnn:ident, $ty:ident, $ZERO:expr, $EPSILON:expr) => {
227 assert_eq!(zeros.gen::<$ty>(), $ZERO);
229 assert_eq!(one.gen::<$ty>(), $EPSILON / 2.0);
231 assert_eq!(max.gen::<$ty>(), 1.0 - $EPSILON / 2.0);
235 assert_eq!(zeros.sample::<$ty, _>(OpenClosed01), 0.0 + $EPSILON / 2.0);
237 assert_eq!(one.sample::<$ty, _>(OpenClosed01), $EPSILON);
239 assert_eq!(max.sample::<$ty, _>(OpenClosed01), $ZERO + 1.0);
243 assert_eq!(zeros.sample::<$ty, _>(Open01), 0.0 + $EPSILON / 2.0);
245 assert_eq!(one.sample::<$ty, _>(Open01), $EPSILON / 2.0 * 3.0);
247 assert_eq!(max.sample::<$ty, _>(Open01), 1.0 - $EPSILON / 2.0);