News for hackers. Stuff that matters.
Re:Did any processor implement an integer square root instru... by maxcoder4 on Sunday April 07, 2024 @09:03AM (#39960485)
Can you explain your idea? Your algorithm is correct by definition, but doing this naively would be very slow (even for 32bit number). At this point it would be much faster to just binsearch it.
Re:Did any processor implement an integer square root instru... by __s on Sunday April 07, 2024 @09:46AM (#39960744)
For an example of binsearch algo, I recently dipped into this while switching some code from floats to fixed point arithmetic (reducing overall wasm blob size)

https://github.com/serprex/openEtG/blob/2011007dec2616d1a24d...

Tho I could probably save binary size more by importing Math.sqrt from JS

Re:Did any processor implement an integer square root instru... by smcameron on Sunday April 07, 2024 @03:26PM (#39963103)
Recently, I had reason to dig around for a fixed point square root algorithm and found this: https://groups.google.com/g/comp.lang.c/c/IpwKbw0MAxw/m/N1xh...