Author Topic: Release version FP calculator  (Read 4091 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 6749
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Release version FP calculator
« on: October 13, 2018, 07:21:28 PM »
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
« Last Edit: October 19, 2018, 01:44:29 PM by hutch-- »
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

felipe

  • Member
  • *****
  • Posts: 1249
  • Eagles are just great!
Re: Release version FP calculator
« Reply #1 on: October 16, 2018, 02:24:27 AM »
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:
Felipe.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 6749
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Release version FP calculator
« Reply #2 on: October 16, 2018, 03:07:30 AM »
 :biggrin:

Glad somebody liked it.  :P
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

AW

  • Member
  • *****
  • Posts: 2431
  • Let's Make ASM Great Again!
Re: Release version FP calculator
« Reply #3 on: October 16, 2018, 07:16:08 PM »
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--

  • Administrator
  • Member
  • ******
  • Posts: 6749
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Release version FP calculator
« Reply #4 on: October 16, 2018, 07:52:55 PM »
 :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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

TimoVJL

  • Member
  • ***
  • Posts: 476
Re: Release version FP calculator
« Reply #5 on: October 16, 2018, 08:58:11 PM »
keyboard numpad VK_DECIMAL handling ?
EDIT: It isn't always a '.', for me it's ',' ;)
« Last Edit: October 17, 2018, 12:21:57 AM by TimoVJL »
May the source be with you

Siekmanski

  • Member
  • *****
  • Posts: 1927
Re: Release version FP calculator
« Reply #6 on: October 16, 2018, 10:16:23 PM »
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--

  • Administrator
  • Member
  • ******
  • Posts: 6749
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Release version FP calculator
« Reply #7 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 ?

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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

TimoVJL

  • Member
  • ***
  • Posts: 476
Re: Release version FP calculator
« Reply #8 on: October 17, 2018, 02:09:50 AM »
Isn't that virtual keycode in WM_KEYUP same in every Windows  OS , or is keyboard driver some how broken in some languages?
Quote
VK_DECIMAL 0x6E Numpad .
May the source be with you

Siekmanski

  • Member
  • *****
  • Posts: 1927
Re: Release version FP calculator
« Reply #9 on: October 17, 2018, 03:31:22 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--

  • Administrator
  • Member
  • ******
  • Posts: 6749
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Release version FP calculator
« Reply #10 on: October 17, 2018, 04:24:02 AM »
OK, I have got it. How to enter a negative number, either from the keypad OR directly into the edit control.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

Siekmanski

  • Member
  • *****
  • Posts: 1927
Re: Release version FP calculator
« Reply #11 on: October 17, 2018, 04:38:41 AM »
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--

  • Administrator
  • Member
  • ******
  • Posts: 6749
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Release version FP calculator
« Reply #12 on: October 17, 2018, 12:15:06 PM »
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.
« Last Edit: October 19, 2018, 01:43:57 PM by hutch-- »
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

AW

  • Member
  • *****
  • Posts: 2431
  • Let's Make ASM Great Again!
Re: Release version FP calculator
« Reply #13 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.
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

  • Member
  • ***
  • Posts: 476
Re: Release version FP calculator
« Reply #14 on: October 17, 2018, 08:34: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
« Last Edit: October 17, 2018, 10:35:59 PM by TimoVJL »
May the source be with you