Shop OBEX P1 Docs P2 Docs Learn Events
over-flow — Parallax Forums

over-flow

Jan DvorakJan Dvorak Posts: 44
edited 2006-08-08 21:14 in BASIC Stamp
I need figure out this arithmetical formula with PBASIC 2.5 (BS2p24):

P = 1000*(1+(1000000/(75*n)))

where "n" is variable

but PBASIC says that constant 1000000 exceeds 16 bit. Is there any possibility how to figure it out?

Comments

  • T ChapT Chap Posts: 4,223
    edited 2006-08-08 21:09
    Isn't 65500 (or so) the limit at 16 bits? You'd have to scale the formula so all values (or derivations) are below 16 bit (65k) to make it work.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-08-08 21:14
    P = 1000*(1+(1000000/(75*n))) =
    1000 + 1000*(13333/n) + (1000/(3*n)) =
    1000 + 1000*(13333/n) + (333/n)

    regards peter
Sign In or Register to comment.