fuel-vm icon indicating copy to clipboard operation
fuel-vm copied to clipboard

Add nth root support for u256 and u128 types

Open xgreenx opened this issue 1 year ago • 2 comments

https://github.com/FuelLabs/fuel-vm/blob/9478991db1ea8799fab47ebe1c195946a2698a7f/fuel-vm/src/interpreter/executors/instruction.rs#L248-L304

We already implement this for u64, but are missing it for the other types

xgreenx avatar Oct 24 '24 18:10 xgreenx

This is really hard to do, as the floating point approximation method used in the u64 implementation cannot be used with wider types. We could do binary search using rougher guesses, or even attempt Newton's method. But those have high upper bound costs.

Dentosal avatar Feb 24 '25 16:02 Dentosal

It sounds like Mira is already trying to come up with a solution for this. If our users need this feature, we might as well provide a native way of doing it. It might be expensive, but still less expensive than implementing it using the VM.

MitchTurner avatar Mar 27 '25 16:03 MitchTurner