Re: Engineering numerical format PEP discussion

2010-05-17 Thread Eike Welk
Keith wrote: I am considering writing a PEP for the inclusion of an engineering format specifier, and would appreciate input from others. I think it's a good idea. I regularly type numbers into my pocket calculator just to do this conversion. Eike. --

Re: Engineering numerical format PEP discussion

2010-04-27 Thread Lie Ryan
On 04/27/10 10:36, Keith wrote: I think it's worth making the print statement (or print function, as the case may be) let us do engineering notation, just like it lets us specify scientific notation. The print statement/function does no magic at all in specifying how numbers look like when.

Re: Engineering numerical format PEP discussion

2010-04-27 Thread Lie Ryan
On 04/27/10 10:47, MRAB wrote: Mark Dickinson wrote: On Apr 26, 4:36 am, Keith keith.braff...@gmail.com wrote: I am considering writing a PEP for the inclusion of an engineering format specifier, and would appreciate input from others. [...] I am thinking that if we simply added something

Re: Engineering numerical format PEP discussion

2010-04-27 Thread Gregory Ewing
Keith wrote: I kinda like m for the whole Greco- Roman angle, now that you point it out :-) I like m, too. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Engineering numerical format PEP discussion

2010-04-27 Thread Mark Dickinson
On Apr 27, 2:16 am, Keith keith.braff...@gmail.com wrote: On Apr 26, 8:47 pm, MRAB pyt...@mrabarnett.plus.com wrote: t for powers of a thousand, perhaps? (Or m?) Both of those letters are fine.  I kinda like m for the whole Greco- Roman angle, now that you point it out :-) By the way,

Re: Engineering numerical format PEP discussion

2010-04-27 Thread cassiope
On Apr 25, 10:19 pm, Chris Rebert c...@rebertia.com wrote: On Sun, Apr 25, 2010 at 9:42 PM, Keith keith.braff...@gmail.com wrote: On Apr 26, 12:02 am, Chris Rebert c...@rebertia.com wrote: On Sun, Apr 25, 2010 at 8:36 PM, Keith keith.braff...@gmail.com wrote: I am considering writing a PEP

Re: Engineering numerical format PEP discussion

2010-04-27 Thread Keith
On Apr 27, 9:03 am, Mark Dickinson dicki...@gmail.com wrote: On Apr 27, 2:16 am, Keith keith.braff...@gmail.com wrote: On Apr 26, 8:47 pm, MRAB pyt...@mrabarnett.plus.com wrote: t for powers of a thousand, perhaps? (Or m?) Both of those letters are fine.  I kinda like m for the whole

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Terry Reedy
On 4/25/2010 11:36 PM, Keith wrote: I am considering writing a PEP for the inclusion of an engineering format specifier, and would appreciate input from others. I tested that input is no problem, so the only question is output. Do you think this idea has enough merit to make it to PEP

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Stefan Krah
Chris Rebert c...@rebertia.com wrote: c = decimal.Context(prec=5) decimal.Decimal(1234567).to_eng_string(c) '1234567' That is not an engineering notation string. Apparently either you and the General Decimal Arithmetic spec differ on what constitutes engineering notation, there's a

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Stefan Krah
Keith keith.braff...@gmail.com wrote: Even though this uses the to_eng_string() function, and even though I am using the decimal.Context class: c = decimal.Context(prec=5) decimal.Decimal(1234567).to_eng_string(c) '1234567' That is not an engineering notation string. To clarify

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Grant Edwards
On 2010-04-26, Keith keith.braff...@gmail.com wrote: I am considering writing a PEP for the inclusion of an engineering format specifier, and would appreciate input from others. I very regularly do something similar in various apps, though I often want to specify the exponent (e.g. I always

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Mark Dickinson
On Apr 26, 4:36 am, Keith keith.braff...@gmail.com wrote: I am considering writing a PEP for the inclusion of an engineering format specifier, and would appreciate input from others. [...] I am thinking that if we simply added something like %n (for eNgineer) to the list of format

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Mark Dickinson
On Apr 26, 6:47 am, Keith keith.braff...@gmail.com wrote: From that document it appears that my decimal.Decimal(1234567) example shows that the module has a bug: Doc says: [0,123,3] ===  123E+3 But Python does: import decimal decimal.Decimal(123000).to_eng_string() '123000' That's not

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Keith
Apparently either you and the General Decimal Arithmetic spec differ on what constitutes engineering notation, there's a bug in the Python decimal library, You've distilled it precisely, and as you've shown in a different post, it's the former. The Python decimal module seems to implement

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Keith
On Apr 26, 5:33 am, Stefan Krah stefan-use...@bytereef.org wrote: Keith keith.braff...@gmail.com wrote: Even though this uses the to_eng_string() function, and even though I am using the decimal.Context class: c = decimal.Context(prec=5) decimal.Decimal(1234567).to_eng_string(c)

Re: Engineering numerical format PEP discussion

2010-04-26 Thread MRAB
Mark Dickinson wrote: On Apr 26, 4:36 am, Keith keith.braff...@gmail.com wrote: I am considering writing a PEP for the inclusion of an engineering format specifier, and would appreciate input from others. [...] I am thinking that if we simply added something like %n (for eNgineer) to the

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Keith
On Apr 26, 7:56 pm, Mark Dickinson dicki...@gmail.com wrote: On Apr 26, 6:47 am, Keith keith.braff...@gmail.com wrote: From that document it appears that my decimal.Decimal(1234567) example shows that the module has a bug: Doc says: [0,123,3] ===  123E+3 But Python does: import

Re: Engineering numerical format PEP discussion

2010-04-26 Thread Keith
On Apr 26, 8:47 pm, MRAB pyt...@mrabarnett.plus.com wrote: t for powers of a thousand, perhaps? (Or m?) Both of those letters are fine. I kinda like m for the whole Greco- Roman angle, now that you point it out :-) --Keith Brafford -- http://mail.python.org/mailman/listinfo/python-list

