pub trait FloatNumber: Number + Float + Signed {
    // Required methods
    fn copysign(self, sign: Self) -> Self;
    fn ln_1pe(self) -> Self;
    fn sigmoid(self) -> Self;
    fn rand() -> Self;
    fn two() -> Self;
    fn half() -> Self;
    fn to_f32_bits(self) -> u32;

    // Provided method
    fn square(self) -> Self { ... }
}
Expand description

Defines float number

Required Methods§

source

fn copysign(self, sign: Self) -> Self

Copy sign from sign - another real number

source

fn ln_1pe(self) -> Self

Calculates natural \( \ln(1+e^x) \) without overflow.

source

fn sigmoid(self) -> Self

Efficient implementation of Sigmoid function, \( S(x) = \frac{1}{1 + e^{-x}} \), see Sigmoid function

source

fn rand() -> Self

Returns pseudorandom number between 0 and 1

source

fn two() -> Self

Returns 2

source

fn half() -> Self

Returns .5

source

fn to_f32_bits(self) -> u32

Raw transmutation to u64

Provided Methods§

source

fn square(self) -> Self

Returns \( x^2 \)

Implementations on Foreign Types§

source§

impl FloatNumber for f32

source§

fn copysign(self, sign: Self) -> Self

source§

fn ln_1pe(self) -> f32

source§

fn sigmoid(self) -> f32

source§

fn rand() -> f32

source§

fn two() -> Self

source§

fn half() -> Self

source§

fn to_f32_bits(self) -> u32

source§

impl FloatNumber for f64

source§

fn copysign(self, sign: Self) -> Self

source§

fn ln_1pe(self) -> f64

source§

fn sigmoid(self) -> f64

source§

fn rand() -> f64

source§

fn two() -> Self

source§

fn half() -> Self

source§

fn to_f32_bits(self) -> u32

Implementors§