HP Forums

Full Version: Elementary: on formattng and programming mode
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
(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.
Reference URL's