JuliaApproximation / JuliaApproximation/DomainSets.jl

`rand` throws `InexactError`

Open
#173 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
79
Forks
12
Avg merge
6d 22h
Merged PRs (30d)
2

Description

rand throws an InexactError when called on multi-dimensional DomainSets of Ints

Examlple

rand(1..10) returns a Float64 between 1 and 10
rand((1..10) × (1..10)) throws InexactError: Int64(random float)

If 1..10 is supposed to be continuous, I guess (1..10) × (1..10) should too.

Note that
typeof(1..10) is IntervalSets.ClosedInterval{Int64}
and typeof((1..10) × (1..10)) is DomainSets.Rectangle{SVector{2, Int64}}

suggesting that these are intervals of integers, so rand would maybe give an integer ? Or else, 1..10 should automatically convert it's type to float ?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported rand(1..10) and rand((1..10) × (1..10)) cases, then trace the rand entry point for DomainSets.Rectangle. Done means the multidimensional case has defined behavior for integer intervals and no longer raises the reported InexactError.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.