Sujet : Re: Reverse SCAN SPLIT
De : dxforth (at) *nospam* gmail.com (dxf)
Groupes : comp.lang.forthDate : 07. Oct 2024, 12:22:57
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <8195b3d00499f82168a805aaa3a0be86097a0cc4@i2pn2.org>
References : 1 2
User-Agent : Mozilla Thunderbird
On 7/10/2024 9:02 pm, Ruvim wrote:
...
Why do you prefer the order ( u.hour u.min u.sec ) rather than ( u.sec u.min u.hour ) ?
The later order makes code simpler in (1) and (2), also, it follows the order of parameters in `TIME&DATE`.
Moreover, if you want to convert three components to seconds, you need to reverse their order again:
: time3-to-seconds ( u.hour u.min u.sec -- u.sec-total )
swap rot 60 * + 60 * +
;
If the order of parameters is reversed, the above definition takes a simpler form:
: time3-to-seconds ( u.sec u.min u.hour -- u.sec-total )
60 * + 60 * +
;
I thought it would be easier to convert to total secs (on 16-bit it has to be a double).
But perhaps not.