Skip to content

Latest commit

 

History

History
124 lines (75 loc) · 4.24 KB

aw_number_utils.md

File metadata and controls

124 lines (75 loc) · 4.24 KB

Module aw_number_utils

.

Copyright (c) (C) 2016, Altworx s.r.o.

Authors: Adam Kovari ([email protected]).

Function Index

abs_diff/3Assert whether two numbers are apart by at most an absolute value specified as the third parameter.
binary_to_number/1Convert a binary to either float or integer.
list_to_number/1Convert a list to either float or integer.
percent_diff/3Assert whether two numbers are apart by at most a percent value specified as the third parameter.
string_float_or_default/2Returns a float value of a string or default value if the input is not a string representing a float.
string_integer_or_default/2Returns an integer value of a string or default value if the input is not a string representing an integer.
string_is_float/1Assert whether a list or a binary actually represents a float.
string_is_integer/1Assert whether a list or a binary actually represents a integer.
string_is_numeric/1Assert whether a list or a binary actually represents a number (float or integer).

Function Details

abs_diff/3


abs_diff(FieldValue::number(), PrevFieldValue::number(), ConditionBody::number()) -> boolean()

Assert whether two numbers are apart by at most an absolute value specified as the third parameter

binary_to_number/1


binary_to_number(B::binary()) -> number()

Convert a binary to either float or integer

list_to_number/1


list_to_number(L::list()) -> number()

Convert a list to either float or integer

percent_diff/3


percent_diff(FieldValue::number(), PrevFieldValue::number(), ConditionBody::number()) -> boolean()

Assert whether two numbers are apart by at most a percent value specified as the third parameter

string_float_or_default/2


string_float_or_default(F::list() | binary(), Default) -> float() | Default

Returns a float value of a string or default value if the input is not a string representing a float

string_integer_or_default/2


string_integer_or_default(I::list() | binary(), Default) -> integer() | Default

Returns an integer value of a string or default value if the input is not a string representing an integer

string_is_float/1


string_is_float(L::list() | binary()) -> boolean()

Assert whether a list or a binary actually represents a float. Returns false if the input is neither a list or binary

string_is_integer/1


string_is_integer(L::list() | binary()) -> boolean()

Assert whether a list or a binary actually represents a integer. Returns false if the input is neither a list or binary

string_is_numeric/1


string_is_numeric(L::list() | binary()) -> boolean()

Assert whether a list or a binary actually represents a number (float or integer). Returns false if the input is neither a list or binary