Re: Integer division
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Integer division
- From: Roberto Ierusalimschy <roberto@...>
- Date: 2012年11月21日 12:33:57 -0200
> [...] Why not instead have integers return 'int' for the core function
> type?
One, because that would be a huge incompatibility. Second, because more
often than not it does not matter whether a number is an integer or a
float. In general, they have exactly the same behavior. And even when
the behavior differ (basically overflows), programmers will want to
impose a specific behavior (forcing a number to be a float or an int),
not to know which behavior will happen (checking whether a number is
a float or an int).
-- Roberto