如何在MIPS Assembly中计算二次方程的根?
我真的对这个问题的想法很困惑,以前有没有人经历过类似的事情来为我提供解决方案?
编写一个MIPS汇编语言程序来求解一个二次方程:a(x^2)+b(x)+c= 0。
要求用户输入系数a、b和c,该系数应该是双精度浮点数-点数。计算并显示二次方程的根,它也应该是双精度数字。处理所有情况,包括复杂根的情况。
真的很感谢你的帮助。
I'm really stucked with the idea of this question, has anyone experiences something similar before to provide me the solution ?
Write a MIPS assembly language program to solve a quadratic equation: a(x^2)+b(x)+c= 0.
Ask the user to enter the coefficients a, b, and c, which should be double-precision floating-point numbers. Calculate and display the roots of the quadratic equation, which should also be double-precision numbers. Handle all cases, including the case of complex roots.
really thankful for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议查找一些求解二次方程的算法(用任何计算机语言),然后一旦你脑子里有了一个好的算法,就用汇编语言对其进行编程。
一次只处理程序的一小部分。例如,首先让用户输入正常工作。然后研究通用算法。然后处理极端情况。等等。请记住,如果事情变得太复杂,也许您需要添加另一层抽象(如果在汇编中可能的话......)。
我故意不说得更具体,因为我不想为你做作业。 :)
I would suggest looking up some algorithms for solving quadratic equations (in any computer language), and then once you have a good algorithm in your head, program it in assembly.
Work on one small piece of the program at a time. For example, get the user input working first. Then work on the general algorithm. Then work on corner cases. Etc. Remember, if things get too complex, maybe you need to add another layer of abstraction (if that's possible in assembly...).
I'm intentionally not getting specific because I don't want to do your homework for you. :)