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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:04:17+00:00 2026-05-29T10:04:17+00:00

Mixing various Frameworks and Libraries I often see code like this float floatValue =

  • 0

Mixing various Frameworks and Libraries I often see code like this

float floatValue = 0.5f;
float returnValue = 0.0f;

returnValue = (float)[object someMethod:(double)floatValue]; //returns double

Is there any overhead in casting back-and-forth between double and float?

I’m mainly interested in objective-c and the llvm compiler but would happy up vote answers for other languages and compilers.

  • 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-29T10:04:18+00:00Added an answer on May 29, 2026 at 10:04 am

    Casting between float and double is a single conversion instruction in either direction on both ARM and x86. There are some cases in which the compiler is able to eliminate these conversions (when it can prove that they would not effect the result of the computation), but that will not be the case in examples like those you listed.

    So, there is a small amount of overhead. A few extra casts at high-level interface boundaries won’t have a noticeable effect. However, you don’t want to convert every value in a tight loop if you can avoid it.

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

Sidebar

Related Questions

I would like to create a class that effectively does this (mixing a little
We like mixing SVG code with JQuery templates. When we save SVG graphics from
I'm having a problem with mixing managed and unmanaged code. I have created two
I am mixing some C and C++ libraries and have only a single pointer
I might be mixing apples and oranges in this question since I'm noob in
Several questions on this website reveal pitfalls when mixing signed and unsigned types and
I know this sounds strange, mixing CDI (Weld) and Spring for the controller. But
Bad idea mixing HTML and PHP? I was reading this tutorial and it seems
I have trouble mixing the C and C++ code , I separately compile the
Im trying to create a mixing for Ext.grid.Panel components. This is how I have

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.