Skip to content

Conversation

@boggle
Copy link
Contributor

@boggle boggle commented Nov 24, 2011

I rewrote math.rs. Now has support for f32, f64, and float and covers C95 completely, C99 can be added later.

This still needs testing on win32, to which I don't have access.

@brson
Copy link
Contributor

brson commented Nov 24, 2011

A number of results are different under windows (e.g. pow(-1, -inf) = 1 on linux and nan on windows), because the underlying c functions give different results. I guess we should just use the results that the platform gives. If that sounds ok to you then I will adjust the tests accordingly.

@boggle
Copy link
Contributor Author

boggle commented Nov 25, 2011

Hm, I feared that might happend. Guess for now it's ok to proceed as you propose; please just comment out the asserts that break on win32 so that we later either may fix this from rust or at least document the behavior as undefined.

This is an intermediary step. There is room for improvement (C99, more elegant imports than the current duplication of constants etc.) I think math should just merge into float, and math_f32, math_f64 into f32, f64 accordingly, later.

I wonder if the runtime should include its own math functions to avoid such floating point woes in the long run. Any thougts on this?

@brson
Copy link
Contributor

brson commented Nov 25, 2011

I pulled this and opened #1222. My weak preference is for them to behave the same on all platforms.

@brson brson closed this Nov 25, 2011
bjorn3 added a commit to bjorn3/rust that referenced this pull request Mar 20, 2022
coastalwhite pushed a commit to coastalwhite/rust that referenced this pull request Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants