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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:38:58+00:00 2026-05-19T04:38:58+00:00

If a float is repeatedly multiplied by a number that is less than one,

  • 0

If a float is repeatedly multiplied by a number that is less than one, is it plausible that the the float could become zero?

Here is an example:

float number = 1.0f;

for ( int i = 0; i < ONE_BILLION; ++i )
{
    number *= 0.01f;
}

But please don’t limit your answer to the example.

Thanks!

  • 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-19T04:38:59+00:00Added an answer on May 19, 2026 at 4:38 am

    Yes, when the result of the multiplication would be smaller than the representable number closest to zero, it will become zero. With IEEE floating point, this will happen for any multiplier less than or equal to 0.5f (but greater than zero); however, if the multiplier is even slightly larger than 0.5f (for instance, 0.5f + FLT_EPSILON) the result will converge to the smallest representable positive number and stay there forever. Compare the behavior of this program with and without -DGREATER:

    #include <stdio.h>
    #include <float.h>
    #ifdef GREATER
    #define MULTIPLIER (0.5f + FLT_EPSILON)
    #else
    #define MULTIPLIER 0.5f
    #endif
    int
    main(void)
    {
      float x = 1.0f;
      unsigned int count = 0;
      while (x > 0.0f && count < 200)
      {
        x *= MULTIPLIER;
        printf("%g %a\n", x, x);
        count++;
      }
      return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this situation: { float foo[10]; for (int i = 0; i <
try it out: volatile float bob = -344.0f; unsigned int fred = (unsigned int)bob;
Let's I have struct Vector { float i,j,k; } I want to zero all
float minTime[7]={FLT_MAX}; for(int i=0;i<7;i++) cout << Min: << minTime[i] << endl; Why do I
public float sum(Object ob) { float sum = 0; for (int i = 0;
float('nan') represents NaN (not a number). But how do I check for it?
I have a CUDA program that calls the kernel repeatedly within a for loop.
I just had Apple's C/C++ compiler initialize a float to a non-zero value (approx
float [] pt1x = {0.580f, 0.680f, 0.780f}; float [] pt1y = {1.128f, 1.228f, 1.328f};
I'm retrieving a float value from a mysql database on a php page (2.5,

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.