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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:09:20+00:00 2026-06-03T21:09:20+00:00

I am aware that suffixing a floating point number with f lets the compiler

  • 0

I am aware that suffixing a floating point number with f lets the compiler know that it is a float rather than a double. Which is important to prevent unnecessary casting when operating on floats rather than doubles. However in some code I have been provided by an external company I have seen the following for example:

double i = 1.4f;

Now what I’m wondering is what happens in this case? Will the compiler silently ignore the ‘f’ and it is just something that has no bearing on anything and I can safely ignore?

I then wondered that if numbers are assigned to doubles with an f suffix elsewhere, not just on initialisation would that be a different case that acts differently?

  • 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-03T21:09:22+00:00Added an answer on June 3, 2026 at 9:09 pm

    Relevant quotes from the C standard:

    §6.4.4.2 paragraph 4

    If suffixed by the letter f or F, it has type float.

    paragraph 5

    Floating constants are converted to internal format as if at translation-time.

    paragraph 7

    The translation-time conversion of floating constants should match the execution-time conversion of character strings by library functions, such as strtod, given matching inputs suitable for both conversions, the same result format, and default execution-time rounding.

    Assuming IEEE-754 numerics 1.4f produces the value:

    1.39999997615814208984375
    

    whereas 1.4 has the value:

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

Sidebar

Related Questions

I'm aware that you can set the compiler flag -fno-objc-arc to disable Automatic Reference
I am aware that ActiveRecord provides a to_json method which allows fields to be
I'm aware that is a rather difficult question to answer, mainly because there's so
I am aware that this is a more subjective question than is preferred, but
I am aware that iOS 4.3 has a new API that lets developers send
I am aware that you can use .val() to change which options are selected
I'm well aware that a Double has only so many bits of precision, but
I aware that this will be a less programming question, but still... How can
I am aware that I can access all external links on a page using
Now I am aware that I probably need to use a ListBox and can

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.