# Physical units in Julia

**URL:** https://discourse.julialang.org/t/physical-units-in-julia/76825
**Category:** General Usage
**Tags:** unitful
**Created:** [February 20, 2022, 11:18pm UTC](https://discourse.julialang.org/t/physical-units-in-julia/76825 "2022-02-20T23:18:16Z")
**Posts on this page:** 1
**Showing post:** 19

<div class="post-metadata">

### Author: ![j-fu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j-fu/32/11373_2.png) [@j-fu](https://discourse.julialang.org/u/j-fu)
#### Post date: [July 14, 2022, 9:15pm UTC](https://discourse.julialang.org/t/physical-units-in-julia/76825/19 "2022-07-14T21:15:09Z")

</div>

I am not sure if the ‘.val’ stuff is documented. And then:

```julia
julia> cm=1Unitful.cm
1 cm

julia> dm=1Unitful.dm
1 dm

julia> cm.val
1

julia> dm.val
1

```

We are deep in danger land here.

The unitful correct way to get a consistent unit factor is to use  
`ustrip` and `upreferred`:

```julia
julia> ustrip(upreferred(cm))
1//100

julia> ustrip(upreferred(dm))
1//10

```

This is what the package developers recommend. I feel this generates too much boilerplate and puts the burden of consistency on the shoulders of very differently experienced individual users.

If people like the OP give up on unitful then I would say there is a missing link into the wider community. I am not really convinced that my package is best possible, but for a couple of projects I am involved in this will provide a consistent recipe how to handle things on a pragmatic level.

---

_[View the full topic](https://discourse.julialang.org/t/physical-units-in-julia/76825)._
