64 bit math

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

64 bit math

跳至解决方案
1,265 次查看
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

标签 (1)
0 项奖励
回复
1 解答
1,091 次查看
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 项奖励
回复
2 回复数
1,092 次查看
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 项奖励
回复
1,091 次查看
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 项奖励
回复