omdl  v0.9.5
OpenSCAD Mechanical Design Library
Scalar Tests

Tests to differentiate scalar data types. More...

+ Collaboration diagram for Scalar Tests:

Files

file  scalar_test.scad
 Scalar data type tests.
 

Functions

function is_scalar (v)
 Test if a value is a single non-iterable value. More...
 
function is_defined (v)
 Test if a value is defined. More...
 
function is_nan (v)
 Test if a numerical value is 'nan' (not a number). More...
 
function is_inf (v)
 Test if a numerical value is infinite. More...
 
function is_number (v)
 Test if a value is a number. More...
 
function is_integer (v)
 Test if a value is an integer. More...
 
function is_decimal (v)
 Test if a value is a decimal. More...
 
function is_range (v)
 Test if a value is a range definition. More...
 
function is_even (v)
 Test if a numerical value is even. More...
 
function is_odd (v)
 Test if a numerical value is odd. More...
 
function is_between (v, l, u)
 Test if a numerical value is between an upper and lower bounds. More...
 

Detailed Description

Tests to differentiate scalar data types.

Requires:
include <omdl-base.scad>;

Validation Summary

filegroupscriptresultsno testskippedpassedfailedwarning
datatypes/scalar_test.scadScalar TestsScriptResults0031500

No Failures

See complete validation results.

Function Documentation

◆ is_between()

function is_between ( ,
,
 
)

Test if a numerical value is between an upper and lower bounds.

Parameters
v<number> A numerical value.
l<number> The minimum value.
u<number> The maximum value.
Returns
<boolean> true when the value is equal to or between the upper and lower bounds and false otherwise. Returns false when either of v, l, or u is not a number.
+ Here is the caller graph for this function:

◆ is_decimal()

function is_decimal ( )

Test if a value is a decimal.

Parameters
v<value> A value.
Returns
<boolean> true when the value is a decimal and false otherwise.

◆ is_defined()

function is_defined ( )

Test if a value is defined.

Parameters
v<value> A value.
Returns
<boolean> true when the value is defined and false otherwise.
Note
Starting with version 2019.05, this function is now provided directly by OpenSCAD via a built-in type test function is_undef().
+ Here is the caller graph for this function:

◆ is_even()

function is_even ( )

Test if a numerical value is even.

Parameters
v<value> A numerical value.
Returns
<boolean> true when the value is determined to be an even integer and false otherwise (The value may be positive or negative).

◆ is_inf()

function is_inf ( )

Test if a numerical value is infinite.

Parameters
v<value> A numerical value.
Returns
<boolean> true when the value is determined to be inf (greater than the largest OpenSCAD representable number) and false otherwise.

◆ is_integer()

function is_integer ( )

Test if a value is an integer.

Parameters
v<value> A value.
Returns
<boolean> true when the value is an integer and false otherwise.

◆ is_nan()

function is_nan ( )

Test if a numerical value is 'nan' (not a number).

Parameters
v<value> A numerical value.
Returns
<boolean> true when the value is determined to be nan (Not A Number) and false otherwise.
+ Here is the caller graph for this function:

◆ is_number()

function is_number ( )

Test if a value is a number.

Parameters
v<value> A value.
Returns
<boolean> true when the value is a number and false otherwise.
Note
Starting with version 2019.05, this function is now provided directly by OpenSCAD via a built-in type test function is_num().
+ Here is the caller graph for this function:

◆ is_odd()

function is_odd ( )

Test if a numerical value is odd.

Parameters
v<value> A numerical value.
Returns
<boolean> true when the value is determined to be an odd integer and false otherwise (The value may be positive or negative).

◆ is_range()

function is_range ( )

Test if a value is a range definition.

Parameters
v<value> A value.
Returns
<boolean> true when the value is a range definition and false otherwise.
Note
A range is determined to be a value which does not fit in any other category. Specifically, It is a value that is not {undef, nan or inf}, and is neither of {list, number, bool, or string}.

◆ is_scalar()

function is_scalar ( )

Test if a value is a single non-iterable value.

Parameters
v<value> A value.
Returns
<boolean> true when the value is a single non-iterable value and false otherwise.
input value function return
number true
boolean true
string false
list false
range true
undef true
inf true
nan true
Note
The empty list and empty string return true.
+ Here is the caller graph for this function: