Shop OBEX P1 Docs P2 Docs Learn Events
_REMAINDER in SX/B — Parallax Forums

_REMAINDER in SX/B

ChrisPChrisP Posts: 136
edited 2006-01-14 14:47 in General Discussion
How would the remainder of a repeating decinal be stored in this variable? Is it limited to the number of places right of the decimal, or under the 255 limit somehow?

Temp1 = 256 / 75········· <3.4133333>
Tenths = _REMAINDER··· <413333333> ?

Temp1 = 3
Tenths = ?·· 4133333333? 4? 41?

Hoping for 4, betting on 41

Thanks, Chris

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-14 14:09
    Remember that everything is done in whole numbers, so 256 / 75 is 3 with a remainder of 31.· If you check on a calculator, 31 / 75 = 0.4133333.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • BeanBean Posts: 8,129
    edited 2006-01-14 14:11
    Chris,
    The remainder would be 31. Just like long dividsion in elementary school.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    "Ability may get you to the top, but it takes character to keep you there."
    ·
  • ChrisPChrisP Posts: 136
    edited 2006-01-14 14:47
    John

    Thanks, guess I shouldnt post questions at 5 in the morning... Was working in a fractional problem and couldnt get decimals out of my head. That and 256 gets truncated, going from 16 bit calculations to 8 is a stretch for me. Suppose I'll get the hang of it eventually.

    Post Edited (ChrisP) : 1/14/2006 4:03:21 PM GMT
Sign In or Register to comment.