Math problem with PBP 2.6 and 18F4550, large numbers
hey everyone, ive been reading up on the multiply and divide funtions of PBP, not sure I understand this, it states that when it multiplys it actually does it as a 32bit number and spits it into two parts, not sure how this will help me. I need to multiply this set of numbers below, This is my max numbers.
Code:
A=20000
B=20000
C=A*B '400,000,000 (much larger than 65536)
D=C/1000 '400,000 (still too large)
Lcdout "Output=",Dec (D / 1000), ".", Dec3 (D // 1000) ' Displays (Output=400.000)
I know PBP3 has the long funtion, but hey I dont have PBP and wont be getting it soon.
So if anyone can help me with this....
Re: Math problem with PBP 2.6 and 18F4550, large numbers
Sounds like you need some big integer library integer functions. I only know of one of these written in a basic dialect. But there may be one that already exists for PBP?
Re: Math problem with PBP 2.6 and 18F4550, large numbers
The PBPL compiler (with LONG vars) was introduced in version 2.50 ... so you already have it.
In MicroCode Studio, go to View > Compile and Program options > Compiler tab, and check the "Use PBPL" checkbox.
Re: Math problem with PBP 2.6 and 18F4550, large numbers
Ah thank you thank you thank you....
actually i had to reinstall PBP 2.6, i had a backup on the pc of 2.46, and one of the kids deleted the compiler for 2.6 and went back to the 2.46, so i reinstalled, and checked that option.
i havent tryed the math but it let me assign a 40000000 number to the VAR so it should work.