A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-April/044448.html below:

[Python-Dev] Re: Decimal data type issues

[Python-Dev] Re: Decimal data type issuesBatista, Facundo FBatista at uniFON.com.ar
Mon Apr 19 16:08:03 EDT 2004
[Jewett, Jim J]
#- Under the current implementation:
#- 
#- 	(0, (2, 4, 0, 0, 0), -4) 
#- 
#- is not quite the same as
#- 
#- 	(0, (2, 4) -1)
#- 
#- Given this, is should be possible for the user to specify 
#- (at creation) which is desired.

It *is* posible:

>>> Decimal('2.4000')
Decimal( (0, (2, 4, 0, 0, 0), -4) )
>>> Decimal('2.4')
Decimal( (0, (2, 4), -1) )
>>>


#- I agree that the programmer should specify if they want 
#- something odd -- and that is precisely why the constructor 
#- should take an optional context argument which allows the 
#- user to specify precision.

If you construct using precision, and the precision is smaller than the
quantity of digits you provide, you'll get rounded, but if the precision is
greater than the quantity of digits you provide, you don't get filled with
zeros.


#- Given that float input may well look like string (saved to a
#- file by another program) or even an integer (C double may have 
#- more precision than C long) there is no particular reason to
#- say "context is only allowed when constructing from a float"

No. Why we should do that? 

.	Facundo

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4