ZeroPhone / ZPUI

Official ZeroPhone UI framework, based on pyLCI
http://zpui.rtfd.org/
Apache License 2.0
79 stars 19 forks source link

Calculator app TODO #100

Open CRImier opened 6 years ago

CRImier commented 6 years ago

@KyleMoran138 has made a basic app that uses Decimals, and it's now in devel. However, the UI isn't user-friendly enough - my proposal is to have a single-screen app:

On the screen, it would show:

Quick mockup of the screen layout:

image

Later on, we could add an option to hide the controls' disambiguation, for a less bloated UI (and, probably, being able to show more numbers in return).

rud01f commented 6 years ago

the problem is in how floating point numbers are internally stored: as a binary sequence and exponent. 0.1 decimal in binary is 0.00011001100110011.. etc., so it's not possible to store it perfectly. One idea is to use fixed point arithmetic - pre-multiply every number by let's say 1,000,000,000 , then divide the result.

CRImier commented 6 years ago

Yeah, I'm sure there's even a tried and true algorithm on Stackoverflow or somewhere else that most of the calculator apps use to avoid the precision problems =) The biggest effort will, surely, go into the calculator UI and user-friendliness, the eval part is mentioned in a way that "we need somebody to write an app, and in case you're worried about the backend you should use, here's an easy-to-use backend that we're OK with you using, and here are some amusing examples of it failing =)"

j340m3 commented 6 years ago

Why not use Decimals?

CRImier commented 6 years ago

@j340m3 this seems like exactly what we'd be looking for, from the first glance, thank you!

LouisPi commented 5 years ago

Some features that would be cool to have (some more advanced ones reached by navigating menus maybe):

  1. Rounding to a chosen amount of significant figures or decimal places - this can be complicated (https://realpython.com/python-rounding). Annoyingly the built in round() method in Python rounds .5 down which is wrong
  2. Option to truncate a number (https://docs.python.org/3/library/math.html#math.trunc)
  3. Multiplying a base number by an exponent (a.k.a a power)
  4. Work out averages (mean, median and mode)
  5. Square root a number
  6. Basically have all the features you would expect a normal calculator to have plus maybe a few extra
  7. Unit conversion (probably in another app) - kg to lbs, cm to inch, mile to km etc.