After all that IEEE-754 stuff, I had to do something with it. Because
there was something I wanted to do for a long time - if just to honor
the programmers that came up with it:
: finvsqrt ( f -- 1/sqrt f)
fdup f>ieee-sf 2/ negate 1597463007 + ieee-sf>f
fswap f2/ fover fdup f* f* fnegate 3 s>f f2/ f+ f*
;
16 s>f finvsqrt f. cr depth . fdepth .
And it does this:
$ pp4th -x zenisqrt.4th
0.249576787396195506538282980998661071
0 0
:-)
Hans Bezemer
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,124 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 22:09:12 |
| Calls: | 14,392 |
| Calls today: | 1 |
| Files: | 186,389 |
| D/L today: |
3,198 files (781M bytes) |
| Messages: | 2,544,913 |
| Posted today: | 1 |