Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
mkdmbf and mks
#1
how to read qbasic mkdmbf fornat from "C" language

i need to know please
Reply
#2
ah you mean qb's function:

Quote:Syntax: MKDMBF$(double-precision-expression)
MKDMBF$ - conversion functions that convert an IEEE-format number to a string containing a Microsoft Binary format number.

You could try load the file with the MKDMBF$() numbers in Qb, convert them to proper human readable numbers with CVDMBF() and save them as a text file.

Then reading in C will be much easier.
Reply
#3
And if you want to do the conversion directly in C, maybe this info will help you (from Ethan Winner)
Quote:FLOATING POINT VALUES
=====================

Floating point variables and numbers are constructed in an entirely
different manner than integers. Where integers and long integers simply
use the entire two or four bytes to hold a single binary number, floating
point data is divided into portions. The first portion is called the
mantissa, and it holds the base value of the number. The second portion is
the exponent, and it indicates to what power the mantissa must be raised to
express the complete value. Like integers, a sign bit is used to show if
the number is positive or negative.
The structure of single precision values in both IEEE and the original
proprietary Microsoft Binary Format (MBF) is shown in Figure 2-2. For IEEE
numbers, the sign bit is in the most significant position, followed by
eight exponent bits, which are in turn followed by 23 bits for the
mantissa. Double precision IEEE values are structured similarly, except
eleven bits are used for the exponent and 52 for the mantissa.
Double precision MBF numbers use only eight bits for an exponent
rather than eleven, trading a reduced absolute range for increased
resolution. That is, there are fewer exponent bits than the IEEE method
uses, which means that extremely large and extremely small numbers cannot
be represented. However, the additional mantissa bits offer more absolute
digits of precision.


The IEEE format:
Code:
+--------+--------+--------+--------+
|SEEEEEEE|EMMMMMMM|MMMMMMMM|MMMMMMMM|
+--------+--------+--------+--------+
The MBF format:
Code:
+--------+--------+--------+--------+
|EEEEEEEE|SMMMMMMM|MMMMMMMM|MMMMMMMM|
+--------+--------+--------+--------+
Figure 2-2: A single precision value is comprised of a Sign bit, eight
Exponent bits, and 23 bits to represent the Mantissa. Each letter shown
here represents one bit, and the bytes on the left are at higher addresses.


Notice that with IEEE numbers, the exponent spans a byte boundary. This
undoubtedly contributes to the slow speed that results from using numbers
in this format when a coprocessor is not present. Contrast that with
Microsoft's MBF format in which the sign bit is placed between the exponent
and mantissa. This allows direct access to the exponent with fewer
assembler instructions, since the various bits don't have to be shifted
around.
Antoni
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)