Shop OBEX P1 Docs P2 Docs Learn Events
BS2sx NCD FUNCTION — Parallax Forums

BS2sx NCD FUNCTION

Sarah RoseSarah Rose Posts: 7
edited 2008-03-24 18:04 in BASIC Stamp
Can the NCD function recieve a decimal value, or does it have to receive a binary value?

Can I say, for example:

V2= V1/8

Result = NCD V2


Also, can i use decimals in the code, like the value 8.2, or will it only accept integers?

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-03-24 18:01
    Hi, yes NCD will work on a decimal formatted number, the Stamp does all it's math in binary, a decimal number is just a binary number formatted so that we can interperet in a way that we are used to, so the Stamp sees 24 and %11000 as being the same thing.

    The Stamp only works 16 bit binary values and only works with integers, but in some cases it is possible to work round what you want.This link has some great info on the Stamp and math.· http://www.emesys.com/BS2index.htm#math

    Jeff T.
  • Sarah RoseSarah Rose Posts: 7
    edited 2008-03-24 18:04
    oh, so like using a fraction to represent a decimal number could work?

    thanks!
Sign In or Register to comment.