RDF.ex v0.5.4 RDF.Numeric View Source

The set of all numeric datatypes.

Link to this section Summary

Functions

Returns the absolute value of a numeric literal

Adds two numeric literals

Rounds a numeric literal upwards to a whole number literal

Compares two numeric RDF.Literals

Divides two numeric literals

Tests for numeric value equality of two numeric literals

Rounds a numeric literal downwards to a whole number literal

Returns if a given literal has a numeric datatype

Multiplies two numeric literals

Rounds a value to a specified number of decimal places, rounding upwards if two such values are equally near

Subtracts two numeric literals

Returns if a given datatype is a numeric datatype

The list of all numeric datatypes

Link to this section Functions

Returns the absolute value of a numeric literal.

If the argument is not a valid numeric literal nil is returned.

see http://www.w3.org/TR/xpath-functions/#func-abs

Adds two numeric literals.

For xsd:float or xsd:double values, if one of the operands is a zero or a finite number and the other is INF or -INF, INF or -INF is returned. If both operands are INF, INF is returned. If both operands are -INF, -INF is returned. If one of the operands is INF and the other is -INF, NaN is returned.

If one of the given arguments is not a numeric literal, nil is returned.

see http://www.w3.org/TR/xpath-functions/#func-numeric-add

Rounds a numeric literal upwards to a whole number literal.

If the argument is not a valid numeric literal nil is returned.

see http://www.w3.org/TR/xpath-functions/#func-ceil

Compares two numeric RDF.Literals.

Returns :gt if first literal is greater than the second and :lt for vice versa. If the two literals are equal :eq is returned.

Returns nil when the given arguments are not comparable datatypes.

Divides two numeric literals.

For xsd:float and xsd:double operands, floating point division is performed as specified in [IEEE 754-2008]. A positive number divided by positive zero returns INF. A negative number divided by positive zero returns -INF. Division by negative zero returns -INF and INF, respectively. Positive or negative zero divided by positive or negative zero returns NaN. Also, INF or -INF divided by INF or -INF returns NaN.

If one of the given arguments is not a numeric literal, nil is returned.

nil is also returned for xsd:decimal and xsd:integer operands, if the divisor is (positive or negative) zero.

see http://www.w3.org/TR/xpath-functions/#func-numeric-divide

Link to this function equal_value?(left, right) View Source

Tests for numeric value equality of two numeric literals.

Returns nil when the given arguments are not comparable as numeric literals.

see:

Rounds a numeric literal downwards to a whole number literal.

If the argument is not a valid numeric literal nil is returned.

see http://www.w3.org/TR/xpath-functions/#func-floor

Returns if a given literal has a numeric datatype.

Multiplies two numeric literals.

For xsd:float or xsd:double values, if one of the operands is a zero and the other is an infinity, NaN is returned. If one of the operands is a non-zero number and the other is an infinity, an infinity with the appropriate sign is returned.

If one of the given arguments is not a numeric literal, nil is returned.

see http://www.w3.org/TR/xpath-functions/#func-numeric-multiply

Link to this function round(literal, precision \\ 0) View Source

Rounds a value to a specified number of decimal places, rounding upwards if two such values are equally near.

The function returns the nearest (that is, numerically closest) value to the given literal value that is a multiple of ten to the power of minus precision. If two such values are equally near (for example, if the fractional part in the literal value is exactly .5), the function returns the one that is closest to positive infinity.

If the argument is not a valid numeric literal nil is returned.

see http://www.w3.org/TR/xpath-functions/#func-round

Subtracts two numeric literals.

For xsd:float or xsd:double values, if one of the operands is a zero or a finite number and the other is INF or -INF, an infinity of the appropriate sign is returned. If both operands are INF or -INF, NaN is returned. If one of the operands is INF and the other is -INF, an infinity of the appropriate sign is returned.

If one of the given arguments is not a numeric literal, nil is returned.

see http://www.w3.org/TR/xpath-functions/#func-numeric-subtract

Returns if a given datatype is a numeric datatype.

The list of all numeric datatypes.