Comments (12)
My understanding is that fractional exponents will usually appear in intermediate results and will be printed mostly for debugging purposes. I don't see much need in perfecting their looks.
from mp-units.
which unicode code points?
Couldn't obviously find superscript fractions.
Or did you mean "radical" symbols like an actual square root. That would be most unusual?
or did you just mean m^½
currently it prints: m^(1/2)
from mp-units.
I think that "m½" is self-explanatory and we might not need additional "^" sign but we can decide otherwise. Here is the info how to create any ratio: https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts.
from mp-units.
yes. I know about "composing fractions using sub/superscripts", but those are not "superscripts overall" and therefore only questionably suitable for representing an exponent?
In fact I think it's logical that fractional superscripts don't exist as a font glyph. The single digit superscripts are difficult enough to read at normal font sizes, so fractional superscripts would likely be unreadable below 20pt? Really to display this sort of thing properly we need a "1.5 x line height" (at least) layout object, and we clearly can't do that without outputting postscript or latex.
So you are suggesting, we abandon the idea of the these actually being exponents/superscripts?
and just write (effectively) "m * 1/2" ?
from mp-units.
So you are suggesting, we abandon the idea of the these actually being exponents/superscripts? and just write (effectively) "m * 1/2"?
No. If we are about to stay with ASCII I think that the current spelling "m^(1/2)" is better. It is that in one of the libraries I analyzed I saw they use unicodes for fractional exponents too and the resulting dimensions were easier to read (in my opinion).
from mp-units.
That's a misunderstanding. I agree that the best ASCII is the status quo.
What I was trying to point out is that
m½
to my eyes (and this is subjective) looks more like
m * (1/2)
than like
m^(1/2)
actually m½ doesn't look like anything very sensible to my eyes.
In my opinion writing non-trivial mathematical expressions nicely is not really possible "on a single line of text". That's why there are specialised languages for that. And a basic convention for how to use ASCII, which is not too pretty, but unambiguous.
from mp-units.
There are ony a few physical quantities that really use them. I was provided one of them some time ago but I lost it and do not remember the name of the quantity.
from mp-units.
I did some googling and it led me to this discussion (funny enough, about another physical units library) and there are a couple of examples:
- fracture toughness measured in Pa · m1/2
- amplitude spectral density involving Hz−1/2
from mp-units.
@i-ky what you have there looks much better to my eyes!
superscript, but just simple '/' fraction...you can still see it's an exponent
unless someone objects I'll just implement that ... but not go overboard since it seems this is pretty niche
from mp-units.
@oschonrock what I'm using there is not plain Unicode, I've cheated using <sup>...</sup>
. And although you can get superscript digits, there is no way to represent superscript solidus with Unicode.
from mp-units.
@i-ky Damn, but somehow I smelled that.
Oh well, this can remain on low priority table then, given we are struggling to come up with a use case outside of "amplitude spectral density".
from mp-units.
Well, we can always cheat: https://stackoverflow.com/a/49325148 ;-)
from mp-units.
Related Issues (20)
- Should `quantity_point_like_traits` work on raw values?
- Consider using two types instead of values for the template parameters of the `reference` type HOT 1
- Bikeshedding `force_in(Unit)` HOT 10
- Change `mp-units/2.1.0` to `mp-units/2.0.0` in Conan installation steps? HOT 2
- Add support for easier math expressions in `mp-units/math.h` HOT 17
- Should we allow deriving from system entities? HOT 2
- No 2.1.0 in Conan center HOT 3
- ice_point definition is (very very slightly) incorrect
- Do we really need ASCII-only text output? HOT 13
- Text input support
- formatting/printing vector of quantities results in compile time error HOT 3
- Bazel build system support HOT 3
- Should conversions from the raw numerical value to a dimensionless quantity with a unit one be allowed? HOT 26
- Is mp-units targeting freestanding implementations HOT 6
- Provide `wchar_t` support for text output
- Effectively global unit names like 'm' are problematic HOT 35
- compilation time and how to improve it HOT 17
- Can't compile with localization disabled HOT 1
- Can't compile with exceptions disabled HOT 1
- Linker error with base units for "numerical_value_in()" HOT 4
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 mp-units.