News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Release version FP calculator

Started by hutch--, October 13, 2018, 07:21:28 PM

Previous topic - Next topic

hutch--

I can't find anything more to do on this application, interface is finished, divide by 0 works OK and I have set the number size limit to 999999999999999.9 (16 digits) so that it works with the VC runtime conversion. Left column of buttons are 4 more or less useful constants, pi, euler, square root of 2 and the Golden constant with the symbol phi.

Number pad is normal 2 operation logic x operator x = type results, the right column has one operation logic, insert a number and click on one to get the result. There is a precision setting to control the truncation level.

Source is a bit messy as there are a lot of interface bits to handle but it is readable.

Download the final version here.  http://masm32.com/board/index.php?topic=7477.msg81745#new

felipe

Hey hutch, don't know why nobody has commented this work from you, but i have tested it a little bit and (although i have to admit that i don't work with mathematics and so i didn't tested in great extension, mainly because i don't use a calculator every day) i think you have done a great work with this project. Seriously, nice interface and everything else, congratulations! and thanks for sharing it!  :t  :icon14:  :greenclp:

hutch--


aw27

Pro: The user interface is nice.
Con: Settings don't stick across sessions. 2 buttons to tell "Isn't MASM Beautiful" is too much.

:biggrin:

hutch--

 :biggrin:

The next version will store the settings, I just ran out of time to keep working on it. The extra "?" was purely an interface balance issue.

TimoVJL

#5
keyboard numpad VK_DECIMAL handling ?
EDIT: It isn't always a '.', for me it's ',' ;)
May the source be with you

Siekmanski

Nice and easy to read interface.
Would it be possible to add negative numbers functionality by adding a sign toggle button: "±" ? ( ascii code 241 )
Creative coders use backward thinking techniques as a strategy.

hutch--

Marinus,

I am not sure what you are after, normal calculations easily go down below zero, usually divides and subs will do that as will the "1/x" calculation. Have I missed something here ?

Sorry Timo, I know that some countries use "," instead of "." but it makes a messy OS version detect, maybe a setting to swap them later.

TimoVJL

Isn't that virtual keycode in WM_KEYUP same in every Windows  OS , or is keyboard driver some how broken in some languages?
QuoteVK_DECIMAL 0x6E Numpad .
May the source be with you

Siekmanski

Quote from: hutch-- on October 17, 2018, 01:41:43 AM
Marinus,

I am not sure what you are after, normal calculations easily go down below zero, usually divides and subs will do that as will the "1/x" calculation. Have I missed something here ?

e.g. you want to do this calculation:

-10 / 3

Your input will be 10 and then press "±" to make it -10 and then divide it by 3 = -3.3333333333333333
Else you can not use the calculator with negative input numbers.

The only operation is, toggle the sign bit from + to - and vice versa.
Creative coders use backward thinking techniques as a strategy.

hutch--

OK, I have got it. How to enter a negative number, either from the keypad OR directly into the edit control.

Siekmanski

To me it's more logical to use the "±" button when the number is already in the edit control so you can change the sign whenever you want.
This way you can continue calculations and change the sign when you need to.
Creative coders use backward thinking techniques as a strategy.

hutch--

#12
I think I have 2 of the problems solved, I used the position of the "?" button for the sign change button and it seems to be working correctly. I have not done the saving of the settings yet as there may be more options to have to add to an INI file. I think I know how to do the mod that Timo mentioned which will involve some extra controls in the settings box and saving an INI file but I have not worked it all out yet.

aw27

VK_DECIMAL is floppy (depends on the keyboard and/or on the running application) - can't be trusted. It is not a driver issue - drivers know nothing about locales.
The problem should have been spelled as a LOCALE_SDECIMAL question not a VK_DECIMAL question.
So, the procedure shall be: 1) use GetLocaleInfo to know which characters (up to 4!) represent the decimal symbol. Replace them on the entered string with a period. Make the calculations. Finally, when showing the result proceed the other way around.

TimoVJL

#14
Quote from: AW on October 17, 2018, 06:44:18 PM
VK_DECIMAL is floppy (depends on the keyboard and/or on the running application) - can't be trusted. It is not a driver issue - drivers know nothing about locales.
In what way?
It should be good enough for the normal user using a normal extended keyboard.
I was after a keyboard usage, not how to show numbers.

EDIT: false statistics removed. :P
May the source be with you