how to declare the variable for a real number?
stevenoo
Posts: 4
· hi,
····
····· if I want to do this arithmetic:·· 2.5 * 3.1 = 7.71
In basic stamp editor, I wrote like this
····· x·· var byte
····· y·· var byte
···· ans var byte
· main :
·········· x=2.5
·········· y=3.1
········· ans = x*y
········· debug ans
· end
·but it give me some error, anyone can help?
····
····· if I want to do this arithmetic:·· 2.5 * 3.1 = 7.71
In basic stamp editor, I wrote like this
····· x·· var byte
····· y·· var byte
···· ans var byte
· main :
·········· x=2.5
·········· y=3.1
········· ans = x*y
········· debug ans
· end
·but it give me some error, anyone can help?
Comments
·· The BASIC Stamp cannot do floating point math directly, only integer math.· You would either have to calculate the values differently or get a floating-point co-processor.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Here it is:
http://www.parallax.com/detail.asp?product_id=604-00030
Neil Peart=54 today.
Engin
Engin
··· it is very helpful to me, many thanks friends.