|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Floating point math in PBASIC
I was wondering if anyone can help me with how to do floating point math on a Basic Stamp 2? I know your not directly able to do it on them but is there anyway to get around it?
|
|
#2
|
|||||
|
|||||
|
Re: Floating point math in PBASIC
Multiply everything by 1000.
1.759 becomes 1759 3.14 becomes 3140 etc. |
|
#3
|
|||||
|
|||||
|
Re: Floating point math in PBASIC
Quote:
Quote:
To do true floating point, you need to use a variable scaling factor rather than just picking e.g. 1000 in advance, and you have to keep track of the scaling when multiplying and dividing. (When you add or subtract, you need to equalize the scaling factors first.) |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Math in careers | EricH | Career | 40 | 24-06-2008 21:45 |
| 16 bit math on PIC | sciguy125 | Programming | 17 | 07-10-2005 02:57 |
| Converting floating point to integers | logicalhippo | Programming | 3 | 29-01-2005 12:10 |
| PBasic 2.5 vs. 2.0 | Anthony Kesich | Programming | 6 | 09-02-2003 22:06 |
| Possible Configuration to keep things cheap | archiver | 1999 | 8 | 23-06-2002 23:03 |