Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #69128

Re: YADTR (Yet Another DateTime Rant)

References <roy-142548.20582725032014@news.panix.com> <5332DDE7.2050202@rece.vub.ac.be>
Date 2014-03-27 01:12 +1100
Subject Re: YADTR (Yet Another DateTime Rant)
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.8578.1395843169.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Mar 27, 2014 at 1:02 AM, Antoon Pardon
<antoon.pardon@rece.vub.ac.be> wrote:
> There is a difference between how people say things and what is useful.
> I remember when I was studying logarithms, a negative number like -5.73
> was written down as ̅6.27 (with a bar only over the six). That notation
> had the advantage that the part after the decimal point stayed the same
> if you added or subtracted whole numbers. Even if that would change the
> sign.

That's highly significant with logs, especially when you're working
with base 10 logs.

>>> math.log10(1234)
3.091315159697223
>>> math.log10(12340)
4.091315159697223
>>> math.log10(123400)
5.091315159697223
>>> math.log10(1234000)
6.091315159697223
>>> math.log10(12.34)
1.0913151596972228
>>> math.log10(1.234)
0.09131515969722287
>>> math.log10(.1234)
-0.9086848403027772
>>> math.log10(.01234)
-1.9086848403027772

By showing those last ones as 1̅.091... and 2̅.091..., you emphasize
the floating-point nature of the data: everything after the decimal is
the mantissa, and everything before the decimal is the exponent. I
can't say for sure as I don't really use that, but I can imagine that
there might be something similar with dates and times - it's three
days ago at 2:51, not two days and 21:09 ago.

Or maybe it's just "print it out in a way that more closely matches
the internal representation, to simplify debugging" :)

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-25 20:58 -0400
  Re: YADTR (Yet Another DateTime Rant) Ethan Furman <ethan@stoneleaf.us> - 2014-03-25 18:19 -0700
  Re: YADTR (Yet Another DateTime Rant) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-26 09:27 +0000
  Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-26 08:37 -0500
    Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-26 08:04 -0700
      Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-26 10:39 -0500
        Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-26 17:58 +0200
          Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-26 11:34 -0500
            Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-26 19:13 +0200
            Re: YADTR (Yet Another DateTime Rant) Grant Edwards <invalid@invalid.invalid> - 2014-03-26 19:12 +0000
              Re: YADTR (Yet Another DateTime Rant) Ben Finney <ben+python@benfinney.id.au> - 2014-03-27 07:06 +1100
      Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-26 11:50 -0400
  Re: YADTR (Yet Another DateTime Rant) Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-03-26 15:02 +0100
    Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-26 16:43 +0200
  Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 01:12 +1100
    Re: YADTR (Yet Another DateTime Rant) Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-03-27 11:08 +1300
  Re: YADTR (Yet Another DateTime Rant) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-03-26 19:25 -0400
    Re: YADTR (Yet Another DateTime Rant) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-27 00:16 +0000
      Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 12:28 +1100
        Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-26 21:38 -0400
          Re: YADTR (Yet Another DateTime Rant) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-03-27 08:40 +0000
      Re: YADTR (Yet Another DateTime Rant) Dan Sommers <dan@tombstonezero.net> - 2014-03-27 03:56 +0000
      Re: YADTR (Yet Another DateTime Rant) Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-03-27 11:22 +0100
        Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 21:44 +1100
          Re: YADTR (Yet Another DateTime Rant) Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-03-27 12:05 +0100
            Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 22:33 +1100
          Re: YADTR (Yet Another DateTime Rant) Johannes Bauer <dfnsonfsduifb@gmx.de> - 2014-03-27 12:25 +0100
            Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 22:42 +1100
            Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-27 06:56 -0500
              Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-27 16:04 +0200
            Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-27 23:20 +1100
            Re: YADTR (Yet Another DateTime Rant) Skip Montanaro <skip@pobox.com> - 2014-03-27 08:01 -0500
            Re: YADTR (Yet Another DateTime Rant) Terry Reedy <tjreedy@udel.edu> - 2014-03-27 17:10 -0400
            Re: YADTR (Yet Another DateTime Rant) Ethan Furman <ethan@stoneleaf.us> - 2014-03-27 17:04 -0700
            Re: YADTR (Yet Another DateTime Rant) Terry Reedy <tjreedy@udel.edu> - 2014-03-27 21:46 -0400
              Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-27 21:59 -0400
                Re: YADTR (Yet Another DateTime Rant) Terry Reedy <tjreedy@udel.edu> - 2014-03-27 22:24 -0400
                Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-28 14:03 +1100
          Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-27 08:52 -0400
            Re: YADTR (Yet Another DateTime Rant) Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-03-27 15:12 +0100
            Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-28 01:15 +1100
            Re: YADTR (Yet Another DateTime Rant) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-27 23:41 +0000
              Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-27 20:29 -0400
                Re: YADTR (Yet Another DateTime Rant) Ben Finney <ben+python@benfinney.id.au> - 2014-03-28 11:43 +1100
                Re: YADTR (Yet Another DateTime Rant) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-28 11:11 +0000
                Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-28 08:30 -0400
                Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-28 15:10 +0200
                Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-29 00:19 +1100
                Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-28 09:22 -0400
                Re: YADTR (Yet Another DateTime Rant) Rustom Mody <rustompmody@gmail.com> - 2014-03-28 06:30 -0700
                Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-29 00:32 +1100
                Re: YADTR (Yet Another DateTime Rant) Roy Smith <roy@panix.com> - 2014-03-28 09:20 -0400
                Re: YADTR (Yet Another DateTime Rant) Marko Rauhamaa <marko@pacujo.net> - 2014-03-28 16:34 +0200
                Re: YADTR (Yet Another DateTime Rant) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-03-28 14:35 +0000
                Re: YADTR (Yet Another DateTime Rant) Chris Angelico <rosuav@gmail.com> - 2014-03-29 02:25 +1100
  Re: YADTR (Yet Another DateTime Rant) Ethan Furman <ethan@stoneleaf.us> - 2014-03-26 16:33 -0700

csiph-web