| 1 |
#![allow(missing_docs)] |
| 2 |
|
| 3 |
//! Implementation of traits form fixed-point numbers. |
| 4 |
use crate::scalar::{ComplexField, Field, RealField, SubsetOf}; |
| 5 |
use crate::simd::{PrimitiveSimdValue, SimdValue}; |
| 6 |
use fixed::traits::ToFixed; |
| 7 |
use fixed::types::extra::{ |
| 8 |
IsLessOrEqual, LeEqU16, LeEqU32, LeEqU64, LeEqU8, True, Unsigned, U12, U13, U14, U15, U28, U29, |
| 9 |
U30, U31, U4, U5, U6, U60, U61, U62, U63, U7, |
| 10 |
}; |
| 11 |
use num::{Bounded, FromPrimitive, Num, One, Signed, Zero}; |
| 12 |
#[cfg(feature = "serde_serialize")] |
| 13 |
use serde::{Deserialize, Deserializer, Serialize, Serializer}; |
| 14 |
use std::cmp::Ordering; |
| 15 |
use std::hash::{Hash, Hasher}; |
| 16 |
use std::ops::{ |
| 17 |
Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Rem, RemAssign, Sub, SubAssign, |
| 18 |
}; |
| 19 |
|
| 20 |
macro_rules! impl_fixed_type ( |
| 21 |
($($FixedI: ident, $Int: ident, $LeEqDim: ident, $LeEqDim1: ident, $LeEqDim2: ident, $LeEqDim3: ident, $LeEqDim4: ident;)*) => {$( |
| 22 |
#[derive(Copy, Clone)] |
| 23 |
#[repr(transparent)] |
| 24 |
/// Signed fixed-point number with a generic number of bits for the fractional part. |
| 25 |
pub struct $FixedI<Fract>(pub fixed::$FixedI<Fract>); |
| 26 |
|
| 27 |
impl<Fract: $LeEqDim> $FixedI<Fract> { |
| 28 |
/// Creates a fixed-point number from another number. |
| 29 |
#[inline(always)] |
| 30 |
pub fn from_num<N: fixed::traits::ToFixed>(val: N) -> Self { |
| 31 |
$FixedI(fixed::$FixedI::from_num(val)) |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
impl<Fract> $FixedI<Fract> { |
| 36 |
/// Creates a fixed-point number that has a bitwise representation identical to the given integer. |
| 37 |
#[inline(always)] |
| 38 |
pub const fn from_bits(bits: $Int) -> Self { |
| 39 |
$FixedI(fixed::$FixedI::from_bits(bits)) |
| 40 |
} |
| 41 |
|
| 42 |
/// Creates an integer that has a bitwise representation identical to the given fixed-point number. |
| 43 |
#[inline(always)] |
| 44 |
pub const fn to_bits(self) -> $Int { |
| 45 |
self.0.to_bits() |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
impl<Fract: $LeEqDim> PartialEq for $FixedI<Fract> { |
| 50 |
#[inline(always)] |
| 51 |
fn eq(&self, other: &Self) -> bool { |
| 52 |
self.0 == other.0 |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
impl<Fract: $LeEqDim> Eq for $FixedI<Fract> {} |
| 57 |
|
| 58 |
impl<Fract: $LeEqDim> PartialOrd for $FixedI<Fract> { |
| 59 |
#[inline(always)] |
| 60 |
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { |
| 61 |
Some(self.cmp(other)) |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
impl<Fract: $LeEqDim> Ord for $FixedI<Fract> { |
| 66 |
#[inline(always)] |
| 67 |
fn cmp(&self, other: &Self) -> Ordering { |
| 68 |
self.0.cmp(&other.0) |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
impl<Fract: $LeEqDim> Hash for $FixedI<Fract> { |
| 73 |
fn hash<H: Hasher>(&self, h: &mut H) { |
| 74 |
self.0.hash(h); |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
#[cfg(feature = "rand")] |
| 79 |
impl<Fract: $LeEqDim> rand::distributions::Distribution<$FixedI<Fract>> for rand::distributions::Standard { |
| 80 |
#[inline] |
| 81 |
fn sample<'a, G: rand::Rng + ?Sized>(&self, rng: &mut G) -> $FixedI<Fract> { |
| 82 |
let bits = rng.gen(); |
| 83 |
$FixedI(fixed::$FixedI::from_bits(bits)) |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
#[cfg(feature = "rand")] |
| 88 |
impl<Fract: $LeEqDim> rand::distributions::Distribution<$FixedI<Fract>> for rand::distributions::OpenClosed01 { |
| 89 |
#[inline] |
| 90 |
fn sample<'a, G: rand::Rng + ?Sized>(&self, rng: &mut G) -> $FixedI<Fract> { |
| 91 |
let val: f64 = rng.gen(); |
| 92 |
$FixedI(fixed::$FixedI::from_num(val)) |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
impl<Fract: $LeEqDim> PrimitiveSimdValue for $FixedI<Fract> {} |
| 97 |
impl<Fract: $LeEqDim> SimdValue for $FixedI<Fract> { |
| 98 |
const LANES: usize = 1; |
| 99 |
type Element = Self; |
| 100 |
type SimdBool = bool; |
| 101 |
|
| 102 |
#[inline(always)] |
| 103 |
fn splat(val: Self::Element) -> Self { |
| 104 |
val |
| 105 |
} |
| 106 |
|
| 107 |
#[inline(always)] |
| 108 |
fn extract(&self, _: usize) -> Self::Element { |
| 109 |
*self |
| 110 |
} |
| 111 |
|
| 112 |
#[inline(always)] |
| 113 |
unsafe fn extract_unchecked(&self, _: usize) -> Self::Element { |
| 114 |
*self |
| 115 |
} |
| 116 |
|
| 117 |
#[inline(always)] |
| 118 |
fn replace(&mut self, _: usize, val: Self::Element) { |
| 119 |
*self = val |
| 120 |
} |
| 121 |
|
| 122 |
#[inline(always)] |
| 123 |
unsafe fn replace_unchecked(&mut self, _: usize, val: Self::Element) { |
| 124 |
*self = val |
| 125 |
} |
| 126 |
|
| 127 |
#[inline(always)] |
| 128 |
fn select(self, cond: Self::SimdBool, other: Self) -> Self { |
| 129 |
if cond { |
| 130 |
self |
| 131 |
} else { |
| 132 |
other |
| 133 |
} |
| 134 |
} |
| 135 |
} |
| 136 |
|
| 137 |
impl<Fract: $LeEqDim> Mul for $FixedI<Fract> { |
| 138 |
type Output = Self; |
| 139 |
#[inline(always)] |
| 140 |
fn mul(self, rhs: Self) -> Self { |
| 141 |
Self(self.0 * rhs.0) |
| 142 |
} |
| 143 |
} |
| 144 |
|
| 145 |
impl<Fract: $LeEqDim> Mul<$Int> for $FixedI<Fract> { |
| 146 |
type Output = Self; |
| 147 |
#[inline(always)] |
| 148 |
fn mul(self, rhs: $Int) -> Self { |
| 149 |
Self(self.0 * rhs) |
| 150 |
} |
| 151 |
} |
| 152 |
|
| 153 |
impl<Fract: $LeEqDim> Div for $FixedI<Fract> { |
| 154 |
type Output = Self; |
| 155 |
#[inline(always)] |
| 156 |
fn div(self, rhs: Self) -> Self { |
| 157 |
Self(self.0 / rhs.0) |
| 158 |
} |
| 159 |
} |
| 160 |
|
| 161 |
impl<Fract: $LeEqDim> Div<$Int> for $FixedI<Fract> { |
| 162 |
type Output = Self; |
| 163 |
#[inline(always)] |
| 164 |
fn div(self, rhs: $Int) -> Self { |
| 165 |
Self(self.0 / rhs) |
| 166 |
} |
| 167 |
} |
| 168 |
|
| 169 |
impl<Fract: $LeEqDim> Rem for $FixedI<Fract> { |
| 170 |
type Output = Self; |
| 171 |
#[inline(always)] |
| 172 |
fn rem(self, rhs: Self) -> Self { |
| 173 |
Self(self.0 % rhs.0) |
| 174 |
} |
| 175 |
} |
| 176 |
|
| 177 |
impl<Fract: $LeEqDim> Rem<$Int> for $FixedI<Fract> { |
| 178 |
type Output = Self; |
| 179 |
#[inline(always)] |
| 180 |
fn rem(self, rhs: $Int) -> Self { |
| 181 |
Self(self.0 % rhs) |
| 182 |
} |
| 183 |
} |
| 184 |
|
| 185 |
impl<Fract: $LeEqDim> Add for $FixedI<Fract> { |
| 186 |
type Output = Self; |
| 187 |
#[inline(always)] |
| 188 |
fn add(self, rhs: Self) -> Self { |
| 189 |
Self(self.0 + rhs.0) |
| 190 |
} |
| 191 |
} |
| 192 |
|
| 193 |
impl<Fract: $LeEqDim> Sub for $FixedI<Fract> { |
| 194 |
type Output = Self; |
| 195 |
#[inline(always)] |
| 196 |
fn sub(self, rhs: Self) -> Self { |
| 197 |
Self(self.0 - rhs.0) |
| 198 |
} |
| 199 |
} |
| 200 |
|
| 201 |
impl<Fract: $LeEqDim> Neg for $FixedI<Fract> { |
| 202 |
type Output = Self; |
| 203 |
#[inline(always)] |
| 204 |
fn neg(self) -> Self { |
| 205 |
Self(-self.0) |
| 206 |
} |
| 207 |
} |
| 208 |
|
| 209 |
impl<Fract: $LeEqDim> MulAssign for $FixedI<Fract> { |
| 210 |
#[inline(always)] |
| 211 |
fn mul_assign(&mut self, rhs: Self) { |
| 212 |
self.0 *= rhs.0 |
| 213 |
} |
| 214 |
} |
| 215 |
|
| 216 |
impl<Fract: $LeEqDim> MulAssign<$Int> for $FixedI<Fract> { |
| 217 |
#[inline(always)] |
| 218 |
fn mul_assign(&mut self, rhs: $Int) { |
| 219 |
self.0 *= rhs |
| 220 |
} |
| 221 |
} |
| 222 |
|
| 223 |
impl<Fract: $LeEqDim> DivAssign for $FixedI<Fract> { |
| 224 |
#[inline(always)] |
| 225 |
fn div_assign(&mut self, rhs: Self) { |
| 226 |
self.0 /= rhs.0 |
| 227 |
} |
| 228 |
} |
| 229 |
|
| 230 |
impl<Fract: $LeEqDim> DivAssign<$Int> for $FixedI<Fract> { |
| 231 |
#[inline(always)] |
| 232 |
fn div_assign(&mut self, rhs: $Int) { |
| 233 |
self.0 /= rhs |
| 234 |
} |
| 235 |
} |
| 236 |
|
| 237 |
impl<Fract: $LeEqDim> RemAssign for $FixedI<Fract> { |
| 238 |
#[inline(always)] |
| 239 |
fn rem_assign(&mut self, rhs: Self) { |
| 240 |
self.0 %= rhs.0 |
| 241 |
} |
| 242 |
} |
| 243 |
|
| 244 |
impl<Fract: $LeEqDim> RemAssign<$Int> for $FixedI<Fract> { |
| 245 |
#[inline(always)] |
| 246 |
fn rem_assign(&mut self, rhs: $Int) { |
| 247 |
self.0 %= rhs |
| 248 |
} |
| 249 |
} |
| 250 |
|
| 251 |
impl<Fract: $LeEqDim> AddAssign for $FixedI<Fract> { |
| 252 |
#[inline(always)] |
| 253 |
fn add_assign(&mut self, rhs: Self) { |
| 254 |
self.0 += rhs.0 |
| 255 |
} |
| 256 |
} |
| 257 |
|
| 258 |
impl<Fract: $LeEqDim> SubAssign for $FixedI<Fract> { |
| 259 |
#[inline(always)] |
| 260 |
fn sub_assign(&mut self, rhs: Self) { |
| 261 |
self.0 -= rhs.0 |
| 262 |
} |
| 263 |
} |
| 264 |
|
| 265 |
impl<Fract: $LeEqDim> Zero for $FixedI<Fract> { |
| 266 |
#[inline(always)] |
| 267 |
fn zero() -> Self { |
| 268 |
Self(fixed::$FixedI::from_num(0)) |
| 269 |
} |
| 270 |
|
| 271 |
#[inline(always)] |
| 272 |
fn is_zero(&self) -> bool { |
| 273 |
self.0 == Self::zero().0 |
| 274 |
} |
| 275 |
} |
| 276 |
|
| 277 |
impl<Fract: $LeEqDim> One for $FixedI<Fract> { |
| 278 |
#[inline(always)] |
| 279 |
fn one() -> Self { |
| 280 |
Self(fixed::$FixedI::from_num(1)) |
| 281 |
} |
| 282 |
} |
| 283 |
|
| 284 |
impl<Fract: $LeEqDim> Num for $FixedI<Fract> { |
| 285 |
type FromStrRadixErr = (); |
| 286 |
fn from_str_radix(_str: &str, _radix: u32) -> Result<Self, Self::FromStrRadixErr> { |
| 287 |
unimplemented!() |
| 288 |
} |
| 289 |
} |
| 290 |
|
| 291 |
impl<Fract: $LeEqDim> Field for $FixedI<Fract> {} |
| 292 |
|
| 293 |
impl<Fract: $LeEqDim> SubsetOf<$FixedI<Fract>> for f64 { |
| 294 |
#[inline] |
| 295 |
fn to_superset(&self) -> $FixedI<Fract> { |
| 296 |
$FixedI(fixed::$FixedI::from_num(*self)) |
| 297 |
} |
| 298 |
|
| 299 |
#[inline] |
| 300 |
fn from_superset(element: &$FixedI<Fract>) -> Option<Self> { |
| 301 |
Some(Self::from_superset_unchecked(element)) |
| 302 |
} |
| 303 |
|
| 304 |
#[inline] |
| 305 |
fn from_superset_unchecked(element: &$FixedI<Fract>) -> Self { |
| 306 |
element.0.to_num::<f64>() |
| 307 |
} |
| 308 |
|
| 309 |
#[inline] |
| 310 |
fn is_in_subset(_: &$FixedI<Fract>) -> bool { |
| 311 |
true |
| 312 |
} |
| 313 |
} |
| 314 |
|
| 315 |
impl<Fract: $LeEqDim> SubsetOf<$FixedI<Fract>> for f32 { |
| 316 |
#[inline] |
| 317 |
fn to_superset(&self) -> $FixedI<Fract> { |
| 318 |
$FixedI(fixed::$FixedI::from_num(*self)) |
| 319 |
} |
| 320 |
|
| 321 |
#[inline] |
| 322 |
fn from_superset(element: &$FixedI<Fract>) -> Option<Self> { |
| 323 |
Some(Self::from_superset_unchecked(element)) |
| 324 |
} |
| 325 |
|
| 326 |
#[inline] |
| 327 |
fn from_superset_unchecked(element: &$FixedI<Fract>) -> Self { |
| 328 |
element.0.to_num::<f32>() |
| 329 |
} |
| 330 |
|
| 331 |
#[inline] |
| 332 |
fn is_in_subset(_: &$FixedI<Fract>) -> bool { |
| 333 |
true |
| 334 |
} |
| 335 |
} |
| 336 |
|
| 337 |
impl<Fract: $LeEqDim> SubsetOf<$FixedI<Fract>> for $FixedI<Fract> { |
| 338 |
#[inline] |
| 339 |
fn to_superset(&self) -> $FixedI<Fract> { |
| 340 |
*self |
| 341 |
} |
| 342 |
|
| 343 |
#[inline] |
| 344 |
fn from_superset(element: &$FixedI<Fract>) -> Option<Self> { |
| 345 |
Some(*element) |
| 346 |
} |
| 347 |
|
| 348 |
#[inline] |
| 349 |
fn from_superset_unchecked(element: &$FixedI<Fract>) -> Self { |
| 350 |
*element |
| 351 |
} |
| 352 |
|
| 353 |
#[inline] |
| 354 |
fn is_in_subset(_: &$FixedI<Fract>) -> bool { |
| 355 |
true |
| 356 |
} |
| 357 |
} |
| 358 |
|
| 359 |
impl<Fract: $LeEqDim> approx::AbsDiffEq for $FixedI<Fract> { |
| 360 |
type Epsilon = Self; |
| 361 |
fn default_epsilon() -> Self::Epsilon { |
| 362 |
Self(fixed::$FixedI::from_bits(0b01)) |
| 363 |
} |
| 364 |
|
| 365 |
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool { |
| 366 |
// This is the impl used in the approx crate. |
| 367 |
if self > other { |
| 368 |
(*self - *other) <= epsilon |
| 369 |
} else { |
| 370 |
(*other - *self) <= epsilon |
| 371 |
} |
| 372 |
} |
| 373 |
} |
| 374 |
|
| 375 |
impl<Fract: $LeEqDim> approx::RelativeEq for $FixedI<Fract> { |
| 376 |
fn default_max_relative() -> Self::Epsilon { |
| 377 |
use approx::AbsDiffEq; |
| 378 |
Self::default_epsilon() |
| 379 |
} |
| 380 |
|
| 381 |
fn relative_eq( |
| 382 |
&self, |
| 383 |
other: &Self, |
| 384 |
epsilon: Self::Epsilon, |
| 385 |
max_relative: Self::Epsilon, |
| 386 |
) -> bool |
| 387 |
{ |
| 388 |
// This is the impl used in the approx crate. |
| 389 |
let abs_diff = (*self - *other).abs(); |
| 390 |
|
| 391 |
if abs_diff <= epsilon { |
| 392 |
return true; |
| 393 |
} |
| 394 |
|
| 395 |
let abs_self = self.abs(); |
| 396 |
let abs_other = other.abs(); |
| 397 |
|
| 398 |
let largest = if abs_other > abs_self { |
| 399 |
abs_other |
| 400 |
} else { |
| 401 |
abs_self |
| 402 |
}; |
| 403 |
|
| 404 |
abs_diff <= largest * max_relative |
| 405 |
} |
| 406 |
} |
| 407 |
|
| 408 |
impl<Fract: $LeEqDim> approx::UlpsEq for $FixedI<Fract> { |
| 409 |
fn default_max_ulps() -> u32 { |
| 410 |
4 |
| 411 |
} |
| 412 |
|
| 413 |
fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool { |
| 414 |
use approx::AbsDiffEq; |
| 415 |
|
| 416 |
if self.abs_diff_eq(other, epsilon) { |
| 417 |
return true; |
| 418 |
} |
| 419 |
|
| 420 |
if self.signum() != other.signum() { |
| 421 |
return false; |
| 422 |
} |
| 423 |
|
| 424 |
let bits1 = self.0.to_bits(); |
| 425 |
let bits2 = other.0.to_bits(); |
| 426 |
|
| 427 |
if bits1 > bits2 { |
| 428 |
(bits1 - bits2) <= max_ulps as $Int |
| 429 |
} else { |
| 430 |
(bits2 - bits1) <= max_ulps as $Int |
| 431 |
} |
| 432 |
} |
| 433 |
} |
| 434 |
|
| 435 |
impl<Fract: $LeEqDim> std::fmt::Debug for $FixedI<Fract> { |
| 436 |
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
| 437 |
self.0.fmt(f) |
| 438 |
} |
| 439 |
} |
| 440 |
|
| 441 |
impl<Fract: $LeEqDim> std::fmt::Display for $FixedI<Fract> { |
| 442 |
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
| 443 |
self.0.fmt(f) |
| 444 |
} |
| 445 |
} |
| 446 |
|
| 447 |
impl<Fract: $LeEqDim> Bounded for $FixedI<Fract> { |
| 448 |
#[inline] |
| 449 |
fn min_value() -> Self { |
| 450 |
Self(fixed::$FixedI::MIN) |
| 451 |
} |
| 452 |
|
| 453 |
#[inline] |
| 454 |
fn max_value() -> Self { |
| 455 |
Self(fixed::$FixedI::MAX) |
| 456 |
} |
| 457 |
} |
| 458 |
|
| 459 |
impl<Fract: $LeEqDim> FromPrimitive for $FixedI<Fract> { |
| 460 |
fn from_i64(n: i64) -> Option<Self> { |
| 461 |
n.checked_to_fixed().map(Self) |
| 462 |
} |
| 463 |
fn from_u64(n: u64) -> Option<Self> { |
| 464 |
n.checked_to_fixed().map(Self) |
| 465 |
} |
| 466 |
fn from_isize(n: isize) -> Option<Self> { |
| 467 |
n.checked_to_fixed().map(Self) |
| 468 |
} |
| 469 |
fn from_i8(n: i8) -> Option<Self> { |
| 470 |
n.checked_to_fixed().map(Self) |
| 471 |
} |
| 472 |
fn from_i16(n: i16) -> Option<Self> { |
| 473 |
n.checked_to_fixed().map(Self) |
| 474 |
} |
| 475 |
fn from_i32(n: i32) -> Option<Self> { |
| 476 |
n.checked_to_fixed().map(Self) |
| 477 |
} |
| 478 |
fn from_usize(n: usize) -> Option<Self> { |
| 479 |
n.checked_to_fixed().map(Self) |
| 480 |
} |
| 481 |
fn from_u8(n: u8) -> Option<Self> { |
| 482 |
n.checked_to_fixed().map(Self) |
| 483 |
} |
| 484 |
fn from_u16(n: u16) -> Option<Self> { |
| 485 |
n.checked_to_fixed().map(Self) |
| 486 |
} |
| 487 |
fn from_u32(n: u32) -> Option<Self> { |
| 488 |
n.checked_to_fixed().map(Self) |
| 489 |
} |
| 490 |
fn from_f32(n: f32) -> Option<Self> { |
| 491 |
n.checked_to_fixed().map(Self) |
| 492 |
} |
| 493 |
fn from_f64(n: f64) -> Option<Self> { |
| 494 |
n.checked_to_fixed().map(Self) |
| 495 |
} |
| 496 |
} |
| 497 |
|
| 498 |
impl<Fract: $LeEqDim> Signed for $FixedI<Fract> { |
| 499 |
fn abs(&self) -> Self { |
| 500 |
Self(self.0.abs()) |
| 501 |
} |
| 502 |
|
| 503 |
fn abs_sub(&self, other: &Self) -> Self { |
| 504 |
self.abs() - *other |
| 505 |
} |
| 506 |
|
| 507 |
fn signum(&self) -> Self { |
| 508 |
Self(self.0.signum()) |
| 509 |
} |
| 510 |
|
| 511 |
fn is_positive(&self) -> bool { |
| 512 |
self.0 >= Self::zero().0 |
| 513 |
} |
| 514 |
|
| 515 |
fn is_negative(&self) -> bool { |
| 516 |
self.0 <= Self::zero().0 |
| 517 |
} |
| 518 |
} |
| 519 |
|
| 520 |
impl<Fract: Send + Sync + 'static> ComplexField for $FixedI<Fract> |
| 521 |
where Fract: Unsigned |
| 522 |
+ $LeEqDim |
| 523 |
+ IsLessOrEqual<$LeEqDim1, Output = True> |
| 524 |
+ IsLessOrEqual<$LeEqDim2, Output = True> |
| 525 |
+ IsLessOrEqual<$LeEqDim3, Output = True> |
| 526 |
+ IsLessOrEqual<$LeEqDim4, Output = True> { |
| 527 |
type RealField = Self; |
| 528 |
|
| 529 |
#[inline] |
| 530 |
fn from_real(re: Self::RealField) -> Self { |
| 531 |
re |
| 532 |
} |
| 533 |
|
| 534 |
#[inline] |
| 535 |
fn real(self) -> Self::RealField { |
| 536 |
self |
| 537 |
} |
| 538 |
|
| 539 |
#[inline] |
| 540 |
fn imaginary(self) -> Self::RealField { |
| 541 |
Self::zero() |
| 542 |
} |
| 543 |
|
| 544 |
#[inline] |
| 545 |
fn norm1(self) -> Self::RealField { |
| 546 |
self.abs() |
| 547 |
} |
| 548 |
|
| 549 |
#[inline] |
| 550 |
fn modulus(self) -> Self::RealField { |
| 551 |
self.abs() |
| 552 |
} |
| 553 |
|
| 554 |
#[inline] |
| 555 |
fn modulus_squared(self) -> Self::RealField { |
| 556 |
self * self |
| 557 |
} |
| 558 |
|
| 559 |
#[inline] |
| 560 |
fn argument(self) -> Self::RealField { |
| 561 |
if self >= Self::zero() { |
| 562 |
Self::zero() |
| 563 |
} else { |
| 564 |
Self::pi() |
| 565 |
} |
| 566 |
} |
| 567 |
|
| 568 |
#[inline] |
| 569 |
fn to_exp(self) -> (Self, Self) { |
| 570 |
if self >= Self::zero() { |
| 571 |
(self, Self::one()) |
| 572 |
} else { |
| 573 |
(-self, -Self::one()) |
| 574 |
} |
| 575 |
} |
| 576 |
|
| 577 |
#[inline] |
| 578 |
fn recip(self) -> Self { |
| 579 |
Self::one() / self |
| 580 |
} |
| 581 |
|
| 582 |
#[inline] |
| 583 |
fn conjugate(self) -> Self { |
| 584 |
self |
| 585 |
} |
| 586 |
|
| 587 |
#[inline] |
| 588 |
fn scale(self, factor: Self::RealField) -> Self { |
| 589 |
self * factor |
| 590 |
} |
| 591 |
|
| 592 |
#[inline] |
| 593 |
fn unscale(self, factor: Self::RealField) -> Self { |
| 594 |
self / factor |
| 595 |
} |
| 596 |
|
| 597 |
#[inline] |
| 598 |
fn floor(self) -> Self { |
| 599 |
Self(self.0.floor()) |
| 600 |
} |
| 601 |
|
| 602 |
#[inline] |
| 603 |
fn ceil(self) -> Self { |
| 604 |
Self(self.0.ceil()) |
| 605 |
} |
| 606 |
|
| 607 |
#[inline] |
| 608 |
fn round(self) -> Self { |
| 609 |
Self(self.0.round()) |
| 610 |
} |
| 611 |
|
| 612 |
#[inline] |
| 613 |
fn trunc(self) -> Self { |
| 614 |
Self(self.0.int()) |
| 615 |
} |
| 616 |
|
| 617 |
#[inline] |
| 618 |
fn fract(self) -> Self { |
| 619 |
Self(self.0.frac()) |
| 620 |
} |
| 621 |
|
| 622 |
#[inline] |
| 623 |
fn abs(self) -> Self { |
| 624 |
Self(self.0.abs()) |
| 625 |
} |
| 626 |
|
| 627 |
#[inline] |
| 628 |
fn signum(self) -> Self { |
| 629 |
Self(self.0.signum()) |
| 630 |
} |
| 631 |
|
| 632 |
#[inline] |
| 633 |
fn mul_add(self, a: Self, b: Self) -> Self { |
| 634 |
self * a + b |
| 635 |
} |
| 636 |
|
| 637 |
#[cfg(feature = "std")] |
| 638 |
#[inline] |
| 639 |
fn powi(self, _n: i32) -> Self { |
| 640 |
unimplemented!() |
| 641 |
} |
| 642 |
|
| 643 |
#[cfg(not(feature = "std"))] |
| 644 |
#[inline] |
| 645 |
fn powi(self, n: i32) -> Self { |
| 646 |
unimplemented!() |
| 647 |
} |
| 648 |
|
| 649 |
#[inline] |
| 650 |
fn powf(self, _n: Self) -> Self { |
| 651 |
unimplemented!() |
| 652 |
} |
| 653 |
|
| 654 |
#[inline] |
| 655 |
fn powc(self, _n: Self) -> Self { |
| 656 |
unimplemented!() |
| 657 |
} |
| 658 |
|
| 659 |
#[inline] |
| 660 |
fn sqrt(self) -> Self { |
| 661 |
Self(cordic::sqrt(self.0)) |
| 662 |
} |
| 663 |
|
| 664 |
#[inline] |
| 665 |
fn try_sqrt(self) -> Option<Self> { |
| 666 |
if self >= Self::zero() { |
| 667 |
Some(self.sqrt()) |
| 668 |
} else { |
| 669 |
None |
| 670 |
} |
| 671 |
} |
| 672 |
|
| 673 |
#[inline] |
| 674 |
fn exp(self) -> Self { |
| 675 |
Self(cordic::exp(self.0)) |
| 676 |
} |
| 677 |
|
| 678 |
#[inline] |
| 679 |
fn exp2(self) -> Self { |
| 680 |
unimplemented!() |
| 681 |
} |
| 682 |
|
| 683 |
#[inline] |
| 684 |
fn exp_m1(self) -> Self { |
| 685 |
unimplemented!() |
| 686 |
} |
| 687 |
|
| 688 |
#[inline] |
| 689 |
fn ln_1p(self) -> Self { |
| 690 |
unimplemented!() |
| 691 |
} |
| 692 |
|
| 693 |
#[inline] |
| 694 |
fn ln(self) -> Self { |
| 695 |
unimplemented!() |
| 696 |
} |
| 697 |
|
| 698 |
#[inline] |
| 699 |
fn log(self, _base: Self) -> Self { |
| 700 |
unimplemented!() |
| 701 |
} |
| 702 |
|
| 703 |
#[inline] |
| 704 |
fn log2(self) -> Self { |
| 705 |
unimplemented!() |
| 706 |
} |
| 707 |
|
| 708 |
#[inline] |
| 709 |
fn log10(self) -> Self { |
| 710 |
unimplemented!() |
| 711 |
} |
| 712 |
|
| 713 |
#[inline] |
| 714 |
fn cbrt(self) -> Self { |
| 715 |
unimplemented!() |
| 716 |
} |
| 717 |
|
| 718 |
#[inline] |
| 719 |
fn hypot(self, _other: Self) -> Self::RealField { |
| 720 |
unimplemented!() |
| 721 |
} |
| 722 |
|
| 723 |
#[inline] |
| 724 |
fn sin(self) -> Self { |
| 725 |
Self(cordic::sin(self.0)) |
| 726 |
} |
| 727 |
|
| 728 |
#[inline] |
| 729 |
fn cos(self) -> Self { |
| 730 |
Self(cordic::cos(self.0)) |
| 731 |
} |
| 732 |
|
| 733 |
#[inline] |
| 734 |
fn tan(self) -> Self { |
| 735 |
Self(cordic::tan(self.0)) |
| 736 |
} |
| 737 |
|
| 738 |
#[inline] |
| 739 |
fn asin(self) -> Self { |
| 740 |
Self(cordic::asin(self.0)) |
| 741 |
} |
| 742 |
|
| 743 |
#[inline] |
| 744 |
fn acos(self) -> Self { |
| 745 |
Self(cordic::acos(self.0)) |
| 746 |
} |
| 747 |
|
| 748 |
#[inline] |
| 749 |
fn atan(self) -> Self { |
| 750 |
Self(cordic::atan(self.0)) |
| 751 |
} |
| 752 |
|
| 753 |
#[inline] |
| 754 |
fn sin_cos(self) -> (Self, Self) { |
| 755 |
let (sin, cos) = cordic::sin_cos(self.0); |
| 756 |
(Self(sin), Self(cos)) |
| 757 |
} |
| 758 |
|
| 759 |
#[inline] |
| 760 |
fn sinh(self) -> Self { |
| 761 |
unimplemented!() |
| 762 |
} |
| 763 |
|
| 764 |
#[inline] |
| 765 |
fn cosh(self) -> Self { |
| 766 |
unimplemented!() |
| 767 |
} |
| 768 |
|
| 769 |
#[inline] |
| 770 |
fn tanh(self) -> Self { |
| 771 |
unimplemented!() |
| 772 |
} |
| 773 |
|
| 774 |
#[inline] |
| 775 |
fn asinh(self) -> Self { |
| 776 |
unimplemented!() |
| 777 |
} |
| 778 |
|
| 779 |
#[inline] |
| 780 |
fn acosh(self) -> Self { |
| 781 |
unimplemented!() |
| 782 |
} |
| 783 |
|
| 784 |
#[inline] |
| 785 |
fn atanh(self) -> Self { |
| 786 |
unimplemented!() |
| 787 |
} |
| 788 |
|
| 789 |
#[inline] |
| 790 |
fn is_finite(&self) -> bool { |
| 791 |
true |
| 792 |
} |
| 793 |
} |
| 794 |
|
| 795 |
impl<Fract: Send + Sync + 'static> RealField for $FixedI<Fract> |
| 796 |
where Fract: Unsigned |
| 797 |
+ $LeEqDim |
| 798 |
+ IsLessOrEqual<$LeEqDim1, Output = True> |
| 799 |
+ IsLessOrEqual<$LeEqDim2, Output = True> |
| 800 |
+ IsLessOrEqual<$LeEqDim3, Output = True> |
| 801 |
+ IsLessOrEqual<$LeEqDim4, Output = True> { |
| 802 |
#[inline] |
| 803 |
fn is_sign_positive(&self) -> bool { |
| 804 |
self.0.is_positive() |
| 805 |
} |
| 806 |
|
| 807 |
#[inline] |
| 808 |
fn is_sign_negative(&self) -> bool { |
| 809 |
self.0.is_negative() |
| 810 |
} |
| 811 |
|
| 812 |
#[inline] |
| 813 |
fn copysign(self, sign: Self) -> Self { |
| 814 |
if sign >= Self::zero() { |
| 815 |
self.abs() |
| 816 |
} else { |
| 817 |
-self.abs() |
| 818 |
} |
| 819 |
} |
| 820 |
|
| 821 |
#[inline] |
| 822 |
fn max(self, other: Self) -> Self { |
| 823 |
if self >= other { |
| 824 |
self |
| 825 |
} else { |
| 826 |
other |
| 827 |
} |
| 828 |
} |
| 829 |
|
| 830 |
#[inline] |
| 831 |
fn min(self, other: Self) -> Self { |
| 832 |
if self < other { |
| 833 |
self |
| 834 |
} else { |
| 835 |
other |
| 836 |
} |
| 837 |
} |
| 838 |
|
| 839 |
#[inline] |
| 840 |
fn clamp(self, min: Self, max: Self) -> Self { |
| 841 |
if self < min { |
| 842 |
min |
| 843 |
} else if self > max { |
| 844 |
max |
| 845 |
} else { |
| 846 |
self |
| 847 |
} |
| 848 |
} |
| 849 |
|
| 850 |
#[inline] |
| 851 |
fn atan2(self, other: Self) -> Self { |
| 852 |
Self(cordic::atan2(self.0, other.0)) |
| 853 |
} |
| 854 |
|
| 855 |
#[inline] |
| 856 |
fn min_value() -> Option<Self> { |
| 857 |
Some(Bounded::min_value()) |
| 858 |
} |
| 859 |
|
| 860 |
#[inline] |
| 861 |
fn max_value() -> Option<Self> { |
| 862 |
Some(Bounded::max_value()) |
| 863 |
} |
| 864 |
|
| 865 |
/// Archimedes' constant. |
| 866 |
#[inline] |
| 867 |
fn pi() -> Self { |
| 868 |
Self(fixed::$FixedI::PI) |
| 869 |
} |
| 870 |
|
| 871 |
/// 2.0 * pi. |
| 872 |
#[inline] |
| 873 |
fn two_pi() -> Self { |
| 874 |
Self::pi() + Self::pi() |
| 875 |
} |
| 876 |
|
| 877 |
/// pi / 2.0. |
| 878 |
#[inline] |
| 879 |
fn frac_pi_2() -> Self { |
| 880 |
Self(fixed::$FixedI::FRAC_PI_2) |
| 881 |
} |
| 882 |
|
| 883 |
/// pi / 3.0. |
| 884 |
#[inline] |
| 885 |
fn frac_pi_3() -> Self { |
| 886 |
Self(fixed::$FixedI::FRAC_PI_3) |
| 887 |
} |
| 888 |
|
| 889 |
/// pi / 4.0. |
| 890 |
#[inline] |
| 891 |
fn frac_pi_4() -> Self { |
| 892 |
Self(fixed::$FixedI::FRAC_PI_4) |
| 893 |
} |
| 894 |
|
| 895 |
/// pi / 6.0. |
| 896 |
#[inline] |
| 897 |
fn frac_pi_6() -> Self { |
| 898 |
Self(fixed::$FixedI::FRAC_PI_6) |
| 899 |
} |
| 900 |
|
| 901 |
/// pi / 8.0. |
| 902 |
#[inline] |
| 903 |
fn frac_pi_8() -> Self { |
| 904 |
Self(fixed::$FixedI::FRAC_PI_8) |
| 905 |
} |
| 906 |
|
| 907 |
/// 1.0 / pi. |
| 908 |
#[inline] |
| 909 |
fn frac_1_pi() -> Self { |
| 910 |
Self(fixed::$FixedI::FRAC_1_PI) |
| 911 |
} |
| 912 |
|
| 913 |
/// 2.0 / pi. |
| 914 |
#[inline] |
| 915 |
fn frac_2_pi() -> Self { |
| 916 |
Self(fixed::$FixedI::FRAC_2_PI) |
| 917 |
} |
| 918 |
|
| 919 |
/// 2.0 / sqrt(pi). |
| 920 |
#[inline] |
| 921 |
fn frac_2_sqrt_pi() -> Self { |
| 922 |
Self(fixed::$FixedI::FRAC_2_SQRT_PI) |
| 923 |
} |
| 924 |
|
| 925 |
/// Euler's number. |
| 926 |
#[inline] |
| 927 |
fn e() -> Self { |
| 928 |
Self(fixed::$FixedI::E) |
| 929 |
} |
| 930 |
|
| 931 |
/// log2(e). |
| 932 |
#[inline] |
| 933 |
fn log2_e() -> Self { |
| 934 |
Self(fixed::$FixedI::LOG2_E) |
| 935 |
} |
| 936 |
|
| 937 |
/// log10(e). |
| 938 |
#[inline] |
| 939 |
fn log10_e() -> Self { |
| 940 |
Self(fixed::$FixedI::LOG10_E) |
| 941 |
} |
| 942 |
|
| 943 |
/// ln(2.0). |
| 944 |
#[inline] |
| 945 |
fn ln_2() -> Self { |
| 946 |
Self(fixed::$FixedI::LN_2) |
| 947 |
} |
| 948 |
|
| 949 |
/// ln(10.0). |
| 950 |
#[inline] |
| 951 |
fn ln_10() -> Self { |
| 952 |
Self(fixed::$FixedI::LN_10) |
| 953 |
} |
| 954 |
} |
| 955 |
|
| 956 |
#[cfg(feature = "serde_serialize")] |
| 957 |
impl<Fract: $LeEqDim> Serialize for $FixedI<Fract> { |
| 958 |
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { |
| 959 |
self.0.serialize(serializer) |
| 960 |
} |
| 961 |
} |
| 962 |
|
| 963 |
#[cfg(feature = "serde_serialize")] |
| 964 |
impl<'de, Fract: $LeEqDim> Deserialize<'de> for $FixedI<Fract> { |
| 965 |
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> { |
| 966 |
fixed::$FixedI::deserialize(deserializer).map($FixedI) |
| 967 |
} |
| 968 |
} |
| 969 |
)*} |
| 970 |
); |
| 971 |
|
| 972 |
impl_fixed_type!( |
| 973 |
FixedI8, i8, LeEqU8, U7, U6, U5, U4; |
| 974 |
FixedI16, i16, LeEqU16, U15, U14, U13, U12; |
| 975 |
FixedI32, i32, LeEqU32, U31, U30, U29, U28; |
| 976 |
FixedI64, i64, LeEqU64, U63, U62, U61, U60; |
| 977 |
); |
| 978 |
|
| 979 |
pub type FixedI8F0 = FixedI8<fixed::types::extra::U0>; |
| 980 |
pub type FixedI7F1 = FixedI8<fixed::types::extra::U1>; |
| 981 |
pub type FixedI6F2 = FixedI8<fixed::types::extra::U2>; |
| 982 |
pub type FixedI5F3 = FixedI8<fixed::types::extra::U3>; |
| 983 |
pub type FixedI4F4 = FixedI8<fixed::types::extra::U4>; |
| 984 |
pub type FixedI3F5 = FixedI8<fixed::types::extra::U5>; |
| 985 |
|
| 986 |
pub type FixedI16F0 = FixedI16<fixed::types::extra::U0>; |
| 987 |
pub type FixedI15F1 = FixedI16<fixed::types::extra::U1>; |
| 988 |
pub type FixedI14F2 = FixedI16<fixed::types::extra::U2>; |
| 989 |
pub type FixedI13F3 = FixedI16<fixed::types::extra::U3>; |
| 990 |
pub type FixedI12F4 = FixedI16<fixed::types::extra::U4>; |
| 991 |
pub type FixedI11F5 = FixedI16<fixed::types::extra::U5>; |
| 992 |
pub type FixedI10F6 = FixedI16<fixed::types::extra::U6>; |
| 993 |
pub type FixedI9F7 = FixedI16<fixed::types::extra::U7>; |
| 994 |
pub type FixedI8F8 = FixedI16<fixed::types::extra::U8>; |
| 995 |
pub type FixedI7F9 = FixedI16<fixed::types::extra::U9>; |
| 996 |
pub type FixedI6F10 = FixedI16<fixed::types::extra::U10>; |
| 997 |
pub type FixedI5F11 = FixedI16<fixed::types::extra::U11>; |
| 998 |
pub type FixedI4F12 = FixedI16<fixed::types::extra::U12>; |
| 999 |
pub type FixedI3F13 = FixedI16<fixed::types::extra::U13>; |
| 1000 |
|
| 1001 |
pub type FixedI32F0 = FixedI32<fixed::types::extra::U0>; |
| 1002 |
pub type FixedI31F1 = FixedI32<fixed::types::extra::U1>; |
| 1003 |
pub type FixedI30F2 = FixedI32<fixed::types::extra::U2>; |
| 1004 |
pub type FixedI29F3 = FixedI32<fixed::types::extra::U3>; |
| 1005 |
pub type FixedI28F4 = FixedI32<fixed::types::extra::U4>; |
| 1006 |
pub type FixedI27F5 = FixedI32<fixed::types::extra::U5>; |
| 1007 |
pub type FixedI26F6 = FixedI32<fixed::types::extra::U6>; |
| 1008 |
pub type FixedI25F7 = FixedI32<fixed::types::extra::U7>; |
| 1009 |
pub type FixedI24F8 = FixedI32<fixed::types::extra::U8>; |
| 1010 |
pub type FixedI23F9 = FixedI32<fixed::types::extra::U9>; |
| 1011 |
pub type FixedI22F10 = FixedI32<fixed::types::extra::U10>; |
| 1012 |
pub type FixedI21F11 = FixedI32<fixed::types::extra::U11>; |
| 1013 |
pub type FixedI20F12 = FixedI32<fixed::types::extra::U12>; |
| 1014 |
pub type FixedI19F13 = FixedI32<fixed::types::extra::U13>; |
| 1015 |
pub type FixedI18F14 = FixedI32<fixed::types::extra::U14>; |
| 1016 |
pub type FixedI17F15 = FixedI32<fixed::types::extra::U15>; |
| 1017 |
pub type FixedI16F16 = FixedI32<fixed::types::extra::U16>; |
| 1018 |
pub type FixedI15F17 = FixedI32<fixed::types::extra::U17>; |
| 1019 |
pub type FixedI14F18 = FixedI32<fixed::types::extra::U18>; |
| 1020 |
pub type FixedI13F19 = FixedI32<fixed::types::extra::U19>; |
| 1021 |
pub type FixedI12F20 = FixedI32<fixed::types::extra::U20>; |
| 1022 |
pub type FixedI11F21 = FixedI32<fixed::types::extra::U21>; |
| 1023 |
pub type FixedI10F22 = FixedI32<fixed::types::extra::U22>; |
| 1024 |
pub type FixedI9F23 = FixedI32<fixed::types::extra::U23>; |
| 1025 |
pub type FixedI8F24 = FixedI32<fixed::types::extra::U24>; |
| 1026 |
pub type FixedI7F25 = FixedI32<fixed::types::extra::U25>; |
| 1027 |
pub type FixedI6F26 = FixedI32<fixed::types::extra::U26>; |
| 1028 |
pub type FixedI5F27 = FixedI32<fixed::types::extra::U27>; |
| 1029 |
pub type FixedI4F28 = FixedI32<fixed::types::extra::U28>; |
| 1030 |
pub type FixedI3F29 = FixedI32<fixed::types::extra::U29>; |
| 1031 |
|
| 1032 |
pub type FixedI64F0 = FixedI64<fixed::types::extra::U0>; |
| 1033 |
pub type FixedI63F1 = FixedI64<fixed::types::extra::U1>; |
| 1034 |
pub type FixedI62F2 = FixedI64<fixed::types::extra::U2>; |
| 1035 |
pub type FixedI61F3 = FixedI64<fixed::types::extra::U3>; |
| 1036 |
pub type FixedI60F4 = FixedI64<fixed::types::extra::U4>; |
| 1037 |
pub type FixedI59F5 = FixedI64<fixed::types::extra::U5>; |
| 1038 |
pub type FixedI58F6 = FixedI64<fixed::types::extra::U6>; |
| 1039 |
pub type FixedI57F7 = FixedI64<fixed::types::extra::U7>; |
| 1040 |
pub type FixedI56F8 = FixedI64<fixed::types::extra::U8>; |
| 1041 |
pub type FixedI55F9 = FixedI64<fixed::types::extra::U9>; |
| 1042 |
pub type FixedI54F10 = FixedI64<fixed::types::extra::U10>; |
| 1043 |
pub type FixedI53F11 = FixedI64<fixed::types::extra::U11>; |
| 1044 |
pub type FixedI52F12 = FixedI64<fixed::types::extra::U12>; |
| 1045 |
pub type FixedI51F13 = FixedI64<fixed::types::extra::U13>; |
| 1046 |
pub type FixedI50F14 = FixedI64<fixed::types::extra::U14>; |
| 1047 |
pub type FixedI49F15 = FixedI64<fixed::types::extra::U15>; |
| 1048 |
pub type FixedI48F16 = FixedI64<fixed::types::extra::U16>; |
| 1049 |
pub type FixedI47F17 = FixedI64<fixed::types::extra::U17>; |
| 1050 |
pub type FixedI46F18 = FixedI64<fixed::types::extra::U18>; |
| 1051 |
pub type FixedI45F19 = FixedI64<fixed::types::extra::U19>; |
| 1052 |
pub type FixedI44F20 = FixedI64<fixed::types::extra::U20>; |
| 1053 |
pub type FixedI43F21 = FixedI64<fixed::types::extra::U21>; |
| 1054 |
pub type FixedI42F22 = FixedI64<fixed::types::extra::U22>; |
| 1055 |
pub type FixedI41F23 = FixedI64<fixed::types::extra::U23>; |
| 1056 |
pub type FixedI40F24 = FixedI64<fixed::types::extra::U24>; |
| 1057 |
pub type FixedI39F25 = FixedI64<fixed::types::extra::U25>; |
| 1058 |
pub type FixedI38F26 = FixedI64<fixed::types::extra::U26>; |
| 1059 |
pub type FixedI37F27 = FixedI64<fixed::types::extra::U27>; |
| 1060 |
pub type FixedI36F28 = FixedI64<fixed::types::extra::U28>; |
| 1061 |
pub type FixedI35F29 = FixedI64<fixed::types::extra::U29>; |
| 1062 |
pub type FixedI34F30 = FixedI64<fixed::types::extra::U30>; |
| 1063 |
pub type FixedI33F31 = FixedI64<fixed::types::extra::U31>; |
| 1064 |
pub type FixedI32F32 = FixedI64<fixed::types::extra::U32>; |
| 1065 |
pub type FixedI31F33 = FixedI64<fixed::types::extra::U33>; |
| 1066 |
pub type FixedI30F34 = FixedI64<fixed::types::extra::U34>; |
| 1067 |
pub type FixedI29F35 = FixedI64<fixed::types::extra::U35>; |
| 1068 |
pub type FixedI28F36 = FixedI64<fixed::types::extra::U36>; |
| 1069 |
pub type FixedI27F37 = FixedI64<fixed::types::extra::U37>; |
| 1070 |
pub type FixedI26F38 = FixedI64<fixed::types::extra::U38>; |
| 1071 |
pub type FixedI25F39 = FixedI64<fixed::types::extra::U39>; |
| 1072 |
pub type FixedI24F40 = FixedI64<fixed::types::extra::U40>; |
| 1073 |
pub type FixedI23F41 = FixedI64<fixed::types::extra::U41>; |
| 1074 |
pub type FixedI22F42 = FixedI64<fixed::types::extra::U42>; |
| 1075 |
pub type FixedI21F43 = FixedI64<fixed::types::extra::U43>; |
| 1076 |
pub type FixedI20F44 = FixedI64<fixed::types::extra::U44>; |
| 1077 |
pub type FixedI19F45 = FixedI64<fixed::types::extra::U45>; |
| 1078 |
pub type FixedI18F46 = FixedI64<fixed::types::extra::U46>; |
| 1079 |
pub type FixedI17F47 = FixedI64<fixed::types::extra::U47>; |
| 1080 |
pub type FixedI16F48 = FixedI64<fixed::types::extra::U48>; |
| 1081 |
pub type FixedI15F49 = FixedI64<fixed::types::extra::U49>; |
| 1082 |
pub type FixedI14F50 = FixedI64<fixed::types::extra::U50>; |
| 1083 |
pub type FixedI13F51 = FixedI64<fixed::types::extra::U51>; |
| 1084 |
pub type FixedI12F52 = FixedI64<fixed::types::extra::U52>; |
| 1085 |
pub type FixedI11F53 = FixedI64<fixed::types::extra::U53>; |
| 1086 |
pub type FixedI10F54 = FixedI64<fixed::types::extra::U54>; |
| 1087 |
pub type FixedI9F55 = FixedI64<fixed::types::extra::U55>; |
| 1088 |
pub type FixedI8F56 = FixedI64<fixed::types::extra::U56>; |
| 1089 |
pub type FixedI7F57 = FixedI64<fixed::types::extra::U57>; |
| 1090 |
pub type FixedI6F58 = FixedI64<fixed::types::extra::U58>; |
| 1091 |
pub type FixedI5F59 = FixedI64<fixed::types::extra::U59>; |
| 1092 |
pub type FixedI4F60 = FixedI64<fixed::types::extra::U60>; |