pub trait Float: Signed {
Show 22 associated constants and 10 methods
const PI: Self;
const PI_OVER_2: Self;
const PI_OVER_4: Self;
const TAU: Self;
const SQRT_2: Self;
const ONE_OVER_SQRT_2: Self;
const NEG_ONE_OVER_SQRT_2: Self;
const NEG_SQRT_2: Self;
const EIGHTH: Self;
const QUARTER: Self;
const HALF: Self;
const NUM_30: Self;
const NUM_45: Self;
const NUM_60: Self;
const NUM_90: Self;
const NUM_120: Self;
const NUM_135: Self;
const NUM_180: Self;
const NUM_240: Self;
const NUM_255: Self;
const NUM_300: Self;
const NUM_360: Self;
// Required methods
fn round(x: Self) -> Self;
fn floor(x: Self) -> Self;
fn ceil(x: Self) -> Self;
fn sqrt(x: Self) -> Self;
fn to_radians(x: Self) -> Self;
fn to_degrees(x: Self) -> Self;
fn atan2(y: Self, x: Self) -> Self;
fn sin_cos(x: Self) -> (Self, Self);
fn trunc(x: Self) -> Self;
fn exp(x: Self) -> Self;
}Expand description
A primitive floating point number type.
Required Associated Constants§
const PI: Self
const PI_OVER_2: Self
const PI_OVER_4: Self
const TAU: Self
const SQRT_2: Self
const ONE_OVER_SQRT_2: Self
const NEG_ONE_OVER_SQRT_2: Self
const NEG_SQRT_2: Self
const EIGHTH: Self
const QUARTER: Self
const HALF: Self
const NUM_30: Self
const NUM_45: Self
const NUM_60: Self
const NUM_90: Self
const NUM_120: Self
const NUM_135: Self
const NUM_180: Self
const NUM_240: Self
const NUM_255: Self
const NUM_300: Self
const NUM_360: Self
Required Methods§
Sourcefn to_radians(x: Self) -> Self
fn to_radians(x: Self) -> Self
Convert from degrees to radians.
Sourcefn to_degrees(x: Self) -> Self
fn to_degrees(x: Self) -> Self
Convert from radians to degrees.
Sourcefn atan2(y: Self, x: Self) -> Self
fn atan2(y: Self, x: Self) -> Self
Computes the four quadrant arctangent of y and x in radians.
Sourcefn sin_cos(x: Self) -> (Self, Self)
fn sin_cos(x: Self) -> (Self, Self)
Simultaneously computes the sine and cosine of the number, x.
Returns (sin(x), cos(x)).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.