Tip: Learn more about the API in order not to re-invent wheels.
Tip: Avoid to use float and double if you need accurate result.