Re: intdiv

new topic     » goto parent     » topic index » view thread      » older message » newer message
bill said...

Re GCD, a clean method is:

Yes, your version is 'cleaner' to look at and to grok, but mine is almost twice as fast. And that is important for a standard library routine.

bill said...

What you say about indiv being useful is correct
in so far as you are dealing with positive numbers.

My point is that applying indiv to negative numbers
is a category error.

The function you want for your tubing example is ceil(x/y).
You still need to ensure it is applied to positive x,y.

Currently intdiv is implemented as ...

sign(a)*ceil(abs(a)/abs(b)) 

so all we have to do is rename it and drop the sign() call.

bill said...

integer division:

   -9 \ 4 = -2 
    9 \ 4 =  2 

Yes, I'll do a library implementation that results in this.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu