Add a test file working on numbers.
parent
1adb688b9b
commit
02b17c61d4
|
@ -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
|
||||
|
Loading…
Reference in New Issue