tools: add floatTruncate function
This commit is contained in:
parent
4d629fe8f7
commit
9bb570af7f
@ -77,6 +77,14 @@ let
|
|||||||
optionalInherit = l: a: filterAttrs (n: v: v!=null)
|
optionalInherit = l: a: filterAttrs (n: v: v!=null)
|
||||||
(overrideExisting (genNullAttr l) a);
|
(overrideExisting (genNullAttr l) a);
|
||||||
|
|
||||||
|
# Given a float f, truncates it and returns the resulting the integer
|
||||||
|
floatTruncate = f: let
|
||||||
|
strFloat = toString f;
|
||||||
|
slices = splitString "." strFloat;
|
||||||
|
front = elemAt slices 0;
|
||||||
|
in
|
||||||
|
toInt front;
|
||||||
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
gen
|
gen
|
||||||
|
Loading…
Reference in New Issue
Block a user