Post Reply 
Strange behaviour STRING command in case STRING(√7)
11-22-2016, 09:23 PM (This post was last modified: 11-22-2016 09:27 PM by StephenG1CMZ.)
Post: #9
RE: Strange behaviour STRING command in case STRING(√7)
(11-22-2016 06:32 PM)Joe Horn Wrote:  
(11-22-2016 04:51 PM)Jan_D Wrote:  I entered each command twice, the first time in lowercase, the second time in uppercase.

If you turn off Textbook Display (N.B. not Textbook Entry), the CAS history will show your commands in the case you typed them in (usually). This helps tremendously when trying to figure out which spelling does what.

Please note that mixed case sometimes acts differently than either uppercase or lowercase spelling. For example, in CAS, Sign() is more accurate than either sign() or SIGN(). Try all three on epsilon to see this (be sure to turn Textbook Display off!):

sign(epsilon) --> 0.
SIGN(epsilon) --> 0.
Sign(epsilon) --> 1.

Crazy, huh?

I have previously considered using some portable sign code, if only to avoid changing portable code from SIGN to SGN depending on compiler...It is surprising that something so short has such unexpected results.

Code:



 EXPORT Z_SGN(XX)
 BEGIN
  RETURN ((XX>0)-(XX<0));
 END;
 

EXPORT SG()
BEGIN
 Z_SGN(0.01);
 // Z_SGN(epsilon); where is epsilon? 
END;

I haven't checked that on epsilon - I get a syntax error whether I write epsilon or select "e" from the key Shift/9.

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Strange behaviour STRING command in case STRING(√7) - StephenG1CMZ - 11-22-2016 09:23 PM



User(s) browsing this thread: 1 Guest(s)