Issue
I understand the value of exponents, but typically when displaying decimal values to an end user, it's easier for the layman to understand normal decimal values. When I perform the following, I'd rather the display value of the decimal be 50
, instead of:
>>> Decimal('22679.6185') / Decimal('28.349523125') / 16
Decimal('5E+1')
Is this possible without quantizing or doing anything to modify the actual value? Also, why does it display a short value like this as an exponent and some longer values in their normal decimal form? Is this a product of division (irony intended)?
Solution
See: Significant figures in the decimal module (which admittedly tells you to use .quantize()). The main problem is that you must keep track of the number of significant digits manually.
Answered By - torek Answer Checked By - Mildred Charles (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.