Code review comment for lp://qastaging/~toineo/unity-lens-applications/calculator

Revision history for this message
toineo (toineo) wrote :

The merge request is frozen for now. I have fixed the bug of bad double printing (e.g something like 2.1 that was printed as 2.0999999999998) -- and I should push those changes --, but we still have difficulties to know if the computation was exact or not (and that will be clearly visible to the user, through the equal sign (= or ≈, depending on the case)).

I see 3 way to fix it :
- Add some code to the equation parser that detects approximations. This should work for many simple (or not so simple) cases, but would probably still fail on more difficult ones.
- Use an external binding for a bignum (including bigfloat) library. With a good library, we should make almost no error telling if the computation was exact or not. Unfortunately, I found no such binding for vala...
- Write an implementation of bignums directly in the parser. But it would take some time, in particular for some operations/functions. Moreover, it would be like reinventing the wheel...

If anyone had a solution or something that could help, it would be greatly appreciated !

(Sorry for my *bad* English...)

review: Needs Fixing

« Back to merge proposal