Don <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #1 from Don <> 2011-11-27 23:36:13 PST ---
(In reply to comment #0)
> It seems to be by design:
> > if (n<0) return x/0; // Only support positive powers
> But that does not make any sense. The results are well-defined if x!=0.

No, they aren't well defined. The result doesn't fit into an integer, unless x
is 1 or -1.   x^^n is always a bug if x is an integer other than +-1, and n is
a negative integer.

The idea behind the division by zero error is that some processors (such as
x86) also give a div by zero error on -1 / (-1 - int.max), because the result
isn't representable as an integer. It's ugly though.

Now that we have proper range checking, we should be able to statically
disallow it, and make n unsigned.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to