Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Theoretically, you could also take advantage of two's complement arithmetic:

       00011011 (27)
     x 01010101 (-0.333...)
    ------------------------
       11110111 (-9)
    
    invert and add one:
    
       00001001 (9, like we wanted)
I'd be interested in extending this to non-exact multiples, but if that's possible I don't know how.


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: