Log in

View Full Version : Math problem with PBP 2.6 and 18F4550, large numbers



wdmagic
- 3rd January 2013, 01:08
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.


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....

TinkersALotV2
- 3rd January 2013, 01:35
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?

Darrel Taylor
- 3rd January 2013, 03:15
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.

wdmagic
- 3rd January 2013, 04:41
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.