Engineering numerical format PEP discussion

2010-04-25 Thread Keith
I am considering writing a PEP for the inclusion of an engineering format specifier, and would appreciate input from others. Background (for those who don't already know about engineering notation): Engineering notation (EN) is type of floating point representation. The idea with EN is that the

Re: Engineering numerical format PEP discussion

2010-04-25 Thread Chris Rebert
On Sun, Apr 25, 2010 at 8:36 PM, Keith keith.braff...@gmail.com wrote: I am considering writing a PEP for the inclusion of an engineering format specifier, and would appreciate input from others. Background (for those who don't already know about engineering notation): Engineering notation

Re: Engineering numerical format PEP discussion

2010-04-25 Thread Steven D'Aprano
On Sun, 25 Apr 2010 20:36:22 -0700, Keith wrote: I am considering writing a PEP for the inclusion of an engineering format specifier, and would appreciate input from others. [...] For instance, no one talks about 4.7e-5F, as they would rather see 47e-6 (micro). Instead of 2.2e-2, engineers

Re: Engineering numerical format PEP discussion

2010-04-25 Thread Keith
On Apr 26, 12:02 am, Chris Rebert c...@rebertia.com wrote: On Sun, Apr 25, 2010 at 8:36 PM, Keith keith.braff...@gmail.com wrote: I am considering writing a PEP for the inclusion of an engineering format specifier, and would appreciate input from others. snip Relevant related information:

Re: Engineering numerical format PEP discussion

2010-04-25 Thread Keith
On Apr 26, 12:29 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Sun, 25 Apr 2010 20:36:22 -0700, Keith wrote: no one talks about 4.7e-5F, as they would rather see 47e-6 (micro). Instead of 2.2e-2, engineers need to see 22.0e-3 (milli). I'd be cautious about making claims

Re: Engineering numerical format PEP discussion

2010-04-25 Thread Chris Rebert
On Sun, Apr 25, 2010 at 9:42 PM, Keith keith.braff...@gmail.com wrote: On Apr 26, 12:02 am, Chris Rebert c...@rebertia.com wrote: On Sun, Apr 25, 2010 at 8:36 PM, Keith keith.braff...@gmail.com wrote: I am considering writing a PEP for the inclusion of an engineering format specifier, and

Re: Engineering numerical format PEP discussion

2010-04-25 Thread Xavier Ho
On Mon, Apr 26, 2010 at 3:19 PM, Chris Rebert c...@rebertia.com wrote: Apparently either you and the General Decimal Arithmetic spec differ on what constitutes engineering notation, there's a bug in the Python decimal library, or you're hitting some obscure part of the spec's definition. I

Re: Engineering numerical format PEP discussion

2010-04-25 Thread Chris Rebert
On Sun, Apr 25, 2010 at 10:25 PM, Xavier Ho cont...@xavierho.com wrote: On Mon, Apr 26, 2010 at 3:19 PM, Chris Rebert c...@rebertia.com wrote: Apparently either you and the General Decimal Arithmetic spec differ on what constitutes engineering notation, there's a bug in the Python decimal

Re: Engineering numerical format PEP discussion

2010-04-25 Thread Keith
On Apr 26, 1:19 am, Chris Rebert c...@rebertia.com wrote: Apparently either you and the General Decimal Arithmetic spec differ on what constitutes engineering notation, there's a bug in the Python decimal library, or you're hitting some obscure part of the spec's definition. snip The

Re: Engineering numerical format PEP discussion

2010-04-25 Thread Xavier Ho
On Mon, Apr 26, 2010 at 3:39 PM, Chris Rebert c...@rebertia.com wrote: The conversion **exactly follows the rules for conversion to scientific numeric string** except in the case of finite numbers **where exponential notation is used.** Well, then maybe the conversion doesn't exactly follow