The upcoming Babel-17 v0.21 will only know integer numbers, no real numbers; but real numbers in form of interval arithmetic will be part of the next version of Babel-17.

Therefore, what should for example

7/4

evaluate to? Because Babel-17 currently only has integers, the result 1 seems to make sense. But factoring in the fact that eventually, there will be real numbers in Babel-17, this could be a major source of confusion, because the similar expression

7.0/4.0

would not evaluate to 1, but to 1.75 .

Therefore two new binary operators are introduced in Babel-17, “div” and “mod” which will denote euclidean division and modulo operations. Therefore the following will evaluate to true in later versions of Babel-17:

7 / 4 == 7.0 / 4.0 == 7 / 4.0 == 7.0 / 4 == 1.75 &
7 div 4 == 1 & 7 mod 4 == 3

In Babel-17 v0.21, u/v will always result in a DomainError for integers u and v.

The operator “%” will vanish. Its function is taken over by the new operator “mod”.

### Like this:

Like Loading...

*Related*

This entry was posted on November 11, 2010 at 1:11 AM and is filed under Babel-17. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.

## Leave a Reply