Why Do "Yes/No" Values in Microsoft Access Map to -1 and 0?

The use of -1 puzzles me. I would have expected the values to be:

  • NO --> 0
  • YES --> +1

Is there an historical reason behind the use of -1 instead of +1?

4

1 Answer

As discussed on Stack Overflow here, Yes/True values appear in Access as -1 because

  • Yes/No fields in Access mimic bit fields,
  • Integer values in Access are signed, two's complement values,
  • No/False is represented by 0, and
  • the only other two's complement value of a 1-bit number is -1. To illustrate, two's complement numbers can have the following values:

3-bit:

bits  integer
----  -------
000         0
001         1
010         2
011         3
100        -4
101        -3
110        -2
111        -1

2-bit:

bits  integer
----  -------
00          0
01          1
10         -2
11         -1

1-bit:

bits  integer
----  -------
0           0
1          -1

For the integer representation of a bit field (i.e., 1-bit), if 0 is No/False then the only other value available for Yes/True is -1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest