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 #88 background imageLoading...
Page #88 background image
Cal_longto_OBC(523, &x);
x.obcd1.exponential = 0x1120; // changes the value to 5.23e120
x.obcd1.exponential = 0x6004; // changes the value to -52300
x.obcd1.exponential = 0x5996; // changes the value to -0.000523
You can also create an OBCD by explicitly setting all 20 bytes of the mantissa as well as
the 2 bytes of the exponent. This is helpful when you need to define a constant OBCD.
Remember that even though it looks like the mantissa is starting with a leading zero, this
is actually the flag nibble. The first digit of the number is the second nibble and cannot
be zero. Also the last 2 bytes of the mantissa should be set to 0x00 0x00.
const OBCD PI = {{{0x03, 0x14, 0x15, 0x92, 0x65, 0x35, 0x89, 0x79, 0x00,
0x00}, 0x1000}};
const R_sqrt2by2_INIT {{{0x07, 0x07, 0x10, 0x67, 0x81, 0x18, 0x65, 0x47,
0x00, 0x00}, 0x0999}}; // 0.7071067811865475244
const R_msqrt2by2_INIT {{{0x07, 0x07, 0x10, 0x67, 0x81, 0x18, 0x65,
0x47, 0x00, 0x00}, 0x5999}}; // -0.7071067811865475244
While the previous functions require you to work on the low level OBCD structure to set
an OBCD value, the function ExecuteToOBCD() is much easier to use:
int ExecuteToOBCD(const PEGCHAR *str, OBCD &obcd, BOOL bErrCheck=TRUE);
This function takes a string representation of a floating-point value and sets the OBCD
obcd to its value. For example, the following code sets x to 3.21e-5:
OBCD x;
ExecuteToOBCD(".0000321", x);
If you pass an invalid string representation of a float into the function, then the OBCD
will be set to ERROR. For example:
OBCD x;
ExecuteToOBCD(".00003.21", x); // x=OBCD representation of ERROR
When using this function you do not have to worry about setting the exponent explicitly;
it gets set automatically by the function.
Finally, there are a few functions to set an OBCD to specific values such as infinity, pi or
e. Some of these include:
void Cal_setinfp_OBC (OBCD *x); // Place infinity in x
void Cal_setinfm_OBC (OBCD *x); // Place -infinity in x
void Cal_setundef_OBC (OBCD *x); // Place undefined in x
void Cal_settrue_OBC (OBCD *x); // Place true in x
void Cal_setfalse_OBC (OBCD *x); // Place false in x
void Cal_set05_OBC (OBCD *x); // Place .5 in x
88

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