From 02b17c61d4c70e77c0602e89bf099ffb4fb95dd0 Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Thu, 14 Mar 2024 01:10:18 +0100 Subject: [PATCH] Add a test file working on numbers. --- drop/Base64.purs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 drop/Base64.purs diff --git a/drop/Base64.purs b/drop/Base64.purs new file mode 100644 index 0000000..d3c306d --- /dev/null +++ b/drop/Base64.purs @@ -0,0 +1,14 @@ +module Base64 where + +import Prelude (($), (+), (/), (-)) +import Data.Int (toNumber, floor) +import Data.Number ((%)) + +datasize2b64size :: Int -> Int +datasize2b64size v = + let x = toNumber v + remainder = x % 24.0 + additional_chars = (x / 24.0) + (32.0 - remainder) / 8.0 + base = x / 8.0 + in floor $ base + additional_chars +