Links

AaveMath

Because the EVM does not support floating points, the Aave protocol's calculations are carried out using a RAY-point number system which allows manipulating decimal numbers using a fixed-point representation, the unit being the RAY = 1e27.

Standard arithmetic

Multiplication

Given two RAY-point numbers x and y, their multiplication is defined as x * y / RAY

Division

Given two RAY-point numbers x and y, their division is defined as x * RAY / y
The operation is wrapped inside a first-place RAY multiplication and last-place RAY division to cancel its effect. The purpose of this is to keep at least 18 significant digits (the precision of the base: the RAY) in the result.