Strange behaviour STRING command in case STRING(√7)
|
11-24-2016, 01:06 PM
Post: #13
|
|||
|
|||
RE: Strange behaviour STRING command in case STRING(√7)
Things are clearer now.
We have to pay careful attention to the use of uppercase and lowercase commands and show them correctly by unchecking Textbook Display in second page of Home Settings. In CAS we define once more the string s. STRING(√7) : “2.645751....” s:=string(√7) : “√7” DIM(s) : 2 ASC(s) : {8730, 55} CHAR(8730) : “√” CHAR(55) : “7” MID(s,1,1) : “√” MID(s,2,1) : “7” But.... s(1) : “ // asc(s(1)=226 s(2) : “ // asc(s(2)=136 s(3) : “ // asc(s(3)=154 s(4) : “7” // asc(s(4)=55 These results for s(i) I do not like very much. But we can improve them by converting s to a string which is generated in Home view instead of CAS view. We go to Home view and define t as t:=s. We return to CAS view and see: t(1) : 8730 t(2) : 55 This I like better. As we knew already DIM(t)=2, however SIZE(t)=4 Probably SIZE in CAS view returns the number of bytes used in UTF8 encoding because when I define in Home view the strings a and b as: a:=”aaaaa” and b:=” √√√√√” I get in CAS view: SIZE(a) : 5 SIZE(b) : 15 I define the strings in Home view because CAS view adds extra spaces when I define strings, which it should not do. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)