Skip to content

Commit cb5f641

Browse files
bogglebrson
authored andcommitted
---
yaml --- r: 6464 b: refs/heads/master c: 891528f h: refs/heads/master v: v3
1 parent a26430f commit cb5f641

File tree

6 files changed

+36
-9
lines changed

6 files changed

+36
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 97fc39b214a559d5525199512d81a6e0476c28bc
2+
refs/heads/master: 891528fb7376ddd3cbaf9f77c75807f16c16d77b

trunk/src/lib/math.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
/* Module: math */
1+
/*
2+
3+
Module: math
4+
5+
Floating point operations and constants for `float`s
6+
*/
27

38
export consts;
49
export min, max;
@@ -15,7 +20,7 @@ export
1520

1621
import ctypes::c_float;
1722
import ctypes::c_int;
18-
import c_float = f64;
23+
import c_float = math_f64;
1924

2025
// FIXME replace with redirect to c_float::consts::FOO as soon as it works
2126
mod consts {

trunk/src/lib/f32.rs renamed to trunk/src/lib/math_f32.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2+
/*
3+
Module: math_f32
4+
5+
Floating point operations and constants for `f32`
6+
7+
This exposes the same operations as `math`, just for `f32` even though
8+
they do not show up in the docs right now!
9+
*/
10+
111
import cmath::f32::*;
212

313
export

trunk/src/lib/f64.rs renamed to trunk/src/lib/math_f64.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2+
/*
3+
Module: math_f64
4+
5+
Floating point operations and constants for `f64`s
6+
7+
This exposes the same operations as `math`, just for `f64` even though
8+
they do not show up in the docs right now!
9+
*/
10+
111
import cmath::f64::*;
212

313
export

trunk/src/lib/std.rc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77
#[license = "BSD"];
88

99

10-
export box, char, float, f32, f64, int, str, ptr;
11-
export uint, u8, u32, u64, vec, bool;
10+
export box, char, float, int, str, ptr;
11+
export uint, u8, u32, u64, vec, bool;
1212
export comm, fs, io, net, run, sys, task;
1313
export ctypes, either, option, result, four, tri, util;
1414
export bitv, deque, fun_treemap, list, map, smallintmap, sort, treemap, ufind;
1515
export rope;
16-
export ebml, dbg, getopts, json, math, rand, sha1, term, time, unsafe;
16+
export math, math_f32, math_f64;
17+
export ebml, dbg, getopts, json, rand, sha1, term, time, unsafe;
1718
export extfmt, test, tempfile;
1819
// FIXME: generic_os and os_fs shouldn't be exported
1920
export generic_os, os, os_fs;
@@ -24,8 +25,6 @@ export generic_os, os, os_fs;
2425
mod box;
2526
mod char;
2627
mod float;
27-
mod f32;
28-
mod f64;
2928
mod int;
3029
mod str;
3130
mod ptr;
@@ -82,6 +81,8 @@ mod dbg;
8281
mod getopts;
8382
mod json;
8483
mod math;
84+
mod math_f32;
85+
mod math_f64;
8586
mod rand;
8687
mod sha1;
8788
mod tempfile;

trunk/src/test/stdtest/math.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fn test_max_min() {
2020
fn test_trig() {
2121
assert sin(0.0) == 0.0;
2222
assert sin(-0.0) == 0.0;
23+
2324
assert float::isNaN(sin(float::infinity));
2425
assert float::isNaN(sin(float::neg_infinity));
2526

@@ -259,7 +260,7 @@ fn test_log_functions() {
259260
assert log10(1.0) == 0.0;
260261

261262
// FIXME remove round-up due to valgrind weirdness
262-
assert ceil(ln(consts::e)) /* ln(e) == 0.999.. under valgrind */
263+
assert ceil(ln(consts::e)) == 1.0; /* ln(e) == 0.999.. under valgrind */
263264
assert log2(2.0) == 1.0;
264265
assert log10(10.0) == 1.0;
265266

0 commit comments

Comments
 (0)