View Single Post
Old 03-19-2022, 05:43 PM   #357
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Question:

I have two timedate columns with a difference of less than an hour.* If I put the raw input into a days_between, depending on what order I either get 0.0 or -0.0.

Is the negative intended or a bug? There's something called a signed zero but I don't quite understand what it means.

I tried multiplying to see what would happen but still got -0.0.

* 2022-03-19 02:03:12+00:00 and 2022-03-19 03:00:00+00:00 exactly.
For fun try the template
Code:
program: format_number((-0.001), '.1f')
You will see the negative 0. It is what python does.

You can see it without the formatter as the intermediary using the python command line interpreter.
Code:
>>> '%.1f'%(0.01)
'0.0'
>>> '%.1f'%(-0.01)
'-0.0'
>>> '%.1f'%(-0.01/10)
'-0.0'
>>> '%.3f'%(-0.01/10)
'-0.001'
chaley is offline   Reply With Quote