Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data type mismatch

Status
Not open for further replies.

mani05

Programmer
Apr 16, 2009
13
IN
Hi,
I am migrating data from algol to c.I mapped real datatype in algol to double datatype in c.real has 6 bytes storage.i got one formula in unisys manual which is about the internal representation of real the formula is
mantissa * 8**(exp)
In my c program i used this formula to convert real to c but i got some precision related problem
For 10.55 in algol i will get 10.5484568985(approximately like this).can anyone help me to resolve this precision problem.
Thanks,
Mani
 
You would need to post an example (or two).
Something along the lines of

Code:
double myCovert ( unsigned char *algolbytes ) {
  // do something
}
int main ( ) {
  unsigned char algolReal[6] = {
    // 6 bytes which represent some known value in Algol
  }
  printf( "Conversion=%f\n", myConvert(algolReal) );
}

Plus, if you have an online link for the format, that would be good as well.


--
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
 
Probably you mean "to convert binary data from Burroughs systems to ...". The real constant 10.55 from Burroughs Algol source text is exactly the same as the double constant 10.55 in C (of course, except implementation defined precision).
As far as I know Burroughs single precision real data word has 39-bit mantissa. Probably your binary data conversion code is wrong because 39-bit mantissa provides ~12 decimal digits precision...
 
Is it 6 6-bit bytes or 6 8-bit bytes. Honeywell level 66 and 6 6-bit bytes which made the words 36 bits. 6 8-bit bytes would make it a 48 bit number.

Is this Algol 60 or Algol 68? Not aware of any Algol 68 implementations on Burroughs or Honeywell.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top