11.001001000011111101101010100010001000 Arithmazium
Home

Small integers

Extend the tests to small integers, with \(\pm 1/2\) added for good measure.

test_cond(err_failure, (THREE == TWO + ONE)
          and (FOUR == THREE + ONE)
          and (FOUR + TWO * (-TWO) == ZERO)
          and (FOUR - THREE - ONE == ZERO),
          "3 != 2+1, 4 != 3+1, 4+2*(-2) != 0, or 4-3-1 != 0")
test_cond(err_failure, (MINUS_ONE == (0 - ONE))
          and (MINUS_ONE + ONE == ZERO)
          and (ONE + MINUS_ONE == ZERO)
          and (MINUS_ONE + fabs(MINUS_ONE) == ZERO)
          and (MINUS_ONE + MINUS_ONE * MINUS_ONE == ZERO),
          "-1 != 0-1, -1+1 != 0, 1+(-1) != 0, "
          + "(-1)+abs(-1) != 0, or -1+(-1)*(-1) != 0")
test_cond(err_failure, ONE_HALF + MINUS_ONE + ONE_HALF == ZERO,
          "1/2 + (-1) + 1/2 != 0")
Home