Git Product home page Git Product logo

Comments (12)

i-ky avatar i-ky commented on June 11, 2024 1

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.

oschonrock avatar oschonrock commented on June 11, 2024

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.

mpusz avatar mpusz commented on June 11, 2024

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.

oschonrock avatar oschonrock commented on June 11, 2024

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.

mpusz avatar mpusz commented on June 11, 2024

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.

oschonrock avatar oschonrock commented on June 11, 2024

That's a misunderstanding. I agree that the best ASCII is the status quo.

What I was trying to point out is that

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.

mpusz avatar mpusz commented on June 11, 2024

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-ky avatar i-ky commented on June 11, 2024

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:

  1. fracture toughness measured in Pa · m1/2
  2. amplitude spectral density involving Hz−1/2

from mp-units.

oschonrock avatar oschonrock commented on June 11, 2024

@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.

i-ky avatar i-ky commented on June 11, 2024

@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.

oschonrock avatar oschonrock commented on June 11, 2024

@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.

mpusz avatar mpusz commented on June 11, 2024

Well, we can always cheat: https://stackoverflow.com/a/49325148 ;-)

from mp-units.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.