nickgammon / BigNumber

BigNumber library for the Arduino
MIT License
88 stars 22 forks source link

BigNumber #15

Closed Liangkerui closed 5 years ago

Liangkerui commented 5 years ago

@nickgammon Firstly, thanks for your BigNumber library. I get some issue when i use your library,i do not know if it is because of a stupid mistake or other reason. BigNumber calculation

This is the code

include

include "BigNumber.h"

BigNumber latitude="35.95568352"; BigNumber longitude="120.1484011";

void setup (){ Serial.begin(9600); BigNumber::begin (15);

BigNumber pi ("3.1415926535897"); BigNumber a ("180"); BigNumber latitude_rad = latitudepi/a; // latitude in rad BigNumber longitude_rad = longitudepi/a; // longitude in rad Serial.println(); Serial.println(); Serial.println(latitude_rad); Serial.println(longitude_rad); }

void loop(){}

nickgammon commented 5 years ago
 BigNumber latitude_rad = latitudepi/a; // latitude in rad

That code doesn't even compile. Is that your problem?

/tmp/arduino_modified_sketch_443397/sketch_aug17a.ino: In function 'void setup()':
sketch_aug17a:13: error: 'latitudepi' was not declared in this scope
 BigNumber latitude_rad = latitudepi/a; // latitude in rad
                          ^

If not, please post your code that you are actually using.

Liangkerui commented 5 years ago

sorry,there is mistake happened when i copy and paste the code.The * is missing,I do not know how it happened. The following is the code i use.

include

include "BigNumber.h"

BigNumber latitude="35.95568352"; BigNumber longitude="120.1484011";

void setup (){ Serial.begin(9600); BigNumber::begin (15);

BigNumber pi ("3.1415926535897"); BigNumber a ("180"); BigNumber latitude_rad = latitudepi/a; // latitude in rad BigNumber longitude_rad = longitudepi/a; // longitude in rad Serial.println(); Serial.println(); Serial.println(latitude_rad); Serial.println(longitude_rad); } void loop(){}

Liangkerui commented 5 years ago

I know the reason,i make stupid mistake. I shall write these two line "BigNumber latitude="35.95568352"; BigNumber longitude="120.1484011"; after " BigNumber::begin (15);"

Thanks.