Skip to content

Conversation

@Whathecode
Copy link
Owner

@Whathecode Whathecode commented May 27, 2025

Additions to IntervalUnion and Interval:

  • shift() offsets an interval by a specified amount (also as shl and shr operators).

Additions to Interval:

  • getValueAt() retrieves a value at a given percentage within (0.0–1.0) or outside (< 0.0, > 1.0) of the interval.

Bugfixes:

Additions to type operations used by interval, and thus a breaking change for extending libraries:

  • IntervalTypeOperations.unsafeValueAt()
  • IntervalTypeOperations.unsafeShift()
  • TypeOperations.fromDouble() and toDouble()

Dependency updates:

  • Kotlin 2.1.20
  • kotlinx.datetime 0.6.1

`InstantInterval.size` could overflow and return `Infinity`. To fix this, coerce values into a range which always allows a valid `size` to be returned.

`IntervalTypeOperations.unsafeValueAt` is added to test this, and because it will be needed to implement future interval operations.
Apparently the Gradle config for native targets changed in Kotlin 2.1.0 as builds were now failing. This fixes this, and adds more exhaustive targets (though still not all possible targets).
Something changed in the Kotlin Gradle Plugin 2.1.0 which causes it to use an outdated "version" (before it is modified to include a "-SNAPSHOT" suffix) when looking for ".klib" files. This causes a FileNotFound exception during publications.
In addition:
- renamed one `IntervalTest` which incorrectly claimed to test an "empty" interval.
- made `emptyIntervalUnion` public; no real need to keep this internal.
Moved to a base class to both be used as part of `IntervalTest`, but also for future tests independent of specific Interval types.
This allows implementations which lead to less loss of precision.
And, fix infinity interval sizes for float/double intervals by reducing the min/max of interval type operations, which in turn allows reintroducing infinity as min/max values for the basic type operations.
Since `IntervalTypeOperations` has changed, this is now a breaking API version.
When upgrading to Kotlin 2.1.0, the current Gradle configuration caused problems (#62), likely due to order of execution of Gradle commands. Therefore, configuring a snapshot publication is now done using a command line parameter.
The `buildDirectory` was incorrect when calling `publish`.
Also removed a now obsolete `OptIn` attribute.
Test prerequisites of `IntervalTest` had to be updated to facilitate testing this.
@Whathecode Whathecode merged commit 28b529d into main May 27, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants