Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various improvements to FloatCore #41

Merged
merged 15 commits into from
Mar 1, 2018
Merged
8 changes: 4 additions & 4 deletions src/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1493,8 +1493,8 @@ mod tests {
assert!((FloatCore::to_radians(deg) - rad).abs() < 1e-6);

let (deg, rad) = (deg as f32, rad as f32);
assert!((FloatCore::to_degrees(rad) - deg).abs() < 1e-6);
assert!((FloatCore::to_radians(deg) - rad).abs() < 1e-6);
assert!((FloatCore::to_degrees(rad) - deg).abs() < 1e-5);
assert!((FloatCore::to_radians(deg) - rad).abs() < 1e-5);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I made it forward to std's f32::to_degrees, it started failing on nightly. I suspect rust-lang/rust#47919, which tried to be more accurate, actually made things less accurate for these inputs, but I haven't investigated yet. I will probably file an upstream bug.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}

Expand All @@ -1508,8 +1508,8 @@ mod tests {
assert!((Float::to_radians(deg) - rad).abs() < 1e-6);

let (deg, rad) = (deg as f32, rad as f32);
assert!((Float::to_degrees(rad) - deg).abs() < 1e-6);
assert!((Float::to_radians(deg) - rad).abs() < 1e-6);
assert!((Float::to_degrees(rad) - deg).abs() < 1e-5);
assert!((Float::to_radians(deg) - rad).abs() < 1e-5);
}
}
}