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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:10:42+00:00 2026-06-07T11:10:42+00:00

How can I convert SInt16 to double or Float32 to double ? I know

  • 0

How can I convert SInt16 to double or Float32 to double? I know I can convert SInt16 to Float32 like this:

double *buffer;
SInt16* frames;

for (i = 0; i < number_of_frames; i++) {
  Float32 currentFrame = frames[i] / 32768.0f;
}

but I’m using many C functions and I want to pass data to them in double.

Now I use this code:

for (i = 0; i < number_of_frames; i++) {

  Float32 currentFrame = frames[i] / 32768.0f;

  buffer[i] = currentFrame;
}

but I’m not sure the result is correct.

  • 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-07T11:10:44+00:00Added an answer on June 7, 2026 at 11:10 am

    Primitive C types (integers, chars, floating point types) can be inter-converted with casts. So given a signed integer value my_signed_integer, you can convert it to a double with a simple cast:

    ((double) my_signed_integer)
    

    I’m guessing your Sint16 and Float32 are typedefs, so you can still do the same thing:

    ((double) my_SInt16_value) /* Just use this expression as a double
                                  because it IS a double.  */
    

    Eventually, this means:

    for (i=0; i<number_of_frames; i++ )
      {
        buffer[i] = ((double) frames[i]) / 32768.0;
      }
    

    Actually, you don’t need this cast. frames[i] will be automatically converted to double because of an implicit conversion.

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

Sidebar

Related Questions

You can convert a negative number to positive like this: int myInt = System.Math.Abs(-5);
we can convert the dictionary to kw using **kw but if I want kw
Resharper 5 can convert my foreach loops to Linq queries. Which I like. But
I know i can convert JSON to an object using HJackson. Below is the
I know that you can convert a float into a string using NSString *myString
In MSSQL you can convert a string into an integer like this: CONVERT(INT, table.column)
I know I can convert a single file encoding under OSX using: iconv -f
I know I can convert SQL timestamp to unix timestamp, using the following way.
How I can convert .fla to .exe? I know about the built-in tools, but
I know you can convert a datetime to date onmly but what if you

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.