Hacker News new | past | comments | ask | show | jobs | submit login
Converting Integers to Floats Using Hyperfocus (m-ou.se)
93 points by pingiun on May 11, 2022 | hide | past | favorite | 9 comments



Years ago, I've helped giving Rust support for 128 bit integers as one of my first big contributions to rustc. As part of that work, I ported some of the routines concerning 128 bit numbers from C to Rust. That language conversion alone made the implementation more portable, as clang doesn't support 128 bit numbers on all targets. On the flip side, this led to the occasional LLVM bug/limitation being hit because backends are usually written with C in mind, and sometimes even the authors of the backends struggle because the 128 bit routines are a stress test for the register allocator. Another resolved issue is that u128::MAX is not representable as f32, and thus the cast was UB: https://github.com/rust-lang/rust/issues/41799.

The routines have been rewritten/refactored multiple times since, and I had zero involvement in the LLVM work, but I'm still amazed that I was able to hack on code as fundamental as this and being part of shipping a new width for numbers in a "big" language (certainly big now).


In addition to being interesting to techies, this is a really well-written article, e.g.

> Everyone was slightly disgusted and slightly impressed.

Went back and reread the whole article to find more gems like that one.


I agree, came here just to say this! A lot of writing coming from the "very-online-twitter-person" types is, well, insufferable to put it mildly, filled with inappropriate jokes(or worse, random images or embedded tweets) distracting from the technical content, but this is far more tasteful and enjoyable to read, on top of being technically interesting.


I don't really know what this is decrying, but this was very well written.


Agreed, really easy to read, yet so we'll explained on the issues, nice light style with just the right amount of humour. Really liked it.


Very engaging writing style -- sprinkled in just the right amount of jokes to keep the reader engaged, without going overboard.


Nice! Can this somehow be brought back into rustc?



Draft status for two years.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: