Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
601 views
in Technique[技术] by (71.8m points)

matlab - How to implement floating point division in binary with no division hardware and no floating point hardware

I am wondering how to implement IEEE-754 32-bit single precision floating point division in binary with no division hardware and no floating point hardware?

I have shifting hardware, add, subtract, and multiply.

I have already implemented floating point multiplication, addition, and subtraction using 16-bit words.

I am implementing these instructions on a proprietary multicore processor and writing my code in assembly. Beforehand, I am using matlab to verify my algorithm.

I know I need to subtract the exponents, but how do i perform unsigned division on the mantissas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Depends on how complicated you want to make it. Keeping it reasonably simple, you could try division by reciprocal approximation.

Rather than calculating: (n / d) you'd work out: n * (1 / d).

To do this you'd need to work out the reciprocal using some method, for example, Newton-Raphson which uses Newton's method to calculate successively more accurate estimates of the reciprocal of the divisor until it's "adequately" accurate for your purpose before doing the final multiplication step.

EDIT

Just seen your update. This may, or may not, be useful for you after all!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...