permute method

  1. @override
double permute(
  1. double instance
)
override

Generates another instance with some deterministic function.

The only exception is Kind.forNull (because it has no other instances).

Implementation

@override
double permute(double instance) {
  if (instance.isInfinite) {
    if (instance.isNegative) {
      return min ?? minWhenFloat64;
    } else {
      return double.nan;
    }
  } else if (instance.isNaN) {
    return double.negativeInfinity;
  }
  var next = instance + 1.0;
  if (next > instance) {
    return next;
  }
  next = 2 * instance;
  if (next > instance) {
    return next;
  }
  return double.infinity;
}