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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:56:40+00:00 2026-05-18T19:56:40+00:00

Is there any way to set up Visual Studio (just upgraded from 2008 to

  • 0

Is there any way to set up Visual Studio (just upgraded from 2008 to 2010) to break, as if an assertion failed, whenever any floating point number becomes NaN, QNAN, INF, etc?

Up until now I have just been using the assert(x == x) trick, but I would rather something implicit, so that I dont have to add assertions everywhere.

Quite surprised I can’t find an answer to this via google. Some stuff about ‘floating point exceptions’, but I’m not sure if they are the same thing, and I’ve tried enabling them in Visual Studio, but the program doesn’t break until something catastrophic happens because of the NaN later on in execution.

  • 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-18T19:56:41+00:00Added an answer on May 18, 2026 at 7:56 pm

    1) Go to project option and enable /fp:strict (C/C++ -> Code Generation -> Floating Pint Model).

    2) Use _controlfp to set the floating-point control word (see code below).

    #include <float.h>
    unsigned int fp_control_state = _controlfp(_EM_INEXACT, _MCW_EM);
    
    #include <math.h>
    
    int main () {
    
        sqrtf(-1.0);    // floating point exception
    
        double x = 0.0;
        double y = 1.0/x;   // floating point exception
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to tell Visual Studio 2010 to enable syntax highlighting for
Is there any way to select a subset from a large set based on
Is there any way to set the same icon to all my forms without
Is there any way how to set std::setw manipulator (or its function width )
Is there any way to automatically rename accessor/mutator when a variable they get/set gets
Is there any way I can detect when my page has been set as
Is there currently any easy way to set up a YAWS web server in
Having the hours and minutes, is there any easier or better way to set
Is there any way to capture the MouseDown even from the .NET 2.0 TextBox
Is there any way to check whether a file is locked without using a

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.