Post Reply 
Elementary: on formattng and programming mode
03-26-2014, 02:56 PM
Post: #1
Elementary: on formattng and programming mode
When I construct a TEXTOUT_P(...) statement I sometimes have to mix floating and integer numbers (as, for example, displaying a test statistic and degrees of freedom). Is there a way to display the floating numbers to, let's say, three digits, but to display the integers with no decimals, i.e., as integers? And, while I have your ear, what is the programming command to change the numeric output format?

I am still having trouble getting int() to work in programs, though it works fine interactively. (I posted earlier on a related topic.) I have seen reference here to programming in CAS or Home mode. What determines whether a program is in Home or CAS mode? Can one shift in mid-program? Where is this documented? Will some CAS functions simply not work in Home mode? Looking at a program, how does one know whether it is in CAS or Home mode?

Thank you for any thoughts.

Ben Fairbank
Find all posts by this user
Quote this message in a reply
03-26-2014, 03:08 PM
Post: #2
RE: Elementary: on formattng and programming mode
(03-26-2014 02:56 PM)Ben Fairbank Wrote:  When I construct a TEXTOUT_P(...) statement I sometimes have to mix floating and integer numbers (as, for example, displaying a test statistic and degrees of freedom). Is there a way to display the floating numbers to, let's say, three digits, but to display the integers with no decimals, i.e., as integers? And, while I have your ear, what is the programming command to change the numeric output format?

I am still having trouble getting int() to work in programs, though it works fine interactively. (I posted earlier on a related topic.) I have seen reference here to programming in CAS or Home mode. What determines whether a program is in Home or CAS mode? Can one shift in mid-program? Where is this documented? Will some CAS functions simply not work in Home mode? Looking at a program, how does one know whether it is in CAS or Home mode?

Thank you for any thoughts.

Ben Fairbank

For formatting, you may want to look into the STRING() command. As for int(), you may want to try something like:

int("x^2-2x","x");

The arguments can be variables whose contents are strings. That is,

LOCAL func:="x^2-2x";
LOCAL var:="x";
int(func,var);

should work as well. Keep in mind that the result is a CAS result. Programs, however, are like command sequences executed in the Home view though. So make sure you properly handle the result.

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




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