JuliaPhysics / JuliaPhysics/Unitful.jl

symdiff produces unexpected results

Open
#832 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
675
Forks
124
Avg merge
3h 38m
Merged PRs (30d)
1

Description

Using `symdiff` with all the same types yields expected results
```
symdiff([1u"V", 2u"V", 3u"V"], [3u"V", 4u"V"])
```
yields
```
[1 V, 2 V, 4 V]
```
Changing one of the types breaks it
```
symdiff([1.0u"V", 2u"V", 3u"V"], [3u"V", 4u"V"])
```
yields
```
[1.0 V, 2.0 V, 3.0 V]
```

I'm not sure if the issue is related to julia base or unitful.jl. So I appologize if this is the wrong spot to post this issue. It seems like at minimum this should error out instead of returning incorrect results.

Unitful 1.27
Julia 1.11.7

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the two examples with Julia 1.11.7 and Unitful 1.27, then trace the `symdiff` implementation and its handling of mixed numeric types. Done means the mixed-type case returns the correct symmetric difference or raises an explicit error, with a regression test covering both examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
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.