Page 1 of 1
Infix calculator
Posted: Fri Apr 28, 2023 5:23 am
by TediusTimmy
I have this in a state where I think I can show off some of it. Here's a calculator portion of the thing I'm working on. I'm working in C, and the code isn't in a state that I want to release it.
It's an eight digit decimal calculator. It uses infix notation. It is only a four-function calculator, though, but you can put parenthesis in. In the zip file is also the same program compiled for Windows (it is a C program after all). Just type in an expression and hit enter. It doesn't prompt you or anything. If you hit enter with a blank line, the program ends (or, if the line only has one character in it; I tried to fix that).
The numbers only truncate. The exponent range is small. The decisions for how to print numbers are arbitrary.
Try It Now!
#R42
Re: Infix calculator
Posted: Wed May 03, 2023 4:45 pm
by mobluse
Try It Now doesn't work for me, but normally Try It Now works for me. I use Chromium in most updated Debian 11 Bullseye (aarch64) for Raspberry Pi 4B. Maybe it's because you included a Windows version and that might make the file too big. That's just one hypothesis.
Re: Infix calculator
Posted: Wed May 03, 2023 11:07 pm
by Edmond D
Try it now failed using Safari 16.4.1 on Mac OS 12.6.5 It may be the emulator is having an issue.
Looking via Safari's web inspector
Re: Infix calculator
Posted: Thu May 04, 2023 4:09 am
by Cyber
TediusTimmy, manifest file should have json extention, not txt. So emulator is just ignoring your manifest, and loads all files from zip, then runs prg file. It's fine, but I think it's not what you wanted to do. )
Also I noticed that emulator not always runs the program. Seems there is problem with some async call, I'll look into it.
Re: Infix calculator
Posted: Fri May 05, 2023 1:11 am
by TediusTimmy
@
Cyber - Thank you. I forgot to rename the manifest file and never noticed. It should now be fixed in the OP.
I am going to also reupload it as the program file. If the other one fails, try this one.
Try It Now!
Re: Infix calculator
Posted: Sun May 07, 2023 1:09 pm
by mobluse
I got both to work with Try It Now, but I had to press F9 many times to get the keyboard layout I use: en-gb. Otherwise I couldn't enter +, * etc. In the latest ROM after R42 F9 doesn't seem to work to change keyboard and I need to set keyboard layout using KEYMAP "EN-GB", but you cannot use KEYMAP in programs that start using Try It Now. Try It Now tries to identify the keyboard using the preferred language in the browser, but that doesn't match the keyboard in my case.
Re: Infix calculator
Posted: Sun May 07, 2023 7:56 pm
by Ender
mobluse wrote: ↑Sun May 07, 2023 1:09 pm
I got both to work with Try It Now, but I had to press F9 many times to get the keyboard layout I use: en-gb. Otherwise I couldn't enter
+,
* etc. In the latest ROM after R42 F9 doesn't seem to work to change keyboard and I need to set keyboard layout using
KEYMAP "EN-GB", but you cannot use KEYMAP in programs that start using Try It Now. Try It Now tries to identify the keyboard using the preferred language in the browser, but that doesn't match the keyboard in my case.
You can change the layout with the "menu" command and then "keyboard layout".
Edit: Nevermind, I just tried it in the web emu and it doesn't seem to work.... I guess that was added after R42.