Bmfloat::floor

From RoutineWiki

Jump to: navigation, search

Contents

Methods

  • bmfloat_temp& floor() const


Return values

These operators return a temporary big float representation of the largest integer lower than the big float object.

Example

The following program,

#include "stdio.h"
#include "bigmath.h"


int main(int argc, char* argv[])
{
    using namespace bigmath;
    Globals::SetPrecission(600);
    bmfloat z = 1;
    bmfloat count = 100;
    while(count--!=0)
    {
        z=z+1/z;
    }
    char *result = z;
    printf("result = %s\r\n",result);
    free(result);
    result = z.floor();
    printf("floor() = %s\r\n",result);
    free(result);

    return 0;
}


produces the output

result = 1.4284064040284605057826485316730044924742870192381243597531278871501450646821135
694727270094597856359753000318320713131175463585139515665998857155884910677584439315728122
081668964355536504733367060008877405190479040832980820706217413339299074226532120320108705
861363643310676767894176418941648657610277309746183536449687504827760170210744799350731949
703305689931926917240739997946163956644143379292493492730883503737425201968555679415212138
776804016875180720618005731244809913478985982190322342444830399903224893588362838565685224
3742820500316377657261621762502160797302096127047607717827102886027053E1
ceil() = 1.3999999999999999999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999E1
Press any key to continue

See also

Personal tools