Re: Request: Integer Division

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

The FLOOR versions use C integer division if the divisor and dividend are euphoria integer values (we may not know until runtime)

If we may not know, then for general knowledge, what advantage is there in declaring

integer varname

at the top of the code, instead of atom or object? I have tended to use integers in loops where speed was important, thinking they were overall faster to compute.

If you declare something to be an integer, then we do know. But you may instead be using an atom. Or a value stored in a sequence, or the return value from a function. Or a sequence full of...well, who knows?

In general, declaring things that you know will always be integers to be integers does offer speed benefits, and I do this as much as possible, too. There is a lot of stuff in both the interpreter and translator to optimize this sort of thing. However, other cases where we can't determine the storage type at parse / compile time have to be dealt with, too.

Matt

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

Search



Quick Links

User menu

Not signed in.

Misc Menu