At 11:34 AM -0400 8/24/04, Butler, Gerald wrote:
So, would it have things like

    $i = $j /E $k
    $i = $j %E $k

which would both throw and exception if $k == 0 whereas

    $i = $j / $k
    $i = $j % %k

would not throw an exception and would instead return NaN

That'd be the plan, yeah. $i wouldn't get NaN if $i is an integer, though I expect everyone figured that one out. :)


-----Original Message-----
From: Dan Sugalski [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 24, 2004 11:29 AM
To: [EMAIL PROTECTED]
Subject: Low-level math op behavior


Okay, since we're finally talking defined math semantics, lets talk the low-level ops.

All our math ops right now just quietly do their thing. If values
wrap, truncate, or otherwise fuzz out, we don't do anything special.
This is fine, and fast, and what many languages want. It is, however,
reasonable to have math ops that are a bit higher-level -- basically
throwing exceptions if something exceptional happened rather than
quietly proceeding.

What I'm thinking is that we add an O or X (or E, I don't care. I
suppose we could get more verbose there too) variant to the basic
math ops which checks the result for validity and throws an exception
on something exceptional happening.

Only for the basics (add, subtract, multiply, divide, possibly
modulus) but it ought to be useful. Folks think it's worth it?

-- Dan

--------------------------------------it's like this-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to