NumericType

NumericType

new NumericType(parameters)

Description:
  • Specifies a bounded finite precision numeric value.

    Extends: Type. This class extends Type, with all public methods available.

    Type parameters

    General parameter

    • name: ... The type name. By default the type name is "numeric".

    Numeric type meta-data

    • precision: ... The positive numerical precision. Default is NAN, i.e., undefined.
      • This is the value under which two values are indistinguishable.
      • If precision=1 and min and max are integer this means we consider an integer value.
      • The default means that the value is a constant, not to be adjusted.
    • min: ... The numerical minimal value. Default is -DBL_MAX.
    • max: ... The numerical maximal value. Default is DBL_MAX.
    • zero: ... The numerical default and initial value.
      • This corresponds to the empty value.
      • The default is (max + min)/2.
    • step: ... The positive sampling step, in order to define a local neighborhood size. Default is NAN, i.e., undefined.
      • It is used to weight the distance calculation.
      • The default corresponds to a value that is not be sampled.
    • unit: ... The numerical unit name. Defualt is "", i.e., undefined.

    Parameters for the geodesic calculation

    • atomic: ...
      • If true returns only an atomic path with the two left-hand and right-hand elements. Default is true.
      • If false returns a path with all intermediate values, precision value by precision value if defined.

    NumericType specification

    Syntactic projection - Returns NAN if not a parsable number.
    - Returns the zero if an empty value.
    Semantic projection - If the value is higher than the maximal value or lower than the minimal value it is projected on the related bound.
    - If precision is defined the value is projected to the closest min + k precision value, k being an integer.
    Distance value The distance is calculated as a weighted value |lhs-rhs|/step.
    - It is INFINITY if not both object are numeric.
    Geodesic path The geodesic is assumed to be atomic, i.e. of length 1 if value are equal and 2 if different.
    Comparison - Returns either lhs-rhs or
    0 if the precision is defined and |lhs-rhs| < precision.
    Bounds - The min and max values are the obvious bounds, if undefined the empty value is the unique bound.

    Note

    • The numeric parameter values can also be given as a JSON structure, or a String.
    • The getNormalized() method allows to map the numerical parameter onto the [-1, 1] interval optionally with zero mapped to 0.
Parameters:
Name Type Description
parameters JSON | String

The type parameters.

Methods

getNormalized(value, with_zeroopt) → {double}

Description:
  • Returns a normalized value given this type.

    • It maps a numerical parameter in the [min, max] range onto the [-1, 1] interval.
    • If done with_zero the zero mapped to 0. Without this option the mapping is linear, while with this option the mapping is a monotonic combination of quadratic profiles.
Parameters:
Name Type Attributes Default Description
value Value | double

The input value.

with_zero bool <optional>
true

Non-linear normalization to map the zero value on 0.

Returns:

A value in the [-1, 1] range.

Type
double