Python Forum
Adding Decimals to classes with OOP + rounding to significant digits (ATM demo)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding Decimals to classes with OOP + rounding to significant digits (ATM demo)
#4
Read the documentation

https://docs.python.org/3/library/decimal.html

Output:
The context for arithmetic is an environment specifying precision, rounding rules, limits on exponents, flags indicating the results of operations, and trap enablers which determine whether signals are treated as exceptions. Rounding options include ROUND_CEILING, ROUND_DOWN, ROUND_FLOOR, ROUND_HALF_DOWN, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_UP, and ROUND_05UP.
Output:
The usual start to using decimals is importing the module, viewing the current context with getcontext() and, if necessary, setting new values for precision, rounding, or enabled traps:
Reply


Messages In This Thread
RE: Adding Decimals to classes with OOP + rounding to significant digits (ATM demo) - by deanhystad - Apr-29-2022, 02:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python won 't do decimals SomebodySmart 5 1,792 Jun-08-2023, 07:14 PM
Last Post: buran
  Get numpy ceil and floor value for nearest two decimals klllmmm 4 3,374 Jun-07-2023, 07:35 AM
Last Post: paul18fr
  need help rounding joseph202020 7 2,663 Feb-21-2023, 08:13 PM
Last Post: joseph202020
  from numpy array to csv - rounding SchroedingersLion 6 6,120 Nov-14-2022, 09:09 PM
Last Post: deanhystad
  floats 2 decimals rwahdan 3 2,406 Dec-19-2021, 10:30 PM
Last Post: snippsat
  Random data generation sum to 1 by rounding juniorcoder 9 5,510 Oct-20-2021, 03:36 PM
Last Post: deanhystad
  Rounding issue kmll 1 2,179 Oct-08-2021, 10:35 AM
Last Post: Yoriz
  Converting decimals stylingpat 3 3,058 Mar-27-2021, 02:32 PM
Last Post: deanhystad
  Not rounding to desired decimal places? pprod 2 3,264 Mar-05-2021, 11:11 AM
Last Post: pprod
  Decimal Rounding error project_science 4 3,813 Jan-06-2021, 03:14 PM
Last Post: project_science

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020