Recent

Author Topic: RPNCalc in Lazarus  (Read 993 times)

tailkinker

  • New Member
  • *
  • Posts: 10
RPNCalc in Lazarus
« on: January 08, 2026, 06:36:51 pm »
A fairly simple RPN scientific calculator.  Probably only works under Linux.  I would compile it for Windows or Mac as well, but Microsoft and Apple are actively hostile to developers, users, people in general...

https://github.com/tailkinker/RPNCalc

VisualLab

  • Hero Member
  • *****
  • Posts: 712
Re: RPNCalc in Lazarus
« Reply #1 on: January 09, 2026, 12:03:12 pm »
A fairly simple RPN scientific calculator.  Probably only works under Linux.  I would compile it for Windows or Mac as well, but Microsoft and Apple are actively hostile to developers, users, people in general...

https://github.com/tailkinker/RPNCalc

You mean their "fancy" (excessive) requirements for placing apps in their "app stores"? Can't you also put compiled versions of your program on GitHub?

srvaldez

  • Full Member
  • ***
  • Posts: 190
Re: RPNCalc in Lazarus
« Reply #2 on: January 09, 2026, 02:04:00 pm »
good day tailkinker
it compiles and runs OK in Windows, but I think that the order of y^x are wrong, 2 ENTER 3 y^x should give 8 not 9
<edit>
I edited the source in the y^x section and was puzzled that Lazarus would automatically apply the change to following if-then block, never seen that before
« Last Edit: January 09, 2026, 03:48:23 pm by srvaldez »

tailkinker

  • New Member
  • *
  • Posts: 10
Re: RPNCalc in Lazarus
« Reply #3 on: January 12, 2026, 04:40:45 am »
You mean their "fancy" (excessive) requirements for placing apps in their "app stores"? Can't you also put compiled versions of your program on GitHub?

No, I mean the fact that it's nearly impossible to get a working dev environment running for free.  :)  Couldn't keep a Windows 10 virtual box stable long enough to compile, and unless you're stupid enough to actually buy a Mac, you can't install MacOS at all.

tailkinker

  • New Member
  • *
  • Posts: 10
Re: RPNCalc in Lazarus
« Reply #4 on: January 12, 2026, 04:42:09 am »
good day tailkinker
it compiles and runs OK in Windows, but I think that the order of y^x are wrong, 2 ENTER 3 y^x should give 8 not 9
<edit>
I edited the source in the y^x section and was puzzled that Lazarus would automatically apply the change to following if-then block, never seen that before

Good to know it compiles cleanly under Windows.  And yeah, the power function is backward.  I'll fix that in my source and push it.  Thanks for catching that.
Also, the most recent commit includes some visual improvements.
« Last Edit: January 12, 2026, 04:43:58 am by tailkinker »

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: RPNCalc in Lazarus
« Reply #5 on: January 13, 2026, 01:31:40 pm »
The forum is littered by RPN calculators.
The oldest I remember is by Marcov and I believe I also added one. (both are really, really old)
That is because RPN is pretty much a standard educational task in CS.
There are undoubtedly many, many more..., forgive me if I did not mention you.

I also added a Forth interpreter somewhere in the distant past. (Forth ~= RPN based language)

« Last Edit: January 13, 2026, 01:36:41 pm by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

jwdietrich

  • Hero Member
  • *****
  • Posts: 1271
    • formatio reticularis
Re: RPNCalc in Lazarus
« Reply #6 on: January 18, 2026, 12:07:32 pm »
It is nice and compiles well on the Mac as well, but the code is still buggy. For example calculating the BMI, a simple task, results in a crash.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 4.2.0 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

jwdietrich

  • Hero Member
  • *****
  • Posts: 1271
    • formatio reticularis
Re: RPNCalc in Lazarus
« Reply #7 on: January 18, 2026, 12:13:43 pm »
The forum is littered by RPN calculators.
The oldest I remember is by Marcov and I believe I also added one. (both are really, really old)
That is because RPN is pretty much a standard educational task in CS.
There are undoubtedly many, many more..., forgive me if I did not mention you.

I also added a Forth interpreter somewhere in the distant past. (Forth ~= RPN based language)

Creating an RPN calculator is an elegant way to develop something useful.

To add another example: The TRURL project is a quite universal class library for creating calculators using reverse Polish notation in Object Pascal.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 4.2.0 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

 

TinyPortal © 2005-2018