JuliaPhysics / JuliaPhysics/Unitful.jl

Addition of degree + radian is unitless

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

Description

```julia
using Unitful
a = 180u"°" + 3.141u"rad"
@show unit(a) # blank
@show typeof(a) # Float64
```
I expect to have to explicitly ustrip() when I want a unitless quantity.
This behavior makes certain operations type-unstable, which the [docs](https://painterqubits.github.io/Unitful.jl/latest/trouble/#promotion-with-dimensionless-numbers) describe and dismiss.
Much of the point of having typed functions goes away if I also have to accept floats because their input units were automatically, silently canceled.
UnitfulAngles.jl does not fix this.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by running the reported Julia/Unitful example and read the linked documentation on promotion with dimensionless numbers. Done should prevent degree-plus-radian addition from silently producing a bare Float64, while preserving explicit conversion for callers who want a unitless value; the issue does not identify a file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.