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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:27:32+00:00 2026-05-21T05:27:32+00:00

I have two console apps (msvc 2008). When they have division by zero, they

  • 0

I have two console apps (msvc 2008). When they have division by zero,
they behave differently. My questions are below.

a) In one app, result of division by zero shows as 1.#INF000000000000 as debugger.
Printf “%4.1f” prints it as “1.$”.

b) In another app, result of division by zero 9.2559631349317831e+061 in debugger.
Printf “%4.1f” prints it as “-1.$”.

  1. Why neither app has exception or signal on div by zero ?
    Isn’t exception/signal a default dehavour ?

  2. What are define names for the two constants above ?

  3. Generally, If I check for denominator == 0 before div, then which define value shall I use for dummy result ? DBL_MIN ok ? I found that NaN value is not.

  4. Can I tell stdio how to format one specific double value as char string I tell it? I realize it’s too much to ask. But it would be nice to tell stdio to print, say, “n/a” for vaues DBL_MIN in my app, as example.

  5. How shall I approach, for best portability, division-by-zero and printing it’s results ? By printing, I mean “print number as ‘n/a’ if it’s a result of division by zero”.
    What is not clear here to me, how shall I represent result of div-by-zero in one double, in a portable way.

  6. Why two different results? It is compiler options ?

Compiler is C++, but used very much like C. 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-21T05:27:33+00:00Added an answer on May 21, 2026 at 5:27 am

    When doing floating-point division by zero, the result should be infinity (represented with a special bit pattern).

    My guess is that the second application does not actually perform a division by zero, but rather a division with a really small number. You can check this by inspecting the underlying representation, either in a debugger or by trace output (you can access it by placing it in a union of the floating-point type and an integer of the same size). Note that simply printing it might not reveal this, as the print algorithm sometimes print really small numbers as zero.

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

Sidebar

Related Questions

I have two applications one a console application and the other an ASP.NET app.
I have a python console app. Like most python console apps it uses the
I have two simple console applications to integrate nservicebus. One is a publisher, the
I have two console apps, Query and Update, that share some functionality. I wanted
I have a SQL table that will be accessed by two console apps (.NET).
I have a Django project which has two apps (one created as debug test).
Here is situation: I have two projects. ConsoleApp and Class Library. Console app references
I have two Rails apps, one client using ActiveResource and one service. I am
Confused here... I have two dates which I NSLog to console and get: dates
For example suppose I have the following two functions function a(param1) { console.log(param1); }

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.