Re: Request: Integer Division

new topic     » goto parent     » topic index » view thread      » older message » newer message
eukat said...
jimcbrown said...
eukat said...
SnakeCharmer said...
integer X = integer_division(Y,Z) 

I see no gain there. You are doing more typing, remembering a new keyword, spending more of your time, and possibly taking more cpu time to set up and execute.

The point of adding a new integer_division() would be to take less cpu time to set up and execute (as compared to the existing intdiv() in std/math.e which is slower as it involves conversion to and operations with floating point numbers).

So Eu tracks the declared type integer all thru the program, and then ignores it and converts to type atom (floating point), does the most costly math possible on it, then truncates it and re-typecasts it as integer?

That was my understanding of how things worked today - except if you forget the call to trunc() then you get an ex.err-style crash instead (since atoms with fractions can't be assigned to integers).

eukat said...

My objection was based on hearing many years ago that Intel cpus got rid of the integer math unit and essentially ran the math halfway thru the float pipeline anyhow.

Hmm... well, that's still faster than how Euphoria does it now, though.

eukat said...

Then i'd call this ticket (i mean Request for Feature?) a bug fix request.

Well, no actual functionality is incorrect - it's just slower in a well understood way and requires more steps.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu