next up previous contents
Next: Variables Up: Multi-Precision Floating Point Previous: Header Files

Usage Examples

  #include "bigfloatpt.h"

  BigFloat::Class_name = "BigFloat";  // Set the global name (once-only)
  int
  main(int argc, char** argv)
  {
    BigFloat a = 5.1;                 // Creates a BigFloat type with value 5 
    BigFloat b = 8;                   // Creates a BigFloat type with value 8 
    BigFloat c = a+b ;                // Add a + b and store in c. 
    cout << c;                        // Prints result to standard output. 
    if (is_zero(c))                   // Test for zero
      cout << "Result is 0\n"; 
    a = bigfloat(5);                  // Use LEDA type bigfloat
    b = integer(4);                   // Use LEDA type integer 
    c = a/b; 
  }

1.0



Ashu Rege
Fri May 9 17:57:21 PDT 1997