Skip to content
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

Initial prototype for fractions #115

Closed
wants to merge 5 commits into from
Closed

Initial prototype for fractions #115

wants to merge 5 commits into from

Conversation

cassidyjames
Copy link
Contributor

@cassidyjames cassidyjames commented Oct 3, 2019

To fix #114

image

  • Figure out actual design
  • Probably use custom styling instead of Unicode fraction characters (so it can be arbitrary fractions)
  • Put fraction label in revealer
  • Hook up to real logic (you know, the hard part)

@fitojb
Copy link
Contributor

fitojb commented Oct 18, 2019

Arbitrary fractions can be made by just using U+2044 FRACTION SLASH; this will work with almost all modern OpenType UI fonts, incl. Inter.

@cassidyjames
Copy link
Contributor Author

@fitojb we're not using Inter in elementary OS, we use Open Sans. And it appears that unicode character is not enough, at least with Open Sans: we have to use Pango to size and position the numerator and denominator.

@jeremypw
Copy link
Collaborator

jeremypw commented Nov 28, 2019

@cassidyjames This branch contains an algorithm for calculating the nearest fraction for the result:

https://github.com/elementary/calculator/tree/show-as-fraction

It shows the fraction as a tooltip pending UI design. Please take from this branch if you need to. Not fully tested against corner case input but works for positive reals at the moment.

@jeremypw
Copy link
Collaborator

jeremypw commented Nov 28, 2019

show-as-fraction branch now works for negatives. Does not reduce fraction if error > 10% (adjustable). At the moment, shows resulting fraction in all circumstances (even for whole numbers) pending decisions on what need not be shown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Also show fraction equivalents
3 participants