There’s nothing particularly magic about it, it’s just a solution to an optimization problem. For Float32
you can do an exhaustive search, for more bits you can get a good enough solution with a coarse search and interval halving refinement.
But Oscar is right, there’s little point in doing this for MultiFloats
. And if you insist that you need a really coarse approximation for your high precision number, just cast your input to Float32
, do your thing, cast it back to MultiFloat
and call it a day.