• palordrolap@fedia.io
    link
    fedilink
    arrow-up
    1
    ·
    3 days ago

    The repeated division trick has a quicker counterpart, which is to create a separate variable and repeatedly multiply that by 10, comparing to the original as it goes. Probably not as fast as anything beyond the repeated division trick, but I mention it because its rediscovery was likely missed by jumping right to clzl tricks.

    It also generalises a lot more readily to numbers in other bases. Kind of a “jack of all trades, master of none” solution.

  • adhocfungus@midwest.social
    link
    fedilink
    arrow-up
    1
    ·
    3 days ago

    Amazing. It’s so weird, I was just needing to do this same operation and was looking into some of the bithacks. Although I don’t have the ability in the language to fully utilize this, I am astounded by how lean you made it.