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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:04:27+00:00 2026-06-18T01:04:27+00:00

The C++11 and C11 standard define the std::isfinite function. Visual Studio 2012 doesn’t seem

  • 0

The C++11 and C11 standard define the
std::isfinite
function. Visual Studio 2012 doesn’t seem to provide it as part of the
cmath or math.h, but has amp_math.h which
seems to provide this function.

Is the isfinite interchangeable with std::isfinite? The
documentation doesn’t talk about the behavior when called with NAN
and I don’t have a VS compiler to test this.

  • 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-18T01:04:28+00:00Added an answer on June 18, 2026 at 1:04 am

    As Marius has already pointed out, the isfinite from amp_math.h is to be used in C++ AMP, which is an MS extension for parallel computing on many-core architectures similar to CUDA or OpenCL. And since this function can only be used in actual AMP restricted functions (usually GPU kernels) it won’t be of much general use for you.

    Unfortunately VS 2012 doesn’t support the C++11 math and floating point control functions. But once you recognize that you are on VC and implement special code for it, you can just use _finite (or rather !_finite) from <float.h>, which is an MS-secific function supported since at least VS 2003. But keep in mind that _finite only takes doubles and thus converts any non-double arguments (though VC doesn’t seem to have a proper long double anyway), with all its implications (while INFs and quiet NaNs should be converted without problem, I’m not sure if the trapping on a signalling NaN in the conversion would also have resulted from a direct call to std::finite).

    VC‘s standard library has other such functions to accomodate for their lack of C++11/C99 support (like _isnan and the like). (Why they refuse to just remove that underscore in front of those functions and put a simple <cfenv> wrapper around _controlfp and thus get a bit nearer to complete C++11 support is a totally different question though.)

    EDIT: Other than that, the straight-forward approach for checking INFs and NaNs might also work:

    template<typename T> bool isfinite(T arg)
    {
        return arg == arg && 
               arg != std::numeric_limits<T>::infinity() &&
               arg != -std::numeric_limits<T>::infinity();
    }
    

    But of course with the same implications of probably trapping for signalling NaNs (though I have to admit I’m not that well-versed in the intricacies of signalling NaNs and floating point exceptions in general).

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

Sidebar

Related Questions

Does the C11 standard (note I don't mean C++11) allow you to declare variables
The other day I was converting a program written with C99 standard into C11.
I just read an article on the C++0x standard: http://www.softwarequalityconnection.com/2011/06/the-biggest-changes-in-c11-and-why-you-should-care/ It said nullptr was
I found the C standard (C99 and C11) vague with respect to character/string code
I came across these two sections in C11 standard referring to the restrict qualifier:
In C11 standard there is following definition of common initial sequence shared by structures
This may be a silly question, but could someone please provide a standard reference
I have read through the C11 standard, section 7.21 where <stdio.h> is described. The
The C and C++ standards support the concept of signal. However, the C11 standard
Anonymous structs have been added in the C11 standard, so typedef struct { struct

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.