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

  • SEARCH
  • Home
  • 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 7002463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:55:53+00:00 2026-05-27T20:55:53+00:00

How to convert a 32-bit signed fixed-point number (16.16) to a float? Is (fixed

  • 0

How to convert a “32-bit signed fixed-point number (16.16)” to a float?

Is (fixed >> 16) + (fixed & 0xffff) / 65536.0 ok? What about -2.5? And -0.5?

Or is fixed / 65536.0 the right way?

(PS: How does signed fixed-point “-0.5” looks like in memory anyway?)

  • 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-27T20:55:53+00:00Added an answer on May 27, 2026 at 8:55 pm

    I assume two’s complement 32 bit integers and operators working as in C#.

    How to do the conversion?

    fixed / 65536.0
    

    is correct and easy to understand.


    (fixed >> 16) + (fixed & 0xffff) / 65536.0
    

    Is equivalent to the above for positive integers, but slower, and harder to read. You’re basically using the distributive law to separate a single division into two divisions, and write the first one using a bitshift.

    For negative integers fixed & 0xffff doesn’t give you the fractional bits, so it’s not correct for negative numbers.

    Look at the raw integer -1 which should map to -1/65536. This code returns 65535/65536 instead.


    Depending on your compiler it might be faster to do:

    fixed * (1/65536.0)
    

    But I assume most modern compilers already do that optimization.

    How does signed fixed-point “-0.5” looks like in memory anyway?

    Inverting the conversion gives us:

    RoundToInt(float*65536)
    

    Setting float=-0.5 gives us: -32768.

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

Sidebar

Related Questions

I need to convert from fixed point signed Q8 format to fixed point signed
In C++, what's the generic way to convert any floating point value (float) to
I want to convert a hex string to a 32 bit signed integer in
I need a cross-platform library/algorithm that will convert between 32-bit and 16-bit floating point
How to convert the following hex string to float (single precision 32-bit) in Python?
I want to convert a number that is in PRTime format (a 64-bit integer
What is the easiest way to convert and save a 32-bit Bitmap to a
I'm programming in C++. I need to convert a 24-bit signed integer (stored in
PHP does not support unsigned ints. Is there a way to convert a string
I'm looking for pseudocode, or sample code, to convert higher bit ascii characters (like,

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.