# Memory App Programming

### Decimal

``````
echo 10; // Output 10
echo -1; // Output -1
echo 0; // Output 0
echo 1452; // Output 1452
``````
(1/4)

### Octal

This is Unix style access permision (identified by its leading zero)
``````
echo 0100; // 64 = 1*8^2 + 0*8^1 + 0*8^0
``````
(2/4)

Base 16 notation (identified by its leadgin 0x case-insensitive)
``````
echo 0x111; // 1*16^2 + 1*16^1 + 1*16^0 = 256 + 16 + 1 = 273
echo 0x112; // 1*16^2 + 1*16^1 + 2*16^0 = 256 + 16 + 2 = 274
echo 0x121; // 1*16^2 + 2*16^1 + 1*16^0 = 256 + 32 + 1 = 289

echo 0xFFF; // 15*16^2 + 15*16^1 + 15*16^0 = 3840 + 240 + 15 = 4095
``````
(3/4)

### Float

Be aware that the float data type is not always capable of representing numbers in the way you expect it to.
``````
echo ((0.1 + 0.7) * 10); // output 8
echo (int) ((0.1 + 0.7) * 10); // output 7
``````
This happens because the result of this simple arithmetic expression is stored internally as 7.999999

Questions

Top Reference > Programming
0/0 (80)
Not Logged