Announcement

Collapse
No announcement yet.

variable incrementing incorrectly

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • variable incrementing incorrectly


    We are having problems with variable not incrementing correctly. Had been confirmed on 2 vex brains.

    It starts at zero and adds 1 per second. This value gets displayed to the screen.

    It goes
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    12.999
    13.999
    15

    The series then bounces back and forth from .999 to .000 about every 5 loops of the code.



  • #2
    I found the same issue a long time ago. Modkit said it was to do with floating point calculations.
    To my mind, it doesn't make sense for a language designed for programming novices not to deal with that because ot makes the logic very confusing for young children.

    Comment


    • #3
      Ideas for mitigating it? I tried to change the display to show no decimals with the hope it would round. It did not.

      If you reset the counter before it hits 12 or so the problem never appears.

      I figured it was a conversion error between decimal and binary. We tried steps of 1.5 instead of 1. The problem still appears. They really should fix this.

      Comment


      • #4
        Yeah, I never found a way round it.

        Comment

        Working...
        X