From 02186998d93483476e70d04dd2fb8a6bd4297d34 Mon Sep 17 00:00:00 2001 From: Miguel David Salcedo Date: Wed, 5 Jan 2022 20:08:24 +0000 Subject: [PATCH] Add a floor function to factorial example --- docs/src/factorial.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/src/factorial.md b/docs/src/factorial.md index ddc3a14a..9dc644a2 100644 --- a/docs/src/factorial.md +++ b/docs/src/factorial.md @@ -9,9 +9,11 @@ In this chapter we will implement [factorial](https://en.wikipedia.org/wiki/Fact Create a file named `factorial.ta` with the following contents: ```tortuga -@round(@n) = round(n, n % 1) -@round(@n, @remainder >= 0.5) = 1 + n - (n % 1) -@round(@n, @remainder < 0.5) = n - (n % 1) +@floor(@n) = n - (n % 1) + +@round(@n) = round(floor(n), n % 1) +@round(@n, @remainder >= 0.5) = 1 + n +@round(@n, @remainder < 0.5) = n @factorial(@n = 0) = 1 @factorial(@n > 0) = [