Casio ClassPad 300 Programming Manual page 104

Sdk programming guide
Hide thumbs Also See for ClassPad 300:
Table of Contents

Advertisement

The parameter dig represents the number of significant digits. So the BCD 555555
passed with a dig of 3 would be 5.55e5.
You can also use the following functions to convert a BCD to format mode of length
digit:
word CP_digit_OBC(OBCD *x,CP_CHAR str[],word digit,
word CP_digit_CMP(CBCD *x,CP_CHAR str[],word digit,
The values for mode can be:
• IM_MODE_NORM1
• IM_MODE_NORM2
• IM_MODE_FIX
• IM_MODE_SCI
digit can be one of the following:
• IM_DIGIT_9
• IM_DIGIT_6
• IM_DIGIT_4
digit sets the maximum number of characters that can appear in a BCD. For example, pi
with IM_DIGIT_4 would be 3.14. Pi with IM_DIGIT_6 would be 3.1415
The parameter dig is only used with Sci and Fix modes to determine the number of digits
after the decimal point.
Finally, these two functions can be used to convert a BCD to string in degrees, minutes,
seconds representation:
word CP_dms_OBC(OBCD *x, CP_CHAR str[]);
word CP_dms_CBC(CBCD *x, CP_CHAR str[]);
Here is an example that uses some of these functions:
OBCD x;
Cal_setpi_OBC(&x);
CP_CHAR c[100];
CP_Norm_OBC(&x, c, IM_MODE_NORM1);
CP_Fix_OBC(&x, c, 3); // c="3.142"
CP_Sci_OBC(&x, c, 2); // c="3.1e+0"
CP_digit_OBC(&x, c, IM_DIGIT_9, IM_MODE_SCI, 3); // c="3.14e+0"
short mode,short dig);
short mode,short dig);
// set x = 3.141592654...
// c="3.141592654"
104

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents