How to use Floating Point Multiplication Algorithm?

Posted on 2004-11-28
Last Modified: 2009-12-16
I need some help on a program using Floating Point Multiplication and I am fairly new to spim assembly language.   Using two signed numbers how do you multiply them using the floating point multiplication algorithm?  I know there is the mul instruction however, I wanted to know how this process actualyl works.
Question by:elberath
    1 Comment
    LVL 7

    Accepted Solution

    The mul instruction only works on integer values. To do floating-point arithmetic, you will have to utilize the FPU, or one of its successors (MMX, SSE, SSE2, SSE3). Here is some simple code:

    num1    dd    1.5
    num2    dd    2.5
    num3    dd    0

    fld    num1    ;load 1.5 into the FPU stack
    fmul    num2    ;multiply and replace the top of the stack by 2.5
    fstp    num3    ;pop the stack, storing the top value of 1.5 x 2.5 in num3

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    core dump analysis 26 2,565
    Localization and Internationalization 17 349
    Buffer bomb nitro 1 4,259
    Bufbomb Phase 2: Firecracker 13 8,813
    OfficeMate Freezes on login or does not load after login credentials are input.
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now