PDA

View Full Version : does PicBasic do that?



HYETİK
- 5th April 2009, 14:42
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??

Acetronics2
- 5th April 2009, 14:48
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

ScaleRobotics
- 5th April 2009, 16:04
When I store a floating point number( such as 1,5 or 1.5) Picbasic erase the numbers after comma:(

Store your 1.5 as 15 (or 15,0) and your float will float with picbasic.

HYETİK
- 5th April 2009, 19:40
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

HYETİK
- 5th April 2009, 19:42
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??

HYETİK
- 5th April 2009, 19:44
in other word;

how can I define double var. and use it in picbasic freely??

HYETİK
- 5th April 2009, 20:06
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:)

anode505
- 6th April 2009, 14:34
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:)

PBP has the FP library. I gave it 1/2 a try years ago and got nowhere. Found the multiply by 100 and MODs worked just fine.

Melanie
- 6th April 2009, 15:11
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.

HYETİK
- 6th April 2009, 21:53
thanks Melanie I did it as you said:)