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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:35:50+00:00 2026-05-16T10:35:50+00:00

I have done porting of a c++ project with gtest tests to a c#

  • 0

I have done porting of a c++ project with gtest tests to a c# project having an nunit test. Now I encounter problems with floating point precision.

in the nunit test I have being not ok (red)

Assert.AreEqual(0.7, 7 * 0.1); 

in the gtest test I have:

ASSERT_DOUBLE_EQ(0.7, 7 * 0.1);

which is ok (green)

The question now is WHY???

  • 1 1 Answer
  • 3 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-16T10:35:51+00:00Added an answer on May 16, 2026 at 10:35 am

    Alternatively you can add a third parameter, which is the maximum difference between the two values, as you can read here.

    public static void AreEqual (
        double expected,
        double actual,
        double delta
    )
    

    Verifies that two specified doubles
    are equal, or within the specified
    accuracy of each other. The assertion
    fails if they are not within the
    specified accuracy of each other.

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

Sidebar

Related Questions

I have done small project in c++, the IDE I am using is Visual
I have a rather large project I'm porting, and in one of the MANY
I'm having trouble in calculating Eigen Vectors, Values in OpenCV . I have done
I'm new to silverlight and I'm porting from asp.net 2.0. I have done many
Have done quite a bit of searching for a guide (of any substance) for
Have done some research and found some stuff that may be helpful. I would
I have done an email approval script following James Ferreira's youtube tutorial here .
I have done one program that allow user can listen to the music via
I have done some looking and I found this: http://www.codeproject.com/Articles/14439/The-ScrollableListBox-Custom-Control-for-ASP-NET-2 but to me it
I have done strace on my multi-threaded c++ application running on linux after couple

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.