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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:47:09+00:00 2026-06-15T07:47:09+00:00

I just wanted some information about this. float n = 2.99944323200023f What does the

  • 0

I just wanted some information about this.

float n = 2.99944323200023f

What does the f at the end of the literal do? What is it called? Why is it used?

  • 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-15T07:47:10+00:00Added an answer on June 15, 2026 at 7:47 am

    The f indicates it’s a floating point literal, not a double literal (which it would implicitly be otherwise.) It hasn’t got a particular technical name that I know of – I tend to call it the “letter suffix” if I need to refer to it specifically, though that’s somewhat arbitrary!

    For instance:

    float f = 3.14f; //Compiles
    float f = 3.14;   //Doesn't compile, because you're trying to put a double literal in a float without a cast.
    

    You could of course do:

    float f = (float)3.14;
    

    …which accomplishes near enough the same thing, but the F is a neater, more concise way of showing it.

    Why was double chosen as the default rather than float? Well, these days the memory requirements of a double over a float aren’t an issue in 99% of cases, and the extra accuracy they provide is beneficial in a lot of cases – so you could argue that’s the sensible default.

    Note that you can explicitly show a decimal literal as a double by putting a d at the end also:

    double d = 3.14d;
    

    …but because it’s a double value anyway, this has no effect. Some people might argue for it advocating it’s clearer what literal type you mean, but personally I think it just clutters code (unless perhaps you have a lot of float literals hanging around and you want to emphasise that this literal is indeed meant to be a double, and the omission of the f isn’t just a bug.)

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

Sidebar

Related Questions

This is going to be a quick discussion, but I just wanted some feedback
I just wanted some input about my use of JSON. <?php header('Content-Type: text/plain'); //results
I just wanted to hear some opinions about what i am going to do.
I would like to learn ASP.NET and just wanted some input as to which
I know the topic I started is too subjective. But I just wanted some
Just wanted to write some recursion but can't check if the child is in
I am just playing around with some java programming and so I wanted a
I'm just getting started with LINQ, and I'm having some troubles. Say I wanted
Just wanted to ask you about the drawbacks (I mean memory or reponse time)
I tried to just send some information to a php file using Jquery Ajax.

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.