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

#fmt float broken on Ubuntu Precise #1372

Closed
lht opened this issue Dec 22, 2011 · 3 comments
Closed

#fmt float broken on Ubuntu Precise #1372

lht opened this issue Dec 22, 2011 · 3 comments
Labels
O-linux Operating system: Linux

Comments

@lht
Copy link
Contributor

lht commented Dec 22, 2011

Assert failed on Ubuntu Precise x86_64. Works fine on another Ubuntu 11.04 (i386).

use std;
fn main() {
  std::io::println(#fmt("%f", 5.82));
  assert(#fmt("%f", 5.82) == "5.82");
}
0
rust: upcall fail 'Assertion "" +
    extfmt::rt::conv_float({flags: [extfmt::rt::flag_none],
                            width: extfmt::rt::count_implied,
                            precision: extfmt::rt::count_implied,
                            ty: extfmt::rt::ty_default,}, 5.82) == "5.82" failed', fmtf.rs:4
rust: domain main @0xa02520 root task failed
@kud1ing
Copy link

kud1ing commented Dec 22, 2011

Is "%f" really defined as "%.2f" in Rust?

I am asking because C, Ruby and Python define "%f" as "%.6f".
Their result of sprintf("%f", 5.82) would be "5.820000" not "5.82".

@brson
Copy link
Contributor

brson commented Dec 22, 2011

We should endeavor to do the same thing as glibc's printf. Filed a separate issue for that #1375

@lht
Copy link
Contributor Author

lht commented Dec 30, 2011

This seems have been fixed by 5fd0a3b.

@lht lht closed this as completed Dec 30, 2011
celinval added a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
My latest change to handling panic messages actually broke `unreachable`
macro. The main issue was the wrong position of a parenthesis and the
fact that we didn't have tests that covered that specific case of the
macro.

One thing I haven't figured out yet is how to trigger an error if the
user code uses edition 2021+ and has the following construct:

```rust
let msg = "blah";
panic!(msg);
```

This is actually an error in 2021+, but the macro override that we
perform accepts that no matter the edition.
Kobzol pushed a commit to Kobzol/rust that referenced this issue Dec 30, 2024
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-linux Operating system: Linux
Projects
None yet
Development

No branches or pull requests

3 participants