中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-01 22:05
48,037 topics / 350,122 posts / today 2 new / 48,250 members
DOS开发编程 & 发展交流 (开发室) » How to calculate the square root in assembly language? (Seeking help)
Printable Version  1,650 / 2
Floor1 happyman06 Posted 2006-09-14 21:35
初级用户 Posts 19 Credits 52
Dear experts! I would like to ask, how to calculate the square root in assembly language? It is best to provide the source code! Thanks!
Floor2 zyl910 Posted 2006-09-15 04:18
中级用户 Posts 126 Credits 282
Is it an integer or a floating-point number?

What kind of assembly? Is it x86? Does it have a floating-point coprocessor?

If it has an x87 floating-point coprocessor (CPUs after 486DX integrate a floating-point coprocessor), you can use the floating-point instruction FSQRT.

If there is no floating-point coprocessor, you can only write your own program to calculate the square root using the Newton iteration method.

When the value is not large, array look-up is a very good choice.
Floor3 happyman06 Posted 2006-09-16 12:05
初级用户 Posts 19 Credits 52
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023