Super Fast Square Root
in
Library and Tool Development
•
1 year ago
Ok, so I have a need for a super fast square root function - common enough thing. Math.sqrt just is not fast enough. So I found
this article which lists different ways along with their performance and accuracy. So I'd like to use #14, which it says is 375% faster than the C Math.sqrt, but doing it is a bit beyond me.
It would make a nice little Java library if someone could make a JNI for this code: (Uses inline method for Assembly)
It would make a nice little Java library if someone could make a JNI for this code: (Uses inline method for Assembly)
- double inline __declspec (naked) __fastcall sqrt(double n)
- {
- _asm fld qword ptr [esp+4]
- _asm fsqrt
- _asm ret 8
- }
1