Comments (3)
I also have this issue on latest calculator app. It seems that most calculator apps have this issue, even Google.
15 numbers is the max precision we can get
from calculator.
Recently Microsoft open-sourced their calcuator app, and inside we can find a library that allows for
infinite precision for basic operations (addition, subtraction, multiplication, division) and 32 digits of precision for advanced operations (square root, transcendental operators)
The calculator is written in C++ but glancing over the library I think it's using only C so it should be possible to use it relatively easily.
from calculator.
Another example:
12345679 * 12345679 * 81 = 12345678987654320
, but it was expected 12345678987654321
.
The problem is that the built-in data type, double
, is used for calculations. The built-in types are good for software calculations like iterations over the transition matrix, when a range of values ββis known. But to use them for working with user data, when the range is obviously unknown and accuracy is important at the output, is bad practice.
The solution is quite simple: use third-party data types for calculations using long arithmetic.
Like MPRF (Examples of good calculators you can see there in "Software Using MPFR")
https://en.wikipedia.org/wiki/List_of_arbitrary-precision_arithmetic_software
For Vala there is a building to libgcrypt
: https://gitlab.gnome.org/GNOME/vala-extra-vapis/blob/master/gcrypt.vapi
See MPI
Or see https://github.com/GNOME/gnome-calculator/tree/master/vapi
from calculator.
Related Issues (20)
- Make it possible to remove results from history individually and as a whole
- Provide obvious way to open new instance of Calculator HOT 3
- Clear calculator result if closed, remember result if hidden/minimized HOT 3
- When Calculator is opened, typing numbers on the numpad does nothing
- Can't start typing directly on start because it is focusing to expand button. HOT 2
- Calculator keyboard shortcut HOT 3
- Calculator is no longer in focus after opening. HOT 4
- Frame drops for 'show extended functionality' animation
- Incorrect title in multitasking view
- Calculator has no icon in Flatpak
- Ctrl+C should copy display contents to clipboard
- Unable to maximise or resize window HOT 1
- No accent highlights when using the numpad HOT 1
- Error in percentage calculation HOT 5
- Doesn't fill screen on PinePhone
- Add history into main window HOT 1
- There is an empty space HOT 9
- headerbar does not respect My themes HOT 3
- Calculator UI has bug in view HOT 1
- Crash when pasting with multiply/divide HOT 1
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 calculator.