SoFunction
Updated on 2025-04-09

Short int, long, float, double usage problem description

short int short integer 2 bytes Value range -32768~32767
long long integer 4 bytes Value range -2147483648~2147483647 float Single precision 4 bytes Value range -3.4*10(-38)~3.4*10(38)
double Double precision 8 bytes Value range -1.7*10(-308)~1.7*10(308)


This problem is encountered when exporting Access data to DBF, the field width in DBF does not refer to the number of bytes occupied by the fields in Access, but the number of characters. In DBF, both integers and floating-point numbers are stored in characters. For example: -3.134 is stored as "-3.135", accounting for a total of 6 characters.
so
For short integers in Access, the field width stored as DBF is 6;
For long integers in Access, the field width stored as DBF is 11;
For single precision in Access, the field width in DBF is 18 and the decimal is 7;
For double precision in Access, the field width in DBF is 24 and the decimal is 15.
That is to say, it is difficult to ensure accuracy when dumping single-precision and double-precision data in access into DBF.