2

I am trying to implement the Newton-Raphson Division Algorithm Wikipedia entry to implement a IEEE-754 32-bit floating point divide on a processor which has no hardware divide unit.

My memory locations are 32-bit two's complement word and I have already implemented floating point addition, subtraction, and multiplication, so I can reuse the code to implement the Newton-Raphson algorithm. I am trying to first implement this all in Matlab.

At this step: X_0 = 48/17 - 32/17 * D
How do I bitshift D properly to between 0.5 and 1 as described in the algorithm details?

Veridian
  • 3,531
  • 12
  • 46
  • 80

1 Answers1

1

You might look at the compiler-rt runtime library (part of LLVM), which has a liberal license and implements floating-point operations for processors that lack hardware support.

You could also look at libgcc, though I believe that's GPL, which may or may not be an issue for you.

In fact, don't just look at them. Use one of them (or another soft-float library). There's no need to re-invent the wheel.

Stephen Canon
  • 103,815
  • 19
  • 183
  • 269
  • Sometimes an existing implementation may not be suitable. In any case, compiler-rt version does not return a correctly-rounded result when the result is subnormal. – Daniel Nov 04 '19 at 12:15