[Gambas-user] DIV

Jussi Lahtinen jussi.lahtinen at ...626...
Thu Jul 12 17:44:36 CEST 2012


> Doc states, DIV is a synonymous for \ which is the integer division
> operator.
>


Documentation says "Calculates the quotient of two Integer numbers,
rounding down".
And my question was, in other words, why it calculates quotient for only
integer numbers?
Output is always integer, but why input should be?

Also why MOD takes only integers, in C you can use fmod() if you want to
use floats like in math generally.

I think DIV and MOD would have more general usage if they would allow
floats.
Only reason I can see to keep DIV accepting only integers is performance,
but is that really issue for single instruction?

Right now this seems to be so for just historical reasons.

Jussi



More information about the User mailing list