Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8349875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:08:19+00:00 2026-06-09T08:08:19+00:00

I am trying to experiment with inline assembly, and I am trying to add

  • 0

I am trying to experiment with inline assembly, and I am trying to add decimal numbers (no, NOT integers) in inline assembly. Issue is, when I call the following function:

inline double ADD(double num1, double num2) {
  double res;
_asm{

    push eax; push the former state of eax onto stack
    mov eax, num1;
    add eax, num2;
    mov res, eax;
    pop eax; restore the former state of eax now that we are done   
     }  return res;}

The compiler complains of improper operand size at the inline assembly (ALL lines of assembly excluding the push and pop instruction lines). So I have to change to an integer type, such as unsigned long, and then it works, but of course only supports integer types; decimal results are rounded.

Is there any way to add in assembly that allows for decimal results like 8.4?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:08:21+00:00Added an answer on June 9, 2026 at 8:08 am

    I haven’t done x87 assembly in a decade, but it should be something like:

    fld num1   ; load num1 and push it onto the fpu stack
    fld num2   ; load num2 and push it onto the fpu stack
    faddp      ; pop two numbers, add them, push sum on the stack
    fstp res   ; pop sum from the stack and store it in res
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I only started to experiment with JNA, and stuck trying to call this function
i am trying to experiment with the tumblr api . i tried $(function() {
I'm trying to experiment with cocos2d by building a simple card game. I'm not
As an experiment, I am trying to make a void member function with no
I'm trying to experiment with malloc and free in assembly code (NASM, 64 bit).
As an experiment i am trying to write the following program which allows me
I am trying to experiment this parameter in MapReduce and I have some question.
As an experiment I'm trying to write a generic MVP framework. I started with:
So I'm trying to input blog comments into a database for an NLP experiment
I'm trying to accomplish what's being demonstrated at this site for an experiment I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.