#include "BigNumber.h"
void setup(){
Serial.begin(115200);
delay(2000);
BigNumber::begin ();
BigNumber::setScale (20);
}
int i=1;
unsigned long time;
void loop()
{
Serial.println( i );
Serial.print( sin(i) );
Serial.print(" ");
printBignum( sine( i, precision ) );
Serial.println();
Serial.print( cos(i) );
Serial.print(" ");
printBignum( cosine( i, precision ) );
Serial.println();
Serial.println();
delay(1000);
i++;
}
// function to display a big number and free it afterwards
void printBignum (BigNumber n)
{
char * s = n.toString ();
Serial.print (s);
free (s);
} // end of printBignum
work until -15 <= i <= 15..
using a precision of 10 the range is -7 <= i <= 7
i tryed to change
while (p > 0)
into
while (p > 0.00001)
but nothing to do. I'm having some problem with my ADSL, so it's pretty hard to find alternative algorithm, i hope my adsl will feel better tomorrow ![]()