Post Reply 
[SOLVED] Bug with INSTRING
10-26-2016, 06:49 PM
Post: #3
RE: Bug with INSTRING
(10-26-2016 08:37 AM)CH3791 Wrote:  Hello,

When I put INSTRING("√7","√") directly into CAS, it returns 1 as expected.

However when I put the exact same thing into programs, it returns 0. CAS or non-CAS, it doesn't matter.
Code:
EXPORT norm_instring_bug(expression)
BEGIN
  return instring(string(expression),"√");
END;

#cas
cas_instring_bug(expression):=
BEGIN
  return instring(string(expression),"√");
END;
#end

It might have something to do with Prime auto-adding spaces, which I found to have caused some issues during my testing. For example, Prime changes "√" to " √ ". If we now calculate INSTRING("√7"," √ "), it returns 0.

I don't have a calc or a copy of the VC in my reach, but I wonder if there is any difference between running the programs from CAS vs from HOME. My thought process is that in CAS, entering in √7 leaves the quantity in exact form (assuming the necessary settings are in place) whereas in HOME, the quantity is reduced to a decimal approximation. If this simplification happens before that program is even run (as part of the parsing routine), then this may explain why you get 0 as the result all the time.

Han

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[SOLVED] Bug with INSTRING - CH3791 - 10-26-2016, 08:37 AM
RE: Bug with INSTRING - StephenG1CMZ - 10-26-2016, 01:02 PM
RE: Bug with INSTRING - Han - 10-26-2016 06:49 PM
RE: Bug with INSTRING - toml_12953 - 10-27-2016, 06:41 AM
RE: Bug with INSTRING - CH3791 - 10-27-2016, 09:36 AM
RE: Bug with INSTRING - StephenG1CMZ - 10-27-2016, 01:47 PM
RE: Bug with INSTRING - CH3791 - 10-28-2016, 07:10 AM
RE: [SOLVED] Bug with INSTRING - Jan_D - 11-19-2016, 09:11 PM
RE: [SOLVED] Bug with INSTRING - CH3791 - 11-21-2016, 10:38 AM
RE: [SOLVED] Bug with INSTRING - Jan_D - 11-21-2016, 03:45 PM



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