64 bit math

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

64 bit math

Jump to solution
456 Views
chop
Contributor I

I'm attempting to build a DDS setup using A 9S08DN32 , and C in codewarior  , I've set up the floating point options with double as IEEE64 ( which I've assumed will allow me to go past a 32 bit limit , and yes I'm a newbie and with no formal C training )  Entering large numbers ( above the 32 bit limit gives me a, "illegal number" error , so I can't do the math required to program the DDS !!

I'm taking the basic code outline  from an Adruino project which runs without any problems and seems to handle very large numbers without batting an eyelid , however I want to use a Freescale MCU :-)  I'm assuming I'm making some obvious mistake , or is codewarrior/ 9s08 MCUs  limited compared with the Arduino ?

 

Art

Labels (1)
0 Kudos
1 Solution
282 Views
kef
Specialist I

 Try adding decimal point at the end of the number. I mean

 

 double d;

 

   d = 5000000000; // <-- illegal error

   d = 5000000000.0; // <-- OK

 

Integer 5000.. doesn't fit 32bit integer. Since this compiler doesn't support long long int type, probably it complines about all integer constants, which don't fit 32bits. Your Arduino compiler may support long long's.

 

BTW Should we guess how do you enter your big number? Is it so hard to copy paste few lines, which trigger compiler error?

View solution in original post

0 Kudos
2 Replies
283 Views
kef
Specialist I

 Try adding decimal point at the end of the number. I mean

 

 double d;

 

   d = 5000000000; // <-- illegal error

   d = 5000000000.0; // <-- OK

 

Integer 5000.. doesn't fit 32bit integer. Since this compiler doesn't support long long int type, probably it complines about all integer constants, which don't fit 32bits. Your Arduino compiler may support long long's.

 

BTW Should we guess how do you enter your big number? Is it so hard to copy paste few lines, which trigger compiler error?

0 Kudos
282 Views
chop
Contributor I

That certainly clears up the erroe message , so it's now onward and upward :smileyhappy:

 

Many thanks for the reply

 

Art

0 Kudos