I have the source code in RTL/2 program languange of an old application running on a VAX machine. Unfortunately I don't have the possibility\ability to re-compile the application. I have to change some coefficent ( real numbers, "code wired")
So I had an idea: i could change directly these numbers in the executables ( some .cm8 files, these are big files where all lines start with a ":" then a sort of ADDRESS and the HEX data)
unfortunately if i take for istance one of the coefficents (es 3.8262619e-09) and i rapresent it in binary I obtain:
es 3.8262619e-09 In binary is : 00110001100000110111100000101000 hex is: 0x31837828 hex in reverse endianess: 0x28788331
But if I search for those HEX in the executable files... I do not find matches. If i could find these number in the executable i would like to change them directly. The problem, I presume, is that the VAX machine does not rapresent floating point using IEEE 754 standard. I found this link https://nssdc.gsfc.nasa.gov/nssdc/formats/VAXFloatingPoint.htm Which explains the floating point rapresentation on a vax machine, But I do not understand how to rapresent my real numbers ( es the 0.38262619E-08 I found directly in the source code) in VAX floating point format.
Any help?
This answer assumes that the format used for the floating-point data is the 32-bit VAX
F_floating
format. This is similar to IEEE-754binary32
. A normalized binary floating-point format, allowing the most significant bit of the significand (mantissa) to be assumed to be 1 and not stored. Both use an 8-bit biased exponent.The
binary32
format has a significand range of [1, 2) whileF_floating
has a significand range of [0.5, 1). The exponent bias used by thebinary32
format is 127 while the exponent bias of theF_floating
format is 128. In combination, this means that identical encodings in the two formats are numerically offset by a factor of four. TheF_floating
format does not support signed zero, subnormals, infinities, and NaNs.Because of compatibility with the 16-bit PDP-11,
F_floating
uses a non-intuitive byte storage ordering. When examining the memory image in ascending address order, the four bytes of aF_floating
operand occur in the order 2, 3, 0, 1.For the following ISO-C99 program, I assume that the code is executing on a system that utilizes IEEE-754 floating-point arithmetic.