PEP proposal for round(x,n) enhancement

-RZ Dick.Zantow at lexisnexis.com
Tue Sep 11 07:34:19 EDT 2001


"Christopher Smith" <csmith at blakeschool.org> wrote in message
news:mailman.1000158613.20155.python-list at python.org...
> Dear List,
[...]
>
> The enhancement that I would like to see is the ability to indicate the
> number of digits counting *from the 1st non-zero digit* that should be
> reported.  These digits are often called the significant digits.  Both
> 12345 and 1.2345 when rounded to the 3rd significant digit are 12300
> and 1.23 but instead of having to inspect the numbers to figure out
> what digit to round them to, an argument that would be interpreted as
> "the 3rd digit counting from the first non-zero digit" would do the job
> instead.
>

I'm curious to know what problem domain this is addressing. And given
the floating point representation issues, how exactly does one determine
the first non-zero digit?





More information about the Python-list mailing list