Comments (10)
Radians should be dimensionless, which is likely to cause trouble with tracking them in terms of units.
from dimensioned.
Is there a problem with doing something like this?
make_units! {
Angles, Unitless, one;
base {
Degree, degree, °;
}
}
Then you have degrees and can use Unitless
for radians. Using the SI system with 1 radian = m * m^-1
gives you the same thing for radians.
You can also add on any other units you would like to use.
from dimensioned.
Oh cool. I'll start working on the library now if that's ok.
What does Unitless
do?
from dimensioned.
It's the type for something with no units. Say you run
make_units! {
MS, Unitless, one;
base {
Meter, m, m;
Second, s, s;
}
}
Then you've created the MS
type with units Meter
and Second
. But these are really aliases, where Meter
is MS<P1, Z0>
and Second
is MS<Z0, P1>
. Then, Unitless
is MS<Z0, Z0>
where P1
is the type for the number 1 and ZO
is the type for the number 0.
There are some tutorials for using dimensioned here: http://paholg.com/project/dimensioned/
from dimensioned.
@droundy What do you mean by 'Radians should be dimensionless'? Is what I am saying not possible?
from dimensioned.
I just mean that radians have no units. It's the name for a dimensionless
quantity. In this sense degrees are analogous to dozens or miles, it's a
kind of a unit for things that are pure numbers, which don't actually have
dimension. This sort of "unit" is tricky, because it is kind of like
units, but doesn't work with the same kind of checking that we can use for
real dimensions.
Of course, if you don't want to actually do math, you can define angle as a
dimension without trouble, and then radians and degrees will both be
dimensions. The problem arises, for instance, when you want to find an
angle from the ratio of an arc length and a radius, or to write use the
first few terms in the Taylor expansion of a trig function. Or if you want
to integrate over the surface of a sphere.
On Wed, Dec 2, 2015, 6:30 PM Brendan Zabarauskas [email protected]
wrote:
@droundy https://github.com/droundy What do you mean by 'Radians should
be dimensionless'? Is what I am saying not possible?—
Reply to this email directly or view it on GitHub
#5 (comment).
from dimensioned.
Hmm. It is really nice for documentation though, and picks up errors nicely if you mess up. Do you think dimensioned
is overkill for this then?
from dimensioned.
I would find dimensioned to be overkill if all you want is to document that
you are taking degrees as input.
On Wed, Dec 2, 2015 at 7:01 PM Brendan Zabarauskas [email protected]
wrote:
Hmm. It is really nice for documentation though, and picks up errors
nicely if you mess up. Do you think dimensioned is overkill for this then?—
Reply to this email directly or view it on GitHub
#5 (comment).
from dimensioned.
I am going to consider this closed. Feel free to re-open it if you have further questions, @bjz.
from dimensioned.
👍
from dimensioned.
Related Issues (20)
- Add support for absolute values HOT 2
- Implement various functions on primitives.
- Use #[rustc_on_unimplemented] HOT 1
- travis fails to build HOT 2
- Re-add rustfmt and clippy to TravisCI build HOT 1
- Update `approx` dependency
- Validate and ideally repace uses of `mem::transmute`
- Typo in UCUM: MH20
- http://paholg.com/dimensioned/ is a 404 HOT 3
- Question: accepting generic dimension for calculation in specific units HOT 11
- Question: working with nalgebra HOT 7
- Feature request: Celsius HOT 5
- support std::iter::Sum. HOT 1
- Any good idea how to integrate with `ordered_float`? HOT 3
- Use conventional letter case HOT 1
- Support f256 via the qd github repo HOT 15
- fmt String as Joules instead of MKS HOT 2
- has_units() -> bool HOT 2
- Implement `max` and `min` functions for primitive types that have them HOT 1
- `serde_test` should be dev-dependency
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dimensioned.