Program takes in variable non exact. - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Program takes in variable non exact. (/thread-6563.html) Program takes in variable non exact. - CH3791 - 07-16-2016 08:31 AM When I use my custom functions, I must put my equation into quotation marks if I want it to stay exact. This happens even if my CAS settings are "exact". For example: Quotation Marks vs No Quotation Marks Is there a way on the program side to not have this happen? I don't want to be doing an exam and have to go through yet another step in solving the questions. Thanks in advance. RE: Program takes in variable non exact. - roadrunner - 07-17-2016 06:29 PM Have you considered a CAS program? An example: Code: ```#cas Saturday(param):= BEGIN  return exact(param); END; #end``` Saturday(π+√(3)) returns π+√(3) in home and CAS Saturday(0.3) returns 3/10 in home and CAS RE: Program takes in variable non exact. - CH3791 - 07-18-2016 07:31 AM Hi Roadrunner, thanks once again for responding to one of my questions. Your code does exactly what I want it to do, but I just can't seem to get it to work on my calc. This is as close as I could get to your code. Code: ```EXPORT Sunday(my_input) BEGIN   return exact(my_input); END;``` This returned an answer of 6683778/1371413 which is clearly a fractional representation of π+√(3). Thus, can you show me more exactly how to create a "CAS program". RE: Program takes in variable non exact. - roadrunner - 07-18-2016 11:38 AM Use this template: Code: ```#cas name_of_program(paramaters):= BEGIN  //put your code here  return 0; //replace 0 with what you need returned END; #end``` Normal programs are run in HOME mode, that's why you don't get symbolic results. The #cas and #end tell the compiler to run this code in CAS mode. Just copy and paste the template above into the emulator, change the name, and add your code. Also return the answer you want instead of 0. It's hard to be more specific without seeing the actual code you are trying to write. -road RE: Program takes in variable non exact. - CH3791 - 07-18-2016 12:58 PM Hi Roadrunner, I've done what you said and was able to get it to work: [attachment=3773] [attachment=3775] [attachment=3774] But now my question is, why can't I find this program through the Toolbox>User>Program Functions? [attachment=3776] RE: Program takes in variable non exact. - Tim Wessman - 07-18-2016 03:25 PM (07-18-2016 12:58 PM)CH3791 Wrote:  But now my question is, why can't I find this program through the Toolbox>User>Program Functions? It will be in variables->CAS-> One difference between the way that the CAS system handles things is that all objects are "variables". To the cas, a program function you made is essentially identical to storing a number into 'x'. They both are variables, that contain something. In the case of the little function, it is a small set of commands that execute steps. When you use the #cas #end stuff, you are actually telling the program compiler "execute the things I'm typing within this block as if I typed them on the CAS screen". If you do something like myfunc(x,y):=x+y on the cas screen, you get a variable named myfunc, that contains a function taking two arguments. Note that is you delete/remove/rename your function that was created in your program, it could disappear unexpectedly. To "get it back", opening the program file, then exiting it again would then reexecute those commands and make the CAS variable again. RE: Program takes in variable non exact. - CH3791 - 07-31-2016 05:06 AM Thanks very much guys, sorry for this late reply.