range.exponential / exponentialFrom #10

Closed
opened 2026-09-13 21:24:23 +09:00 by natsukium · 1 comment
Owner

Missing

range.exponential min max and range.exponentialFrom origin min max.

Why

linear grows the bound proportionally to size, so with maxSize = 100 the span is at most 100x the smallest. Magnitudes like 2^53, 1.0e100 or "just below the Nix integer limit" are unreachable in a reasonable range. Hedgehog's Range.exponential* scale the bound geometrically with size; this is the only range constructor it has that nixcheck lacks.

Suggested shape

  • bounds size interpolates min + (max - min) * (2^(size*k/100) - 1) / (2^k - 1) or similar; ints and floats through the same formula (range.linear already works with float endpoints).
  • Best landed together with #3.
## Missing `range.exponential min max` and `range.exponentialFrom origin min max`. ## Why `linear` grows the bound proportionally to size, so with `maxSize = 100` the span is at most 100x the smallest. Magnitudes like `2^53`, `1.0e100` or "just below the Nix integer limit" are unreachable in a reasonable range. Hedgehog's `Range.exponential*` scale the bound geometrically with size; this is the only range constructor it has that nixcheck lacks. ## Suggested shape - `bounds size` interpolates `min + (max - min) * (2^(size*k/100) - 1) / (2^k - 1)` or similar; ints and floats through the same formula (`range.linear` already works with float endpoints). - Best landed together with #3.
Author
Owner

Implemented in a043d6e, pushed to main.

Implemented in a043d6e, pushed to main.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
natsukium/nixcheck#10
No description provided.