patrixl has joined #picolisp
patrixl has left #picolisp [#picolisp]
patrixl has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
patrixl has quit [Quit: Leaving.]
dexen has quit [Ping timeout: 240 seconds]
<
tankf33der>
i am stuck
<
Regenaxer>
Good morning tankf33der
<
tankf33der>
morning
<
tankf33der>
i dont understand math behind these ceil and floor rounds.
<
Regenaxer>
(/ N (** 10 *Scl) gives the integer part
<
Regenaxer>
(rounds down)
<
Regenaxer>
: (/ 1234 100)
<
Regenaxer>
this rounds up:
<
Regenaxer>
: (/ (+ 1234 99) 100)
<
Regenaxer>
`(dec (** 10 *Scl))
<
Regenaxer>
to round up or down, add 50
<
Regenaxer>
you can then always multiply with (** 10 *Scl) to scale up if necessary
<
tankf33der>
why you wrote this "... add 50" then above you never adds except (+ N `(dec (** 10 *Scl)))
<
Regenaxer>
50 if you want to round
*up* for >= 1250 and
*down* for <= 1249
<
tankf33der>
works now. thanks.
<
Regenaxer>
(for L (sort R) (println L)) could be (mapc println R)
<
Regenaxer>
(mapc println (sort R))
<
tankf33der>
right.
<
tankf33der>
committed to git, to rossetacode later.
mtsd has joined #picolisp
mtsd has quit [Client Quit]
mtsd has joined #picolisp
DKordic has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
mtsd has quit [Quit: Leaving]
orivej has quit [Ping timeout: 258 seconds]
orivej has joined #picolisp
orivej has quit [Ping timeout: 265 seconds]
orivej has joined #picolisp
_whitelogger has joined #picolisp
dexen has joined #picolisp
<
tankf33der>
this way.
<
Regenaxer>
Can't you simply use '$dat' ?
<
tankf33der>
indeed.
<
Regenaxer>
(- ($dat "2019-9-30" "-") ($dat ...))
<
Regenaxer>
Perfect
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
_whitelogger has joined #picolisp
mtsd has joined #picolisp
mtsd has quit [Quit: leaving]