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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:27:44+00:00 2026-05-26T21:27:44+00:00

How come a primitive float value can be -0.0? What does that mean? Can

  • 0

How come a primitive float value can be -0.0? What does that mean?
Can I cancel that feature?

When I have:

  float fl;  

Then fl == -0.0 returns true and so does fl == 0. But when I print it, it prints -0.0.

  • 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-26T21:27:45+00:00Added an answer on May 26, 2026 at 9:27 pm

    Because Java uses the IEEE Standard for Floating-Point Arithmetic (IEEE 754) which defines -0.0 and when it should be used.

    The smallest number representable has no 1 bit in the subnormal significand and is called the positive or negative zero as determined by the sign. It actually represents a rounding to zero of numbers in the range between zero and the smallest representable non-zero number of the same sign, which is why it has a sign, and why its reciprocal +Inf or -Inf also has a sign.

    You can get around your specific problem by adding 0.0

    e.g.

    Double.toString(value + 0.0);
    

    See: Java Floating-Point Number Intricacies

    Operations Involving Negative Zero
    …
    (-0.0) + 0.0 -> 0.0

    –

    “-0.0” is produced when a floating-point operation results in a negative floating-point number so close to 0 that it cannot be represented normally.

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

Sidebar

Related Questions

Come see the amazing disappearing rectangle! But seriously I have a really simple HTML5
Autoboxing seems to come down to the fact that I can write: Integer i
It seems that to skip a member to come on a View you can
Come across what looks at first sight like an MT-issue, but I'm trying to
How come the following doesn't work? CREATE FUNCTION Test (@top integer) RETURNS TABLE AS
I have a multi-byte primitive type called s32 which I want to read from
I have a parameter for a method, that should be a string and I
I come from a Java/Eclipse background and I fear that I am spoiled by
I come from the Ruby world. How do I use the string value of
Help! I have an Axis web service that is being consumed by a C#

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.