Operations and constants for float
NaN
infinity
neg_infinity
of num::Num for float
of num::Zero for float
of num::One for float
abs
atan
cos
from_str
- Convert a string to a floatis_NaN
is_finite
is_infinite
is_negative
is_nonnegative
is_nonpositive
is_positive
is_zero
pow_with_uint
- Section: Arithmetics Compute the exponentiation of an integer by another integer as a floatsin
sqrt
tan
to_str
- Converts a float to a string with a maximum number of significant digitsto_str_common
- Section: String Conversions Converts a float to a stringto_str_exact
- Converts a float to a string with exactly the number of provided significant digitsfloat::consts
NaN
float
infinity
float
neg_infinity
float
num::Num
for float
add
fn add(other: &float) -> float
sub
fn sub(other: &float) -> float
mul
fn mul(other: &float) -> float
div
fn div(other: &float) -> float
modulo
fn modulo(other: &float) -> float
neg
fn neg() -> float
to_int
fn to_int() -> int
from_int
fn from_int(n: int) -> float
num::Zero
for float
zero
fn zero() -> float
num::One
for float
one
fn one() -> float
abs
fn abs(x: float) -> float
atan
fn atan(x: float) -> float
cos
fn cos(x: float) -> float
from_str
fn from_str(num: &str) -> Option<float>
Convert a string to a float
This function accepts strings such as
Leading and trailing whitespace are ignored.
none
if the string did not represent a valid number. Otherwise, Some(n)
where n
is the floating-point number represented by [num]
.
is_NaN
fn is_NaN(x: float) -> bool
is_finite
fn is_finite(x: float) -> bool
is_infinite
fn is_infinite(x: float) -> bool
is_negative
fn is_negative(x: float) -> bool
is_nonnegative
fn is_nonnegative(x: float) -> bool
is_nonpositive
fn is_nonpositive(x: float) -> bool
is_positive
fn is_positive(x: float) -> bool
is_zero
fn is_zero(x: float) -> bool
pow_with_uint
fn pow_with_uint(base: uint, pow: uint) -> float
Section: Arithmetics Compute the exponentiation of an integer by another integer as a float
NaN
if both x
and pow
are 0u
, otherwise x^pow
sin
fn sin(x: float) -> float
sqrt
fn sqrt(x: float) -> float
tan
fn tan(x: float) -> float
to_str
fn to_str(num: float, digits: uint) -> ~str
Converts a float to a string with a maximum number of significant digits
to_str_common
fn to_str_common(num: float, digits: uint, exact: bool) -> ~str
Section: String Conversions Converts a float to a string
to_str_exact
fn to_str_exact(num: float, digits: uint) -> ~str
Converts a float to a string with exactly the number of provided significant digits