 # Examples of BigNumber library (Power_of_E) only works for integer numbers

Is it possible that Examples of BigNumber library like (Power_of_E) can be implemented for fractional numbers ?

I had try to find power of E for fractional numbers using big number library, but during calculations code only consider integer part of given value. Following is the code that is the same as example given in BigNumber library..

``````// BigNumber test: calculate power of E
#include "BigNumber.h"

BigNumber ePower (BigNumber x)
{

// if x > 1 halve it and square the result
if (x > 1)
{
BigNumber e = ePower (x / BigNumber (2));
return e * e;
}  // end of x > 1

// some big numbers
BigNumber n = 1, e = 1, t = 1;

int i = 1;
BigNumber E;

do
{
E = e;
n *= i++;  // n is i factorial
t *= x;    // t is x^i
e += t / n;
} while (e != E);

return e;
} // end of function ePower

void setup ()
{
Serial.begin (115200);
Serial.println ();
Serial.println ();
BigNumber::begin (65);   // max around 65 on the Uno for a power of 5

Serial.println (ePower (5));  // e  ^ 5

Serial.println (ePower (5.5));  // e  ^ 5.5

Serial.println (ePower (-8));  // e  ^ -8

Serial.println (ePower (-8.5));  // e  ^ -8.5

} // end of setup

void loop () { }
``````

Output of the given code is

148.41315910257660

148.41315910257660

0.0003354626279025

0.0003354626279025

*****OUTPUT*********

That is same for integer and floating point values

Is it possible to make the code generalized that can work both for integer and fractional point values ?

Even Multiplication of integer number and a fractional point number gives wrong answer.

``````// BigNumber test: multiplication
#include "BigNumber.h"

void setup ()
{
Serial.begin (115200);
Serial.println ();
Serial.println ();
BigNumber::begin ();  // initialize library

// test multiplication
BigNumber a = "12345";
BigNumber b = "0.555";
BigNumber c = a * b;
Serial.println(" Multiplication of a and b is = ");

Serial.println (c);

}  // end of setup

void loop () { }
``````

gives output as

***OUTPUT******

Multiplication of a and b is = 0