RexxLA / NetRexx

Other
8 stars 0 forks source link

describe all effects that distinguish options binary from nobinary (was NETREXX-143) #20

Open rvjansen opened 2 years ago

rvjansen commented 2 years ago

1/0 raises no exception with binary and these:

I did some reading on the options binary (which was the first method to make it work) The PG says about the options table "In the following table, c stands for commandline only , s stands for source and b stands for both." ---> I see no s in the table. "Options valid for the options statement and on the commandline" ---> Options valid on the commandline (c) or on both, the options statement and the commandline (b). And finally the ef fect of options binary with respect to NetRexxF should be mentioned. > The Language Reference says "All option words may also be set as command line options when invoking the processor , by prefixing th em with ”-”:" ---> "All" should be "Some" or "Many" or "Most" (maybe with a pointer ---> to the PG)

(Walter Pachl)

rvjansen commented 2 years ago

Comment by Kermit Kiser [ 13/Jul/15 ] Please clarify what is being requested. There is a section (43) in the NetRexx Language Reference manual which describes binary operations. Section 42.2.11 describes the NetRexx divide by zero exception. Java (ie binary mode) allows floating point divide by zero without exception but gives ArithmeticException with integers. Here is the related NRL (section 43.1) excerpt: Note that NetRexx provides both divide and integer divide operators; in a binary class or method, the divide operator (”/”) converts its operands to floating-point types and returns a floating-point result, whereas the integer divide operator (”%”) converts its operands to integer types and returns an integer result.

The following script illustrates the expected results:

do – nobinary
say "nobinary 1/0 ="
say 1/0
catch de=DivideException say de
end
do – nobinary
say "nobinary 1%0 ="
say 1%0
catch de=DivideException

say de end
do binary
say "binary 1/0 =" say 1/0
end
do binary
say "binary 1%0 = NetRexx compile error" – say 1%0 "NetRexx compile error"
end
do binary
x=int(1)
y=int(0)
say "binary x%y (x=1, y=0) =" say x%y
catch ae=ArithmeticException say ae
end