What kind of binary numeric representation is this?

154 Views Asked by At

I have these numbers from an old database file and I'm looking for the numeric representation this uses.

The numbers are stored as binary format, and they're supposedly 64-bit floating numbers, something like: 54.123 and so on.

I'm posting only natural numbers because that's what I need and the field only contains natural numbers with no fractions.

These are some numbers I have:

  • 00: 00000000
  • 01: 10000100111000000
  • 02: 1000001001110000000
  • 03: 1100001110101000000
  • 04: 100000010011100000000
  • 05: 101000011000011000000
  • 08: 10000000111000100000
  • 09: 100100001011111100000
  • 16: 011100011000000
  • 24: 10000000101010011100000
1

There are 1 best solutions below

0
On

Apparently, there are PHP classes for reading DBFs: http://www.phpclasses.org/package/1302-PHP-Extract-information-from-a-DBF-database-file.html . They say it doesn't need any extensions, it's all done with PHP functions.

Alternatively, you can inspect the DBF with various viewers to determine the format for that field.

According to this, there are several field types designed to store numbers. This talks about field types and how they're represented.

In any case, from what I understand, Numeric fields might be stored by default as ASCII, and I think are fixed length rather than floating point. So you might get away by using floatval on them.