...

for example "43.375" is in memory "00 00 80 35 86". How are the conversion/calculations rules?

I know that most left byte = LSB and the forth byte = MSB and the most right byte = exponent. That's all!??

First of all, there is no way a six year old will be able to understand that, unless he's a genius.

Second, your representation of 43.375 in memory is wrong. It should be "00 00 80 2D 86".

This link might help:

Technical information about Locomotive BASIC - CPCWiki - The Ultimate AmstradBut I have to say the order of the mantissa bits in the structure is also wrong!

The first byte contains the least significant bits of the mantissa, and every following byte up to the fourth byte contain the bits following the first in significance and in exactly that order!

That means that you have to turn around the first four bytes if you want to read the mantissa correctly:

2D800000

or

0010.1101.1000.0000.0000.0000.0000.0000

in binary (the stops are inserted for better readability).

Now the highest significant bit here is 0, so the number is positive.

What's more, you need to clear that bit and substitute the implied highest bit (see description in the link), which is always 1 (regardless of the deleted sign bit!!!).

Thus you get:

AD800000

or

1010.1101.1000.0000.0000.0000.0000.0000

in binary.

The mantissa has an implied decimal point before the number. Since the number is 2^32 bits (i.e. 4 bytes) long you have to divide by 2^32 to get the proper decimal representation.

AD800000 (hex) = 2910846976 (dec)

2910846976 / 2^32 = 0.677734375

The mantissa in a decimal representation is:

0.677734375Now, the last byte contains the exponent: 86 (hex) or 134 (dec). You need to subtract 128 to get the real exponent, the highest bit tells you that the exponent is positive (1) or negative (0). Your exponent is 6.

0.677734375 * 2^

6 = 43.375

Another example:

PI is represented in memory as:

A2 DA 0F 49 82

The mantissa is

490FDAA2 (highest significant bit is zero => number is positive)

The exponent is

82 (=positive mantissa, value=2 thus multiply mantissa with 2^2)

Delete the sign bit (which is 0 anyway), and then add the implied 1 bit:

C90FDAA2 (hex) = 3373259426 (dec) = 1100.1001.0000.1111.1101.1010.1010.0010 (bin)

Calculate the decimal representation of the mantissa:

3373259426 / 2^32 = 0,7853981633670628070831298828125

Then add the exponent (82h - 80h = 2 thus 2^2)

0,7853981633670628070831298828125 * 2^

2 = 3,14159265346825122833251953125

Voilà! The internal representation of the number PI on the CPC is:

3,14159265346825122833251953125If you compare to a (more) correct representation of PI, you'll see that the CPC is correct up to the 9th decimal place:

CPC:

3.141592653

46825122833251953125more correctly:

3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986...