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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:28:45+00:00 2026-05-12T16:28:45+00:00

What I mean is the following: double d1 = 555; double d2 = 55.343;

  • 0

What I mean is the following:

double d1 = 555;
double d2 = 55.343;

I want to be able to tell that d1 is an integer while d2 is not. Is there an easy way to do it in C/C++?

  • 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-12T16:28:45+00:00Added an answer on May 12, 2026 at 4:28 pm

    Use std::modf:

    double intpart;
    modf(value, &intpart) == 0.0
    

    Don’t convert to int! The number 1.0e+300 is an integer too you know.

    Edit: As Pete Kirkham points out, passing 0 as the second argument is not guaranteed by the standard to work, requiring the use of a dummy variable and, unfortunately, making the code a lot less elegant.

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

Sidebar

Related Questions

What I mean is the following. I want a template function that takes two
Why something like following is not allowed. I mean why the following method will
Possible Duplicate: Could not allocate memory My following code runs fine: double weight [600]
I have encountered the following statement in fortran: integer iparam(11), ipntr(14) logical select(maxncv) Double
Why is it that the following code won't work: endDate.AddDays(7-endDate.DayOfWeek); While this will: endDate.AddDays(0-endDate.DayOfWeek
I'm getting the following message: Double is not supported. Demoting to float I added
What does the colon mean in the following Perl program? MAIN: { print Hello\n;
What does the underscore mean in the following regex? [a-zA-Z0-9_] The _ seems to
What does MYSQL mean in the following code. require_once (MYSQL);
What does the following code mean in Ruby? ||= Does it have any meaning

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.