calculator-v2 icon indicating copy to clipboard operation
calculator-v2 copied to clipboard

app does not work correctly

Open kollabz opened this issue 4 years ago • 4 comments

Hi. . I added data from the project according to the instructions. After installing on the phone, the calculation of the equation with several operators does not work correctly. example: does not work - cos (60) * 2-1 ("Error" in @+id/display_secondary) works - 1 * cos (60) * 2-1

please help me solve this problem (

kollabz avatar Jun 06 '20 06:06 kollabz

Hey @kollabz, I'm sorry to hear it's not working for you. It's possible it's a bug, or maybe something's just obsolete since I haven't updated the app in several years.

Could you try installing the official apk and see if it has the same problem? https://github.com/scottmangiapane/calculator-v2/releases

scottmangiapane avatar Jun 06 '20 07:06 scottmangiapane

I installed the application and it works correctly.) But I would like to add your code to my application and add the functions arcsin, arccos, arctan. Did you further modify the application after release?

kollabz avatar Jun 06 '20 08:06 kollabz

I have not modified the application after the release so I think it's just old. I realize in hindsight that I should have committed the entire project directory instead of just app/src/main... Maybe that would've helped. However the equation parsing/solving should still work if you copy it to your own project since it's just regular Java.

I'll see if I can get this app updated and let you know how it goes.

scottmangiapane avatar Jun 06 '20 19:06 scottmangiapane

Whoops- it's a bug. When cos(n) evaluates to a negative number and there is already a negative sign in front of it, the double negative is never handled and parsing fails. Looks like the official apk has this issue as well. Are you sure it worked for you?

I made this app for fun as a college freshman so the testing was a little less than thorough :) Honestly I recommend using something more stable for your own app. This looks viable. You would write your expression as "-Math.cos(60) * 2 - 1" and it also supports arcsin, arccos, etc. The Java Expressions Library might also work although I haven't tested it.

scottmangiapane avatar Jun 06 '20 22:06 scottmangiapane