Assigning an IBinaryCodedDecimal to a Float

To convert an IBinaryCodedDecimal object to a floating-point type:

#include <idecimal.hpp>
#include <iostream.h>
int main(void) {
   IBinaryCodedDecimal dec_1("123.45");
   IBinaryCodedDecimal dec_2("-123456.12345");
   float f1,f2;
   f1=dec_1;
   f2=dec_2;
   cout <<"f1=" <<f1 <<endl <<"f2=" <<f2 <<endl <<endl;
   }

The representation of a floating point number will not exactly match the value of the IBinaryCodedDecimal object being converted.



Representing Numerical Quantities Using IBinaryCodedDecimal
Performing Calculations Using IBinaryCodedDecimal
Assigning One IBinaryCodedDecimal to Another
Assigning an IBinaryCodedDecimal to an Integer


What Is a Binary Coded Decimal