Defining Floating Point Constants

Is there any way to defining floating point constants without resorting to Tables?

For example:

halfpi con 1.5707963267948966192313216916398

According to the Atom Pro manual, page 44:

“The numeric type is automatically set by the compiler based on the value you enter.”

The compiler is complaining when I multiply the constant halfpi by some floating point indicating a type mismatch, so it seems that the constant syntax (con) only like integers?

for instance:

halfpi con 1.5707963267948966192313216916398
PiTimesTwo var float

PiTimesTwo = halfpi * 2.0

My compiler complains…

???

worst case you can do it manually by declaring halfpi as a float and setting it with an assignment during initialization.

oh, and PiTimesTwo = halfpi * 4, not 2. :wink:

Thanks Eddie! Yeah, I came up with that arbitrary example on the fly and didn’t check my math… :blush:

I guess it’s back to variable…

I was just hoping that it can be constants, since I didn’t want to take up the precious RAM and let the number be in program space, ROM…

Thanks for your help!

:smiley:

For floating point canstants use FCON instead of CON.

myfloat fcon 1.23456

I don’t remember why con doesn’t work with floating point values(there was a reason though, I think) but fcon will force the constant to be calculated as a floating point value even in a situation like:

myfloat fcon 10

:smiley: :smiley: :smiley:

THANK YOU! It worked like a charm!