Add a test file working on numbers.

dev
Philippe Pittoli 2024-03-14 01:10:18 +01:00
parent 1adb688b9b
commit 02b17c61d4
1 changed files with 14 additions and 0 deletions

14
drop/Base64.purs Normal file
View File

@ -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