-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pretty Printing Fractional Exponential Units #60
Comments
This is always a good combination! The problem as I see it is that
which, by the way, is now also converted to float internally:
I see two ways to implement your suggestion, and maybe we want to implement both. 1.- Change the formatting part We can get the exponents and try to convert them from float to fraction.
The good part: it will be transparent to the user. 2.- Allow any scalar numeric type for the exponents The good part: will allow the user to make some calculations more accurate. In fact, this is why the implementation Pi Theorem works so well in Pint: we use
We will need to guard for those. As I said, maybe the way is to implement both. |
I think to move forward we need to maybe only allow Operations on integer & Fraction are easily supported using python. I think it deserves an issue on its own to work on. About this issue, we can easily support it if we encounter Fraction, it will display |
I do agree that we need an issue on its own. In particular, I think it is worth discussing if we should enable a plugable architecture (like |
I have found what I think is a bug, and an opportunity to both fix the bug and enhance Pint.
Whenever a quantity is defined with a fractional exponent in a unit, the exponent is converted to a decimal representation, which is all well and good. However, when pretty printing, the decimal point is not superscripted with the rest of the exponent. For example:
A solution could be to keep fractional representations in fractional form, and use the unicode fraction slash character (U+2044 = ⁄ ) to compose arbitrary fractions with subscript and superscript numbers. It would be nice for the above example to evaluate to:
The ³⁄₂ is a superscript 3, a fraction slash, and a subscript 2.
I don't know how feasible this is. Certainly, getting the decimal in the exponent would be great, but I don't know of a superscript decimal unicode character. I also don't know if storing fractions would be too much trouble for the rest of the system.
I can try to tackle this myself unless someone has an easy solution.
The text was updated successfully, but these errors were encountered: