boundedDouble function

BoundedDouble boundedDouble(
  1. double bottom,
  2. double top
)

Constructs a BoundedDouble object with specified lower and upper bounds.

Example:

void main() {
  // Create a bounded double type for values between 1.0 and 10.0
  BoundedDouble bounded = boundedDouble(1.0, 10.0);

  // Compare two doubles using the bounded ordering
  bool result1 = bounded.compare(5.5, 8.3) < 0; // Output: true (5.5 is less than 8.3)
  bool result2 = bounded.compare(15.2, 10.1) > 0; // Output: false (15.2 is not within the bounds)
}

Implementation

BoundedDouble boundedDouble(double bottom, double top) =>
    BoundedDouble(bottom, top);