mcabbott / mcabbott/OneTwoFive.jl

Ranges with `Rational` elements

Open
#1 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
3
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Ranges with eltype Rational work OK in base 2

julia> onetwo(1//8, 8)
7-element OneTwoFive.Struct{Rational{Int64}, 2, 1}:
 1//8, 1//4, 1//2, 1//1, 2//1, 4//1, 8//1

... but are quite ugly in base 10:

julia> x10 = onetwofive(1//10, 10) 
7-element OneTwoFive.Struct{Rational{Int64}, 10, 3}:
 3602879701896397//36028797018963968 … 1//2, 1//1, 2//1, 5//1, 10//1

julia> dump(x10)
OneTwoFive.Struct{Rational{Int64}, 10, 3}
  off: Int64 -3
  len: Int64 7

julia> float(x10)
7-element OneTwoFive.Struct{Float64, 10, 3}:
 0.1, 0.2, 0.5, 1.0, 2.0, 5.0, 10.0

julia> x10 .+ 0.0
7-element Vector{Float64}:
  0.1
  0.2
  0.5
  1.0
  2.0
  5.0
 10.0

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

Reproduce the examples using onetwo and onetwofive with Rational values in bases 2 and 10, then inspect the implementation behind those entry points. Compare the Rational output with float(x10) and the elementwise addition output. Done means base-10 Rational ranges produce useful, expected values without the displayed huge numerator and denominator.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.