From: Richard Maine on 17 Jul 2010 12:26 Phillip Helbig---undress to reply <helbig(a)astro.multiCLOTHESvax.de> wrote: > Is the consensus here that > > print*, (-1.0)**2.0 .... > is illegal (i.e. doesn't conform to the standard)? I would hope so. I don't have a copy of the standard here to cite, but it isn't as if the restriction is in the lest bit subtle. I shouldn't say that I don't see how anyone could manage to interpret it differently (because last time I made such an audacious claim on another matter, I was wrong), but I sure don't. The words are something along the line of "a negative-valued real shall not be raised to a complex value". That's from recollection and thus might not be quite right, but it was something about that straightforward. > (If so, presumably > the compiler should warn about it, at least if asked to warn about > non-standard stuff.) Ah. You asked about the part that seems obvious (at least to me), but you just presume the part that seems far from obvious. The restriction is not a constraint or anything else that the standard requires warning about. Most cases are likely to involve variables, whose values are not evident at compile time and thus could not plausibly generate compilation errors. I suppose the compiler could warn for every exponentation of a real that there might be a problem if the value was negative, but I'd find that incredibly annoying in that it would give more bogus warnings than useful ones. I wouldn't have even thought about the possibility if I hadn't seen warnings that I considered just as annoying for other prefectly innocuous things that I do a lot. I can thus see argument for not being worth the bother to check for the particular case of doing this with literal constants. Might be minorly nice, but it sure is not very high on the list of quality of implementation issues. In particular, I would not put it high enough on the list of minorly nice things for me to say a compiler "should" do it. > Changing the values slightly so that they are no longer "round" values, > I get > > %MTH-F-UNDEXP, undefined exponentiation > > at run time but not at compile time. That just suggests that somewhere along the line, the compiler optimized the case with round values. That's a plausible, possibly even common, optimization. -- Richard Maine | Good judgment comes from experience; email: last name at domain . net | experience comes from bad judgment. domain: summertriangle | -- Mark Twain
From: Richard Maine on 17 Jul 2010 12:31 Richard Maine <nospam(a)see.signature> wrote: > The words are something along the line of > "a negative-valued real shall not be raised to a complex value". Make that s/complex/real/. I had complex on my mind and the fingers just typed it by themselves or something. -- Richard Maine | Good judgment comes from experience; email: last name at domain . net | experience comes from bad judgment. domain: summertriangle | -- Mark Twain
From: glen herrmannsfeldt on 17 Jul 2010 12:53 Richard Maine <nospam(a)see.signature> wrote: > Richard Maine <nospam(a)see.signature> wrote: >> The words are something along the line of >> "a negative-valued real shall not be raised to a complex value". > Make that s/complex/real/. Yes. Negative values to complex powers should be allowed. > I had complex on my mind and the fingers just > typed it by themselves or something. I have had that happen, though usually only one or two letters off. I once registered the wrong domain name, thinking I typed the right one. That was when you didn't have to pay immediately, though. -- glen
First
|
Prev
|
Pages: 1 2 3 Prev: WORK WITH INTERNET ONLINE JOBS - EARN $19,000 MONTHLY Next: what memory gets used? |