Performing Operations On Cbcds; Converting Cbcds; Bcd Converter Tool - Casio ClassPad 300 Programming Manual

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

Advertisement

Performing Operations on CBCDs

Most of the operations available to OBCDs are also available to CBCDs. A complete list
can be found in the ClassPad 300 SDK API Reference Guide under Math Functions-
>Complex (CBCD) Math Functions. Just like CBCD functions, these functions do not
return the result but a return code. Here is a simple example:
CBCD x, y;
Cal_longto_OBC(3, &x.repart);
Cal_longto_OBC(5, &x.impart);
Cal_longto_OBC(1, &y.repart);
Cal_longto_OBC(6, &y.impart);
if(Cal_add_CMP(&x, &y) != IM_CAL_NORM)
{
// an error occurred!
}

Converting CBCDs

Since CBCDs are complex numbers, they cannot be converted to longs or shorts like
OBCDs. You can, however, convert a CBCD to a string. The functions are very similar
to the ones used to convert CBCDs. You can view them all in the ClassPad 300 SDK
API Reference Guide under Strings->Functions to convert OBCD/CBCD data types to
strings.
Here is a quick example of converting a CBCD to a string:
CBCD x;
CP_CHAR buffer[30];
Cal_longto_OBC(1525, &x.repart);
// set x = 1525
x.repart.obcd1.exponential = 0x1001;
Cal_longto_OBC(32, &x.impart);
CP_15digit_CMP(&x, buffer);
// puts 15.25+32i in the buffer

BCD Converter Tool

The BCD Converter Tool is bundled with the SDK to simplify the creation of BCDs. It is
accessible under the Tools Menu of Dev-C++.
92

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ClassPad 300 and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents