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

  • Home
  • SEARCH
  • 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 975973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:40:25+00:00 2026-05-16T03:40:25+00:00

Here is an example to explain what I’m on about: c = Decimal(10) /

  • 0

Here is an example to explain what I’m on about:

c = Decimal(10) / Decimal(3)
c = Decimal(10) / Decimal(2)

If I do this, then print c, the inexact and rounded flags are raised. Even though the result is accurate. Shouldn’t flags therefore be attributes of numbers rather than the context? This problem is especially apparent when I program lengthy calculation using a stack.

To pose a more meaningful question: How do I properly deal with this?
It seems I have to keep track of everything manually. If I clear flags before calculations, I would lose some informations about numbers calculated before. Which may now appear accurate. This is especially annoying when working with numbers like 1.0000000154342.

For a critical application, it would be really nice to be sure about what is accurate and what isn’t. It would also be nice to not have the wrong flags raised, just because it looks bad.

It still assume there is a good rationale behind this, which I haven’t understood. I’d be thankful for an explanation.

  • 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-16T03:40:26+00:00Added an answer on May 16, 2026 at 3:40 am

    Read this: http://docs.python.org/library/decimal.html#context-objects

    You have context objects that you can save and restore so that you don’t lose flag values.

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

Sidebar

Related Questions

This is kind of hard to explain. Here's an example of my HTML: <div
Before I explain, here's the example HTML code : [ Demo on jsFiddle here.
The fictional example here. Suppose I designed a class named IODevice. This class already
This is quite difficult to explain, but here goes. I have a Rails app
Here's a problem that is kinda hard to explain. So here's an example. Let's
Here is an example: I write html code inside of textarea, then I swap
Newbie technical difficulty here. Hope I can explain this clearly. in My DB, I
I have this problem with CSS round corners. The link to example is here:
Here is an example of the type of article I'm talking about: http://support.microsoft.com/kb/319401 I
All I am using my SOAP API using java script. this example explain how

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.