Source: https://www.claine.fr/fichiers/algorithmique/algo_casio.pdf