EasyManuals Logo
Home>Casio>Calculator>ClassPad 300

Casio ClassPad 300 Programming Guide

Casio ClassPad 300
125 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #91 background imageLoading...
Page #91 background image
C++ Functions
It is important that you understand and can use the OBCD functions that we’ve covered
up to this point. This is how doubles are stored and used natively on the ClassPad. There
are, however, some functions available in C++ that are more human readable. You can
view all of these functions in the ClassPad 300 SDK API Reference Guide under Math
Fuctions->C++ Math Functions. Here is an example of how they work:
OBCD x, y;
Cal_longto_OCB(170, &x);
y = sin(x);
if(y == x)
{
x = x * y;
}
else
{
y = x + y;
}
As you can see, these are much more intuitive than the C functions. Remember that these
functions will only work in C++; you cannot use them in C.
CBCD Data Structure
A CBCD is used to hold a complex number. Its structure is defined as:
typedef struct cbcd {
OBCD repart;
OBCD impart;
} CBCD;
As you can see from the structure, a CBCD is really just two OBCDs. One OBCD –
repart – holds the real part of the CBCD and the second OBCD – impart – holds the
imaginary part.
Setting the Value of a CBCD
Since a CBCD is just 2 OBCDs, setting the value of a CDCB is just like setting the value
of 2 OBCDs. For example, if you wanted to create the value 2.5 + 3i you just have to
create a CBCD with real part 2.5 and imaginary part 3. Here is the code to do that:
CBCD x;
Cal_longto_OBC(25, &x.repart); // set x’s real part to 25
// change the real part’s exponent to 10^0
x.repart.obcd1.exponential = 0x1000;
Cal_longto_OBC(3, &x.impart); // set x’s imaginary part to 3
The result is the value 2.5+3i being stored in x.
91

Table of Contents

Other manuals for Casio ClassPad 300

Questions and Answers:

Question and Answer IconNeed help?

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

Casio ClassPad 300 Specifications

General IconGeneral
BrandCasio
ModelClassPad 300
CategoryCalculator
LanguageEnglish

Related product manuals