[HN Gopher] Converting Integers to Floats Using Hyperfocus
       ___________________________________________________________________
        
       Converting Integers to Floats Using Hyperfocus
        
       Author : pingiun
       Score  : 59 points
       Date   : 2022-05-10 11:46 UTC (1 days ago)
        
 (HTM) web link (blog.m-ou.se)
 (TXT) w3m dump (blog.m-ou.se)
        
       | rpmuller wrote:
       | 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.
        
         | arc-in-space wrote:
         | 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.
        
       | a_t48 wrote:
       | Nice! Can this somehow be brought back into rustc?
        
         | zokier wrote:
         | yes https://github.com/rust-lang/compiler-builtins/pull/370
        
           | jiggawatts wrote:
           | Draft status for two years.
        
       | est31 wrote:
       | 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).
        
       ___________________________________________________________________
       (page generated 2022-05-11 23:00 UTC)