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 7559511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:39:27+00:00 2026-05-30T12:39:27+00:00

Im working on a project and I need to output floating point values using

  • 0

I”m working on a project and I need to output floating point values using printf from C.

I’m able to print out the values right now, but I’m not really sure how the printing is taking place.

For printing int values, I just push the data type and location and it prints fine.

But for float its a whole different story.

Here is code for printing floats

mov qword rdi, float_format                          
push qword 0                                         
push r14                                            
movsd xmm0, [rsp]                                    
mov qword rax, 1                                     
call printf                                          
pop rax                                               
pop rax

That will effectly print out a value that was inputed from the keyboard. However, when I manipulate the number with float commands like fadd or fdiv, in order to print out, prior to calling the print float function I have to mov 1, rax

Ideas? To make it simpler? Or explanation as to why I”m using xmm0?

  • 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-05-30T12:39:28+00:00Added an answer on May 30, 2026 at 12:39 pm

    You need to know the calling conventions in use. Linux on AMD64 uses the System V AMD64 ABI. From that document we learn that:

    • integer arguments are passed in rdi, rsi, rdx, rcx, r8 and r9
    • floats are passed in xmm0 to xmm7
    • for varargs functions the number of SSE registers used is put in rax

    So for the call

    printf (format, float_value)
    

    you have rdi=format, xmm0=float_value and rax=1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a project where users need to be able to
Hey Guys...need help. Working on a project and get this error on the Output
I'm working on a project right now that required me to use a CMS
i'm working in a project where i need to read some values and send
Im working on a java project where i need to read some objects from
i am working on a project that need to upload files from iphone to
As part of a small project I'm working on, I need to be able
I am working a project where I need to generate a series of classes
I'm working on a project were we need more performance. Over time we've continued
I'm working on a project where I need the following. WCF service on the

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.