Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

math error in addition

48 views
Skip to first unread message

Yahalom Emet

unread,
Jan 18, 2024, 1:40:02 AM1/18/24
to
What is wrong with the Tcl addition:
% clock format 1698526800
Sun Oct 29 00:00:00 IDT 2023
% expr 1698526800+86400
1698613200
% clock format 1698613200
Sun Oct 29 23:00:00 IST 2023

The addition should be 1698699600

Am I missing something?

Harald Oehlmann

unread,
Jan 18, 2024, 3:26:41 AM1/18/24
to
Quickly looking at your example:

expr 1698526800+86400

1698526800
+ 86400
=
1698526800
+ 400
+ 6000
+ 80000
=
1698527200
+ 6000
+ 80000
=
1698533200
+ 80000
=
1698623200
----------

I come to the same result as expr. Am I missing something?
About clock, it is always good to also specify the time.

Take care,
Harald

Ralf Fassel

unread,
Jan 18, 2024, 5:52:49 AM1/18/24
to
* Yahalom Emet <yaha...@gmail.com>
To explain why you expect the addition to give a clearly wrong result?
...800 + ...400 can't result in ...600, it needs to result in ...200.

Did you miss the transition from DST no non-DST indicated by the time
zones?

R'

Manuel Collado

unread,
Jan 18, 2024, 6:07:03 AM1/18/24
to
El 18/1/24 a las 7:39, Yahalom Emet escribió:
Nope. It should be 1698613200

>
> Am I missing something?

Ability to manually do numeric addition ? :-)


Yahalom Emet

unread,
Jan 18, 2024, 8:32:24 AM1/18/24
to
Yes, I missed the IDT IST conversion, great tip and interesting thing to consider when doing simple aritmetic for a day instead of using the proper 'clock' methods.
Thanks
0 new messages