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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:04:06+00:00 2026-05-15T20:04:06+00:00

I have a function from an external source that returns an array of 2

  • 0

I have a function from an external source that returns an array of 2 uint16_t elements (which I cast to int).

I have already been able to cast these to one “big” int ((i1 << 16) + i2)

Now I need to be able to cast this to float, keeping the point value as is in memory.

Can anyone suggest a way or point me in the right direction?

Thanks in advance!

  • 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-15T20:04:07+00:00Added an answer on May 15, 2026 at 8:04 pm

    I’d use a union:

    union fltconv {
        float f;
        uint32_t i;
    } u;
    u.i = ((uint32_t) i1 << 16) | i2;
    float f = u.f;
    

    It’s more explicit about what you’re doing. Bear in mind that this is very nonportable.

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

Sidebar

Related Questions

I have a little dropdown menu similar <select> , which contolled from external js-function.
I have a stream of data coming in from an external source which I
I have to insert some data from external source. My php function runs periodically
I have the following code to pull some data from an external source: $(document).ready(function(){
I have a javascript function from which I need to call a controller action
In my Java code I have function that gets file from the client in
i have a static library which (among other things) implements a tiny function that
Compiling FluidSynth 1.1.1 from source. I have unresolved external symbol with glib, using Visual
I have the following function (from the opensource project recast navigation ): /// Derives
I have the following function call from a thread: Thread Move = new Thread(){

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.