When I store a floating point number( such as 1,5 or 1.5) Picbasic erase the numbers after comma
is it picbasic's fault or Pic's fault??
When I store a floating point number( such as 1,5 or 1.5) Picbasic erase the numbers after comma
is it picbasic's fault or Pic's fault??
Electrical & Electronic Engineering
Undergraduate Student
No,
Just programmer's fault who hasn't read his manual at all ...
Where did you find PbP was using directly floating point numbers ??? Probably on another forum.
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
I think I couldn't explain my problem
I know this because of my poor english...
When I store 655/10 to a variable and I write it in lcdout command it shows only 65
I thought that pbp shows only number that are located before comma but when I product this variables with 100, at this time it showed 650
Did you understand now?? I'm so bored, I tend to give up using pbp...
because I saw that I can set variables as double or float in pic c...
I don't want to stop using pbp heeelllppp...!!!!
my pbp version:2.47
mcs version 3.0.0.0
Electrical & Electronic Engineering
Undergraduate Student
I designed a code that takes a numeric variable such as 12.34. But when I put it a var. picbasic takes it as "12" !!!
Anybody can solve this problem??
Electrical & Electronic Engineering
Undergraduate Student
in other word;
how can I define double var. and use it in picbasic freely??
Electrical & Electronic Engineering
Undergraduate Student
I comprehend that I must use 12.34 as 1234 and when I am using I must divide it 100.....
Problem solved I wish I use 12.34 directly but....
Thanks
Electrical & Electronic Engineering
Undergraduate Student
If you read the PBP Manual you will discover it only handles INTEGERS.
If you have a BYTE, your numbering is 8 bits from 0-255 (NO DECIMAL PLACES)...
If you have a WORD, your numbering is 16 bits 0-65535 (NO DECIMAL PLACES)...
If you lave a LONG etc etc the rest is in your documentation.
Theis does not mean you can't do Floating Point Math, but it means you have to stay within the limitations of the variables that you are using. If you want two decimal places precision example 12.34 then you must store it as 1234 and insert the Decimal Point accordingly when you need to Display or Print your variable.
thanks Melanie I did it as you said
Electrical & Electronic Engineering
Undergraduate Student
Bookmarks