Python Forum
shouldn't this raise an exception?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
shouldn't this raise an exception?
#1
shouldn't this raise some kind of exception, like a Decimal.UNDERFLOW or something like that, new?
lt2a/phil /home/phil 10> python3
Python 3.6.9 (default, Jan 26 2021, 15:33:00) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import *
>>> getcontext()
Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999, capitals=1, clamp=0, flags=[], traps=[InvalidOperation, DivisionByZero, Overflow])
>>> Decimal('1E999999')*Decimal('1E99')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
decimal.Overflow: [<class 'decimal.Overflow'>]
>>> Decimal('1E-999999')*Decimal('1E-99')
Decimal('0E-1000026')
>>> Decimal('1E-1000026')
Decimal('1E-1000026')
>>> 
it does not appear to be a representation issue, so i assume it is an operation issue.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
shouldn't this raise an exception? - by Skaperen - Dec-07-2021, 07:52 PM
RE: shouldn't this raise an exception? - by casevh - Dec-08-2021, 05:01 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  arg and keyword arg conflict: what to raise Skaperen 5 2,915 Jun-22-2020, 12:43 AM
Last Post: Skaperen
  Python 3.701b released yesterday--who should install it and who shouldn't? league55 7 4,661 Feb-02-2018, 08:11 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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