64 bit math

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,183件の閲覧回数
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,009件の閲覧回数
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,010件の閲覧回数
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,009件の閲覧回数
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 件の賞賛
返信