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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:17:49+00:00 2026-05-26T14:17:49+00:00

Hi all I was wondering is there a class in .Net that is used

  • 0

Hi all I was wondering is there a class in .Net that is used to calculate precise numbers with no rounding errors?

For example, this is not what I want:

decimal dividend = Decimal.One;
decimal divisor = 3;
dividend/divisor * divisor // gives us 0.9999999999999999999999999999 instead of 1

I was thinking if there is a number class that buffers operation until when we need to display it, in other words it would look like this:

Num n = new Num(1);
n.DivideBy(3);
n.MultiplyBy(3);
n.toString(); // gives us "1"

Num n2 = new Num(n);
n2.DivideBy(3);
int decimal_places = 8;
n2.RoundHalfUp(decimal_places);
n2.toString(); // gives us "0.33333333"

Of course this is just an example implementation. Basically the main point here is I’m searching for a class that does not have any rounding errors (usually by delaying calculations to the last moment).

I understand that performance would be slower than Double or Decimal. But it doesn’t have to do calculations blindly fast, as long as it is within acceptable time.

  • 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-26T14:17:50+00:00Added an answer on May 26, 2026 at 2:17 pm

    This is a job for rational numbers. No need to delay anything if you’re only doing arithmetic operations (including division).

    If you need to compute arbitrary continuous functions (eg. logarithms, cosines, square roots, etc), it becomes way more involved. Keeping track of the needed digits to ensure requested precision is tricky, but definitely doable, albeit inefficient in practice. The idea is to store along each function another function computing a modulus of continuity (you get what one would call “intuitionistic continuous functions”).

    Note that storing an expression tree doesn’t simplify matters much, since you’ll need to evaluate the resulting (hopefully simpler) expression.

    Another approach would be to store a power series along with a radius of convergence, and compute the sum of the series when requested.

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

Sidebar

Related Questions

I was wondering if there's a way to watch all RoutedEvents that are raised
I was wondering if there was a quick way to get all of an
I am wondering how i can find all rows that have the same ID
I have CruiseControl.NET version 1.4.4.83, and I am wondering if there it provides a
We have a class that holds configuration information for the application. It used to
Hi I was wondering if there is an event for checkboxes that can be
I'm not all that familiar with how garbage collection works and what causes memory
this is the event table that records all the status(IN/OUT): +--------------------------------------------------+-----------------+ | Event_ID |
I have search the net and not found anything that has helped, so thought
I was wondering how to design this best.. On my ASP.NET MVC application I

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.