  lua-l archive

• Subject: Re: boolean operators
• From: Rici Lake <lua@...>
• Date: Thu, 28 Sep 2006 15:19:37 -0500

```
On 28-Sep-06, at 3:00 PM, Glenn Maynard wrote:

```
```Integers are bit masks; bit masks are as much fundamental types in
Lua as integers, by this logic.  Also, % is floating point modulus;
looking at a particular subset of its uses (integer remainder) and
wanting a paired operator with that seems like rationalizing a sqrt()
operator because a subset of multiplication is squaring.
```
```
```
Integers can be represented as bit strings, certainly, but then so can character strings and floating point numbers. I don't see where that says that bit strings are in any way fundamental. I could produce a conformant Lua implementation whose basic numeric type was decnums, even implemented on hypothetical decimal hardware. (Similarly, Lua does not define the particular bitstring used to represent an "a", so I could run Lua on EBCDIC OS's, and people probably do.)
```
```
A subset of floating point numbers are integers; within that subset, +, -, * and % are as closed as they would be for a numeric type which only represented integers. And so would //: it's precisely defined over the range of representable floating point numbers (aside from 0), and could be implemented with any arbitrary number representation, even complex numbers (there's an example of this on Wolfram's Mathematica site).
```
```
Sqrt is a specialization of ^, not a subset of it. I'm not arguing either way about a sqrt unary operator, although it would be a plausible way of speeding up calculation of square roots in hard loops.
```

```