El diumenge, 2 de maig de 2021, a les 8:43:42 (CEST), hanyoung va escriure: > Change the default output to float, however I'm not sure how to add autotest. > I want to unit test InputManager but it's not a library.
I wrote you an autotest https://invent.kde.org/plasma-mobile/kalk/-/merge_requests/21 and while writing the autotest i realized why kalk is so broken for me. You don't take into account there are locales that use , as a decimal separator instead of . So when i do 70/9*9 in English, it works, if i do it in Catalan it does not because something gets confused because the result from 70/9 is not 7.777777 but 7,777777 Sadly the autotest doesn't help catch this because i force the C locale in it, will think how it can be improved to maybe catch that tomorrow. Cheers, Albert > > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ > On Sunday, May 2, 2021 6:04 AM, Albert Astals Cid <aa...@kde.org> wrote: > > > El dissabte, 1 de maig de 2021, a les 7:26:24 (CEST), hanyoung va escriure: > > > > > I've fixed the keyboard bug and change the division result between two > > > integers to float. > > > > I don't think that changing knumber to do that is a great idea, keeping > > integer divisions as fraction instead of float seems the correct thing to > > do, you should instead change the ui to be able to show fractions as floats > > but to keep the internal representation as good as possible, i.e. as a > > fraction. > > > > Not sure if related to that or not, but now if i type > > 65 / 9 = * 7 = > > > > i get 1.39999e+16 which doesn't seem correct, should be 50,5555... > > > > I'd really suggest you add autotests for this. > > > > Cheers, > > Albert >