summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-07-11 18:02:26 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-07-11 18:02:26 +0200
commitacb9dd3220a3edcac93aa11d1d74d008e2fb23ed (patch)
tree98b45af3f7eb9c7d812ed33a07e6a0f665a7a8cd /src/shared/util/shr_math_util.erl
parentfde827cba1ff3d889135c74ee1978098465fd200 (diff)
"sh_" -> "shr_".
Diffstat (limited to 'src/shared/util/shr_math_util.erl')
-rw-r--r--src/shared/util/shr_math_util.erl30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/shared/util/shr_math_util.erl b/src/shared/util/shr_math_util.erl
new file mode 100644
index 0000000..874bacc
--- /dev/null
+++ b/src/shared/util/shr_math_util.erl
@@ -0,0 +1,30 @@
+-module(shr_math_util).
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-export
+(
+ [
+ % Somehow, erlang:ceil is not defined on 2 out of my 4 dev computers.
+ ceil/1
+ ]
+).
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-spec ceil (float()) -> integer().
+ceil (Float) ->
+ Int = trunc(Float),
+
+ case (Int /= Float) of
+ true -> (Int + 1);
+ _ -> Int
+ end.