diff options
-rw-r--r-- | examples/factorial.asm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/factorial.asm b/examples/factorial.asm index 42c0785..54fc956 100644 --- a/examples/factorial.asm +++ b/examples/factorial.asm @@ -1,9 +1,12 @@ ;;; factorial.asm: A program that generates the factorials of each -;;; number from 1 to 22 (22!~=UINT64_MAX). Using the registers to -;;; store `n` and `n!`. +;;; number from 1 to 20. Using the registers to store `n` and `n!`. ;; Constants - %const(limit) 22 %end + ;; Choice of 20 was not arbitrary; log(20!) ~= 61 while log(21!) ~= + ;; 65 which means that past 20! results are truncated and therefore + ;; the program produces inaccurate factorials. + + %const(limit) 20 %end ;; Setup entrypoint global main |