2**X where X is negative is legal. 2**-X = 1/(2**X). 2**-17 = 0.0000076 A language might -- I am not an expert -- refuse N**2.0 where N was negative because fractional powers of a negative number are illegal, and 2.0, as a floating point number, could be seen as fractional.
Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of Seymour J Metz Sent: Thursday, July 18, 2019 2:05 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Where put the notional constant in a condition (Was RE: JCL COND Parameter) I hope that he meant 2**X when X is negative. I checked some old Fortran manuals and couldn't find anything about what is allowed on the left and right hand side in foo**bar, except in constant expressions.. -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of Clark Morris <cfmt...@uniserve.com> Sent: Thursday, July 18, 2019 4:37 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: Where put the notional constant in a condition (Was RE: JCL COND Parameter) [Default] On 18 Jul 2019 09:42:13 -0700, in bit.listserv.ibm-main 0000000433f07816-dmarc-requ...@listserv.ua.edu (Paul Gilmartin) wrote: >On Tue, 16 Jul 2019 19:22:51 +0000, Seymour J Metz wrote: >> >>The cardinal sin in language design is to make the compiler simpler at the expense of the user. ... >> >I see a notable example of this in Rexx's not supporting expressions in compound >symbol tails which some have justified as making recognition of assignments easier. > >OTOH, Pascal declined to provide an exponentiation operator in order to expose >to programmers the underlying costly implementation: > X ** Y is implemented in other languages as exp( log( X ) * Y ) > >Physics graduate students complained to me when the FORTRAN runtime >threw an exception on X ** 2.0 when X was negative. "Why can't I square >a negative number?" Why won't FORTRAN square a negative number? Is this behavior peculiar to FORTRAN? Clark Morris > >(Some BASIC interpreters take special paths when a number has an integral value.) > >And they complained when (FORTRAN, but easier in C pseudocode): > for ( X = 0; X!=1.0; X+=0.1 ) { ...; } >... never terminated. "Roundoff error!? Why doesn't it just use the exact value >of one tenth?" > >DWIM? > >-- gil > >---------------------------------------------------------------------- >For IBM-MAIN subscribe / signoff / archive access instructions, >send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN