[Renaming] str_to_float is now float::from_str, float_to_str is now float::to_str

This commit is contained in:
David Rajchenbach-Teller 2011-10-12 10:25:39 +02:00
parent 7faed3d87c
commit 8c9dd54ded
4 changed files with 8 additions and 8 deletions

View file

@ -94,7 +94,7 @@ fn time<@T>(do_it: bool, what: str, thunk: fn() -> T) -> T {
let rv = thunk();
let end = std::time::precise_time_s();
log_err #fmt["time: %s took %s s", what,
std::float::float_to_str(end - start, 3u)];
std::float::to_str(end - start, 3u)];
ret rv;
}

View file

@ -1303,8 +1303,8 @@ fn valid_range_bounds(l1: @ast::lit, l2: @ast::lit) -> bool {
alt l1.node {
ast::lit_float(s1) | ast::lit_mach_float(_, s1) {
let s2 = lit_as_float(l2);
let f1 = std::float::str_to_float(s1);
let f2 = std::float::str_to_float(s2);
let f1 = std::float::from_str(s1);
let f2 = std::float::from_str(s2);
ret *util::common::min(f1, f2) == f1
}
ast::lit_uint(_) | ast::lit_char(_) {

View file

@ -156,8 +156,8 @@ fn lit_in_range(l: @ast::lit, m1: @ast::lit, m2: @ast::lit) -> bool {
frange(f1, f2) {
alt l.node {
ast::lit_float(f3) | ast::lit_mach_float(_, f3) {
std::float::str_to_float(f3) >= *min(f1, f2) &&
std::float::str_to_float(f3) <= *max(f1, f2)
std::float::from_str(f3) >= *min(f1, f2) &&
std::float::from_str(f3) <= *max(f1, f2)
}
_ { fail }
}
@ -232,7 +232,7 @@ fn lits_to_range(l: @ast::lit, r: @ast::lit) -> range {
}
ast::lit_float(f1) | ast::lit_mach_float(_, f1) {
alt r.node { ast::lit_float(f2) | ast::lit_mach_float(_, f2) {
frange(std::float::str_to_float(f1), std::float::str_to_float(f2))
frange(std::float::from_str(f1), std::float::from_str(f2))
}
_ { fail } }
}

View file

@ -2,7 +2,7 @@
* String conversions
*/
fn float_to_str(num: float, digits: uint) -> str {
fn to_str(num: float, digits: uint) -> str {
let accum = if num < 0.0 { num = -num; "-" } else { "" };
let trunc = num as uint;
let frac = num - (trunc as float);
@ -36,7 +36,7 @@ fn float_to_str(num: float, digits: uint) -> str {
* @return [NaN] if the string did not represent a valid number.
* @return Otherwise, the floating-point number represented [num].
*/
fn str_to_float(num: str) -> float {
fn from_str(num: str) -> float {
let pos = 0u; //Current byte position in the string.
//Used to walk the string in O(n).
let len = str::byte_len(num); //Length of the string, in bytes.