Compare commits
No commits in common. "59b1e2eea1b4fc9d000e2e3d363a7742cfb04052" and "d4a9e67a4aef90da82a2c96372639317ac2dc8b2" have entirely different histories.
59b1e2eea1
...
d4a9e67a4a
14
Cargo.toml
14
Cargo.toml
@ -1,18 +1,20 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "sigils"
|
name = "sigils"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Jason Travis Smith <Myrddin@CyberMages.tech>"]
|
authors = ["Jason Travis Smith <Myrddin@CyberMagesLLC.com>"]
|
||||||
description = "A mathematics library."
|
description = "A mathematics library."
|
||||||
license = ""
|
license = ""
|
||||||
repository = "https://workshop.cybermages.tech/CyberMages/sigils.git"
|
repository = "https://gitlab.com/CyberMages/Core/sigils.git"
|
||||||
documentation = ""
|
documentation = ""
|
||||||
keywords = ["sigils", "math"]
|
keywords = ["sigils"]
|
||||||
edition = "2021"
|
edition = "2018"
|
||||||
|
|
||||||
|
|
||||||
|
[dependencies.weave]
|
||||||
|
git = "ssh://git@gitlab.com/CyberMages/Core/weave"
|
||||||
|
|
||||||
[dependencies.binding]
|
[dependencies.binding]
|
||||||
git = "ssh://gitea@workshop.cybermages.tech:3022/CyberMages/binding.git"
|
git = "ssh://git@gitlab.com/CyberMages/Core/binding"
|
||||||
|
|
||||||
[dependencies.pact]
|
[dependencies.pact]
|
||||||
git = "ssh://gitea@workshop.cybermages.tech:3022/CyberMages/pact.git"
|
git = "ssh://git@gitlab.com/CyberMages/Core/pact"
|
||||||
|
@ -1,96 +0,0 @@
|
|||||||
/// Primitive types that have upper and lower bounds.
|
|
||||||
pub trait Bounded
|
|
||||||
{
|
|
||||||
/// The minimum value for this type.
|
|
||||||
const MIN: Self;
|
|
||||||
|
|
||||||
/// The maximum value for this type.
|
|
||||||
const MAX: Self;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// A macro for making implementation of
|
|
||||||
/// the Bounded trait easier.
|
|
||||||
macro_rules! bounded_trait_impl
|
|
||||||
{
|
|
||||||
($T: ty, $minVal: expr, $maxVal: expr) =>
|
|
||||||
{
|
|
||||||
impl Bounded for $T
|
|
||||||
{
|
|
||||||
const MIN: $T = $minVal;
|
|
||||||
|
|
||||||
const MAX: $T = $maxVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Implement the Bounded for all the primitive types.
|
|
||||||
bounded_trait_impl!(u8, 0u8, !0u8);
|
|
||||||
bounded_trait_impl!(u16, 0u16, !0u16);
|
|
||||||
bounded_trait_impl!(u32, 0u32, !0u32);
|
|
||||||
bounded_trait_impl!(u64, 0u64, !0u64);
|
|
||||||
bounded_trait_impl!(usize, 0usize, !0usize);
|
|
||||||
|
|
||||||
bounded_trait_impl!(i8, (!0i8 ^ (!0u8 >> 1u8) as i8),
|
|
||||||
!(!0i8 ^ (!0u8 >> 1u8) as i8));
|
|
||||||
bounded_trait_impl!(i16, (!0i16 ^ (!0u16 >> 1u16) as i16),
|
|
||||||
!(!0i16 ^ (!0u16 >> 1u16) as i16));
|
|
||||||
bounded_trait_impl!(i32, (!0i32 ^ (!0u32 >> 1u32) as i32),
|
|
||||||
!(!0i32 ^ (!0u32 >> 1u32) as i32));
|
|
||||||
bounded_trait_impl!(i64, (!0i64 ^ (!0u64 >> 1u64) as i64),
|
|
||||||
!(!0i64 ^ (!0u64 >> 1u64) as i64));
|
|
||||||
bounded_trait_impl!(isize, (!0isize ^ (!0usize >> 1usize) as isize),
|
|
||||||
!(!0isize ^ (!0usize >> 1usize) as isize));
|
|
||||||
|
|
||||||
bounded_trait_impl!(f32, -3.40282347e+38f32, 3.40282347e+38f32);
|
|
||||||
bounded_trait_impl!(f64, -1.7976931348623157e+308f64,
|
|
||||||
1.7976931348623157e+308f64);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests
|
|
||||||
{
|
|
||||||
macro_rules! bounds_test
|
|
||||||
{
|
|
||||||
($T: ident, $func_name: ident, $minVal: expr, $maxVal: expr) =>
|
|
||||||
{
|
|
||||||
#[test]
|
|
||||||
fn $func_name()
|
|
||||||
{
|
|
||||||
assert_eq!($T::MIN, $minVal);
|
|
||||||
assert_eq!($T::MAX, $maxVal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bounds_test!(u8, min_max_u8, 0u8, !0u8);
|
|
||||||
bounds_test!(u16, min_max_u16, 0u16, !0u16);
|
|
||||||
bounds_test!(u32, min_max_u32, 0u32, !0u32);
|
|
||||||
bounds_test!(u64, min_max_u64, 0u64, !0u64);
|
|
||||||
bounds_test!(usize, min_max_usize, 0usize, !0usize);
|
|
||||||
|
|
||||||
bounds_test!(i8, min_max_i8,
|
|
||||||
-1i8 << (((::std::mem::size_of::<i8>() as i8)*8i8)-1i8),
|
|
||||||
!(-1i8 << (((::std::mem::size_of::<i8>() as i8)*8i8)-1i8)));
|
|
||||||
bounds_test!(i16, min_max_i16,
|
|
||||||
-1i16 << (((::std::mem::size_of::<i16>() as i16)*8i16)-1i16),
|
|
||||||
!(-1i16 << (((::std::mem::size_of::<i16>() as i16)*8i16)-1i16)));
|
|
||||||
bounds_test!(i32, min_max_i32,
|
|
||||||
-1i32 << (((::std::mem::size_of::<i32>() as i32)*8i32)-1i32),
|
|
||||||
!(-1i32 << (((::std::mem::size_of::<i32>() as i32)*8i32)-1i32)));
|
|
||||||
bounds_test!(i64, min_max_i64,
|
|
||||||
-1i64 << (((::std::mem::size_of::<i64>() as i64)*8i64)-1i64),
|
|
||||||
!(-1i64 << (((::std::mem::size_of::<i64>() as i64)*8i64)-1i64)));
|
|
||||||
bounds_test!(isize, min_max_isize,
|
|
||||||
-1isize << (((::std::mem::size_of::<isize>() as isize)*8isize)-1isize),
|
|
||||||
!(-1isize << (((::std::mem::size_of::<isize>() as isize)*8isize)-1isize)));
|
|
||||||
|
|
||||||
bounds_test!(f32, min_max_f32,
|
|
||||||
-3.40282347e+38f32, 3.40282347e+38f32);
|
|
||||||
bounds_test!(f64, min_max_f64,
|
|
||||||
-1.7976931348623157e+308f64,
|
|
||||||
1.7976931348623157e+308f64);
|
|
||||||
}
|
|
@ -57,7 +57,6 @@ pub trait Constants
|
|||||||
const INVERSE_SQRT_3: Self;
|
const INVERSE_SQRT_3: Self;
|
||||||
|
|
||||||
/// The mathematical constant [E][1]. Also known as [Euler's number][1].
|
/// The mathematical constant [E][1]. Also known as [Euler's number][1].
|
||||||
///
|
|
||||||
/// [1]: https://en.wikipedia.org/wiki/E_(mathematical_constant)
|
/// [1]: https://en.wikipedia.org/wiki/E_(mathematical_constant)
|
||||||
///
|
///
|
||||||
///```
|
///```
|
||||||
@ -131,7 +130,6 @@ pub trait Constants
|
|||||||
const TWO_PI: Self;
|
const TWO_PI: Self;
|
||||||
|
|
||||||
/// [PI][1]. The ratio of a circles circumference to its diameter.
|
/// [PI][1]. The ratio of a circles circumference to its diameter.
|
||||||
///
|
|
||||||
/// [1]: https://en.wikipedia.org/wiki/Pi
|
/// [1]: https://en.wikipedia.org/wiki/Pi
|
||||||
///
|
///
|
||||||
///```
|
///```
|
||||||
|
@ -10,8 +10,6 @@ extern crate core as std;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|
||||||
mod bounded;
|
|
||||||
|
|
||||||
mod zero;
|
mod zero;
|
||||||
mod one;
|
mod one;
|
||||||
mod number;
|
mod number;
|
||||||
@ -28,10 +26,9 @@ pub mod quaternion;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
pub use self::bounded::Bounded;
|
|
||||||
pub use self::zero::Zero;
|
pub use self::zero::Zero;
|
||||||
pub use self::one::One;
|
pub use self::one::One;
|
||||||
pub use self::number::{Number, FromNumber};
|
pub use self::number::Number;
|
||||||
pub use self::whole::Whole;
|
pub use self::whole::Whole;
|
||||||
pub use self::integer::Integer;
|
pub use self::integer::Integer;
|
||||||
pub use self::real::Real;
|
pub use self::real::Real;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
//! This module defines the 2x2, 3x3, and 4x4 Matrix structures.
|
//! This module defines the 2x2, 3x3, and 4x4 Matrix structures.
|
||||||
//use std::ops::{Add, Sub, Mul, Div, Rem, Neg};
|
use std::ops::{Add, Sub, Mul, Div, Rem, Neg};
|
||||||
|
|
||||||
|
use crate::zero::Zero;
|
||||||
|
use crate::one::One;
|
||||||
use crate::number::Number;
|
use crate::number::Number;
|
||||||
use crate::vector::{Vector, Vector2, Vector3, Vector4};
|
use crate::vector::{Vector, Vector2, Vector3, Vector4};
|
||||||
|
|
||||||
|
@ -5,7 +5,8 @@ use std::ops::{Add, Sub, Mul, Div, Rem};
|
|||||||
use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign};
|
use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use crate::bounded::Bounded;
|
use weave::Bounded;
|
||||||
|
|
||||||
use crate::zero::Zero;
|
use crate::zero::Zero;
|
||||||
use crate::one::One;
|
use crate::one::One;
|
||||||
|
|
||||||
@ -899,6 +900,8 @@ float_number_trait_impl!(Number for f64, -1.7976931348623157e+308f64,
|
|||||||
1.7976931348623157e+308f64,
|
1.7976931348623157e+308f64,
|
||||||
fmin, fmax);
|
fmin, fmax);
|
||||||
|
|
||||||
|
#[cfg(target_pointer_width = "8")]
|
||||||
|
int_number_trait_impl!(Number for usize, 0usize, 255usize);
|
||||||
#[cfg(target_pointer_width = "16")]
|
#[cfg(target_pointer_width = "16")]
|
||||||
int_number_trait_impl!(Number for usize, 0usize, 65535usize);
|
int_number_trait_impl!(Number for usize, 0usize, 65535usize);
|
||||||
#[cfg(target_pointer_width = "32")]
|
#[cfg(target_pointer_width = "32")]
|
||||||
@ -906,6 +909,8 @@ int_number_trait_impl!(Number for usize, 0usize, 4294967295usize);
|
|||||||
#[cfg(target_pointer_width = "64")]
|
#[cfg(target_pointer_width = "64")]
|
||||||
int_number_trait_impl!(Number for usize, 0usize, 18446744073709551615usize);
|
int_number_trait_impl!(Number for usize, 0usize, 18446744073709551615usize);
|
||||||
|
|
||||||
|
#[cfg(target_pointer_width = "8")]
|
||||||
|
int_number_trait_impl!(Number for isize, -128isize, 127isize);
|
||||||
#[cfg(target_pointer_width = "16")]
|
#[cfg(target_pointer_width = "16")]
|
||||||
int_number_trait_impl!(Number for isize, -32768isize, 32767isize);
|
int_number_trait_impl!(Number for isize, -32768isize, 32767isize);
|
||||||
#[cfg(target_pointer_width = "32")]
|
#[cfg(target_pointer_width = "32")]
|
||||||
|
@ -7,7 +7,7 @@ pub trait One: Sized + Mul<Self, Output=Self>
|
|||||||
///
|
///
|
||||||
/// # Laws
|
/// # Laws
|
||||||
///
|
///
|
||||||
/// ```text
|
/// ```{.text}
|
||||||
/// a * 1 = a ∀ a ∈ Self
|
/// a * 1 = a ∀ a ∈ Self
|
||||||
/// 1 * a = a ∀ a ∈ Self
|
/// 1 * a = a ∀ a ∈ Self
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -8,8 +8,10 @@ use std::ops::{Add, Sub, Mul, Div, Neg};
|
|||||||
|
|
||||||
use crate::zero::Zero;
|
use crate::zero::Zero;
|
||||||
use crate::one::One;
|
use crate::one::One;
|
||||||
|
use crate::real::Real;
|
||||||
|
use crate::trig::Radian;
|
||||||
use crate::trig::Trig;
|
use crate::trig::Trig;
|
||||||
use crate::vector::{EuclideanVector, Vector3};
|
use crate::vector::{Vector, EuclideanVector, Vector3};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
32
src/real.rs
32
src/real.rs
@ -159,18 +159,22 @@ pub trait Real : Number + Constants + Neg<Output=Self>
|
|||||||
/// use std::{f32, f64};
|
/// use std::{f32, f64};
|
||||||
/// use sigils::Real;
|
/// use sigils::Real;
|
||||||
///
|
///
|
||||||
|
/// let nan32: f32 = f32::NAN;
|
||||||
/// let f_val32 = 7.0f32;
|
/// let f_val32 = 7.0f32;
|
||||||
/// let g_val32 = -7.0f32;
|
/// let g_val32 = -7.0f32;
|
||||||
///
|
///
|
||||||
|
/// let nan64: f64 = f64::NAN;
|
||||||
/// let f_val64 = 7.0f64;
|
/// let f_val64 = 7.0f64;
|
||||||
/// let g_val64 = -7.0f64;
|
/// let g_val64 = -7.0f64;
|
||||||
///
|
///
|
||||||
/// // Requires both tests to determine if is `NaN`
|
/// // Requires both tests to determine if is `NaN`
|
||||||
/// assert!(!f_val32.is_sign_negative());
|
/// assert!(!f_val32.is_sign_negative());
|
||||||
/// assert!(g_val32.is_sign_negative());
|
/// assert!(g_val32.is_sign_negative());
|
||||||
|
/// assert!(!nan32.is_sign_positive() && !nan32.is_sign_negative());
|
||||||
///
|
///
|
||||||
/// assert!(!f_val64.is_sign_negative());
|
/// assert!(!f_val64.is_sign_negative());
|
||||||
/// assert!(g_val64.is_sign_negative());
|
/// assert!(g_val64.is_sign_negative());
|
||||||
|
/// assert!(!nan64.is_sign_positive() && !nan64.is_sign_negative());
|
||||||
/// ```
|
/// ```
|
||||||
fn is_sign_negative(self) -> bool;
|
fn is_sign_negative(self) -> bool;
|
||||||
|
|
||||||
@ -181,18 +185,22 @@ pub trait Real : Number + Constants + Neg<Output=Self>
|
|||||||
/// use std::{f32, f64};
|
/// use std::{f32, f64};
|
||||||
/// use sigils::Real;
|
/// use sigils::Real;
|
||||||
///
|
///
|
||||||
|
/// let nan32: f32 = f32::NAN;
|
||||||
/// let f_val32 = 7.0f32;
|
/// let f_val32 = 7.0f32;
|
||||||
/// let g_val32 = -7.0f32;
|
/// let g_val32 = -7.0f32;
|
||||||
///
|
///
|
||||||
|
/// let nan64: f64 = f64::NAN;
|
||||||
/// let f_val64 = 7.0f64;
|
/// let f_val64 = 7.0f64;
|
||||||
/// let g_val64 = -7.0f64;
|
/// let g_val64 = -7.0f64;
|
||||||
///
|
///
|
||||||
/// // Requires both tests to determine if is `NaN`
|
/// // Requires both tests to determine if is `NaN`
|
||||||
/// assert!(f_val32.is_sign_positive());
|
/// assert!(f_val32.is_sign_positive());
|
||||||
/// assert!(!g_val32.is_sign_positive());
|
/// assert!(!g_val32.is_sign_positive());
|
||||||
|
/// assert!(!nan32.is_sign_positive() && !nan32.is_sign_negative());
|
||||||
///
|
///
|
||||||
/// assert!(f_val64.is_sign_positive());
|
/// assert!(f_val64.is_sign_positive());
|
||||||
/// assert!(!g_val64.is_sign_positive());
|
/// assert!(!g_val64.is_sign_positive());
|
||||||
|
/// assert!(!nan64.is_sign_positive() && !nan64.is_sign_negative());
|
||||||
/// ```
|
/// ```
|
||||||
fn is_sign_positive(self) -> bool;
|
fn is_sign_positive(self) -> bool;
|
||||||
|
|
||||||
@ -220,6 +228,8 @@ pub trait Real : Number + Constants + Neg<Output=Self>
|
|||||||
/// ```
|
/// ```
|
||||||
fn get_signum(self) -> Self;
|
fn get_signum(self) -> Self;
|
||||||
|
|
||||||
|
/* TODO: Reimplement this when the error for 'use core::num::Float;'
|
||||||
|
goes away.
|
||||||
/// Returns the floating point category of the number.
|
/// Returns the floating point category of the number.
|
||||||
/// If only one property is going to be tested, it is
|
/// If only one property is going to be tested, it is
|
||||||
/// generally faster to use the specific predicate instead.
|
/// generally faster to use the specific predicate instead.
|
||||||
@ -242,7 +252,9 @@ pub trait Real : Number + Constants + Neg<Output=Self>
|
|||||||
/// assert_eq!(inf64.get_category(), FpCategory::Infinite);
|
/// assert_eq!(inf64.get_category(), FpCategory::Infinite);
|
||||||
/// ```
|
/// ```
|
||||||
fn get_category(self) -> FpCategory;
|
fn get_category(self) -> FpCategory;
|
||||||
|
*/
|
||||||
|
|
||||||
|
// TODO: Fix/check this example.
|
||||||
/// Returns the mantissa, base 2 exponent, and sign as
|
/// Returns the mantissa, base 2 exponent, and sign as
|
||||||
/// integers, respectively. The original number can be
|
/// integers, respectively. The original number can be
|
||||||
/// recovered by `sign * mantissa * 2 ^ exponent`.
|
/// recovered by `sign * mantissa * 2 ^ exponent`.
|
||||||
@ -253,7 +265,7 @@ pub trait Real : Number + Constants + Neg<Output=Self>
|
|||||||
/// let num = 2.0f32;
|
/// let num = 2.0f32;
|
||||||
///
|
///
|
||||||
/// // (8388608, -22, 1)
|
/// // (8388608, -22, 1)
|
||||||
/// let (mantissa, exponent, sign) = Real::get_integer_decode(num);
|
/// let (mantissa, exponent, sign) = Real::integer_decode(num);
|
||||||
/// let sign_f = sign as f32;
|
/// let sign_f = sign as f32;
|
||||||
/// let mantissa_f = mantissa as f32;
|
/// let mantissa_f = mantissa as f32;
|
||||||
/// let exponent_f = num.powf(exponent as f32);
|
/// let exponent_f = num.powf(exponent as f32);
|
||||||
@ -634,18 +646,18 @@ impl Real for f32
|
|||||||
const NEG_INFINITY: Self = -1.0f32 / 0.0f32;
|
const NEG_INFINITY: Self = -1.0f32 / 0.0f32;
|
||||||
|
|
||||||
///
|
///
|
||||||
const NAN: Self = f32::NAN;
|
const NAN: Self = 0.0f32 / 0.0f32;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fn is_nan(self) -> bool
|
fn is_nan(self) -> bool
|
||||||
{
|
{
|
||||||
self.is_nan()
|
self == Self::NAN
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_finite(self) -> bool
|
fn is_finite(self) -> bool
|
||||||
{
|
{
|
||||||
!self.is_infinite() && !self.is_nan()
|
!self.is_infinite() && self != Self::NAN
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_infinite(self) -> bool
|
fn is_infinite(self) -> bool
|
||||||
@ -689,10 +701,13 @@ impl Real for f32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: Reimplement this when the error for 'use core::num::Float;'
|
||||||
|
goes away.
|
||||||
fn get_category(self) -> FpCategory
|
fn get_category(self) -> FpCategory
|
||||||
{
|
{
|
||||||
self.classify()
|
self.classify()
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
fn get_integer_decode(self) -> (u64, i16, i8)
|
fn get_integer_decode(self) -> (u64, i16, i8)
|
||||||
{
|
{
|
||||||
@ -893,18 +908,18 @@ impl Real for f64
|
|||||||
const NEG_INFINITY: Self = -1.0f64 / 0.0f64;
|
const NEG_INFINITY: Self = -1.0f64 / 0.0f64;
|
||||||
|
|
||||||
///
|
///
|
||||||
const NAN: Self = f64::NAN;
|
const NAN: Self = 0.0f64 / 0.0f64;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fn is_nan(self) -> bool
|
fn is_nan(self) -> bool
|
||||||
{
|
{
|
||||||
self.is_nan()
|
self == Self::NAN
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_finite(self) -> bool
|
fn is_finite(self) -> bool
|
||||||
{
|
{
|
||||||
!self.is_infinite() && !self.is_nan()
|
!self.is_infinite() && self != Self::NAN
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_infinite(self) -> bool
|
fn is_infinite(self) -> bool
|
||||||
@ -948,10 +963,13 @@ impl Real for f64
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: Reimplement this when the error for 'use core::num::Float;'
|
||||||
|
goes away.
|
||||||
fn get_category(self) -> FpCategory
|
fn get_category(self) -> FpCategory
|
||||||
{
|
{
|
||||||
self.classify()
|
self.classify()
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
fn get_integer_decode(self) -> (u64, i16, i8)
|
fn get_integer_decode(self) -> (u64, i16, i8)
|
||||||
{
|
{
|
||||||
|
@ -5,9 +5,12 @@ use std::fmt::{Error, Formatter, Debug, Display};
|
|||||||
use std::ops::{Add, Sub, Mul, Div, Rem, Neg};
|
use std::ops::{Add, Sub, Mul, Div, Rem, Neg};
|
||||||
use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign};
|
use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign};
|
||||||
|
|
||||||
|
use weave::attempt;
|
||||||
|
|
||||||
use crate::zero::Zero;
|
use crate::zero::Zero;
|
||||||
use crate::one::One;
|
use crate::one::One;
|
||||||
use crate::number::Number;
|
use crate::number::Number;
|
||||||
|
use crate::real::Real;
|
||||||
use crate::trig::Radian;
|
use crate::trig::Radian;
|
||||||
use crate::trig::Trig;
|
use crate::trig::Trig;
|
||||||
|
|
||||||
@ -547,12 +550,12 @@ macro_rules! define_vector
|
|||||||
// pretty up the printing.
|
// pretty up the printing.
|
||||||
count = self.get_size();
|
count = self.get_size();
|
||||||
|
|
||||||
write!(formatter, "<")?;
|
attempt!(write!(formatter, "<"));
|
||||||
$(
|
$(
|
||||||
write!(formatter, "{:?}", self.$field)?;
|
attempt!(write!(formatter, "{:?}", self.$field));
|
||||||
if count > 0
|
if count > 0
|
||||||
{
|
{
|
||||||
write!(formatter, ", ")?;
|
attempt!(write!(formatter, ", "));
|
||||||
}
|
}
|
||||||
count -= 1;
|
count -= 1;
|
||||||
)*
|
)*
|
||||||
@ -572,12 +575,12 @@ macro_rules! define_vector
|
|||||||
// pretty up the printing.
|
// pretty up the printing.
|
||||||
count = self.get_size();
|
count = self.get_size();
|
||||||
|
|
||||||
write!(formatter, "<")?;
|
attempt!(write!(formatter, "<"));
|
||||||
$(
|
$(
|
||||||
write!(formatter, "{}", self.$field)?;
|
attempt!(write!(formatter, "{}", self.$field));
|
||||||
if count > 1
|
if count > 1
|
||||||
{
|
{
|
||||||
write!(formatter, ", ")?;
|
attempt!(write!(formatter, ", "));
|
||||||
}
|
}
|
||||||
count -= 1;
|
count -= 1;
|
||||||
)*
|
)*
|
||||||
|
@ -7,7 +7,7 @@ pub trait Zero: Sized + Add<Self, Output=Self>
|
|||||||
///
|
///
|
||||||
/// # Laws
|
/// # Laws
|
||||||
///
|
///
|
||||||
/// ```text
|
/// ```{.text}
|
||||||
/// a + 0 = a ∀ a ∈ Self
|
/// a + 0 = a ∀ a ∈ Self
|
||||||
/// 0 + a = a ∀ a ∈ Self
|
/// 0 + a = a ∀ a ∈ Self
|
||||||
/// ```
|
/// ```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user