libertas has quit [Ping timeout: 240 seconds]
xkapastel has joined #picolisp
xkapastel has quit [Quit: Connection closed for inactivity]
xkapastel has joined #picolisp
michelp has quit [Read error: Connection reset by peer]
michelp has joined #picolisp
orivej has joined #picolisp
libertas has joined #picolisp
orivej has quit [Ping timeout: 268 seconds]
<
beneroth>
Regenaxer, are you there?
<
beneroth>
or tankf33der ?
<
beneroth>
How to do mathematical ceiling (always round up to nearest integer) ?
<
Regenaxer>
Hi beneroth!
<
tankf33der>
searching
<
beneroth>
Hi Regenaxer and tankf33der :)
<
Regenaxer>
Best is to add base-1 and divide/mul by base, this gives floor, so +1
<
Regenaxer>
no, it gives ceil
<
Regenaxer>
eg if base is 10, you add 9
<
tankf33der>
try this one.
<
beneroth>
so... for (/ 1 3) -> 1 I do?
<
Regenaxer>
then / 10 and then * 10 gives floor
<
Regenaxer>
ah, you mean something different
<
Regenaxer>
anyway, plus 2, then divide
<
Regenaxer>
(if all nums are positive)
<
beneroth>
all are positive
<
beneroth>
yeah right wrong question
<
tankf33der>
also i have different solution too in repo
<
Regenaxer>
thanks tankf33der
<
Regenaxer>
but the add n-1 is good too, saves a %
<
Regenaxer>
(/ (+ A -1) A)
<
Regenaxer>
(/ (+ A -1) B)
<
beneroth>
(+ (/ A B) (if (n0 (% A B)) 1 0))
<
Regenaxer>
(/ (+ A B -1) B)
<
Regenaxer>
beneroth, yes, but % is very expensive
<
beneroth>
(/ (+ A B -1) B) nice
<
beneroth>
thank you both!
<
beneroth>
next time I'll ask in code :)
<
beneroth>
and try to think more mathematical
<
beneroth>
not my strength though :)
<
beneroth>
thank you very much for your help, tankf33der, Regenaxer :)
<
Regenaxer>
No problem, I just did not focus well
<
tankf33der>
solving this one
<
Regenaxer>
interesting
<
beneroth>
I just used (cut) the first time
<
beneroth>
slicing a list into equal sized columns (therefore the rounding up division)
<
Regenaxer>
makes sense
<
beneroth>
getting some sun
orivej has joined #picolisp
<
Regenaxer>
Yeah, I saw the mountains from here, very clear an sunny. Here (80 km north) it is cloudy and rainy
<
tankf33der>
did it.
xkapastel has quit [Quit: Connection closed for inactivity]
<
Regenaxer>
Instead of (< (length W) 3) better (not (cddr W)) ?
<
Regenaxer>
length may be expensive
<
Regenaxer>
Cool, lots of hashing :)
<
tankf33der>
i will submit if ok
<
Regenaxer>
Good I think
<
tankf33der>
i invented all myself. very satisfied.
<
tankf33der>
tried by-group before.
f8l has quit [Remote host closed the connection]
f8l has joined #picolisp
libertas has quit [Ping timeout: 260 seconds]
libertas has joined #picolisp
f8l has quit [Remote host closed the connection]
f8l has joined #picolisp