Share your repls and programming experiences

← Back to all posts
NEW BEST CALCULATOR ON REPL.IT
Kudos

NEW BEST CALCULATOR ON REPL.IT title may or may not be stolen from @henryeth

From thought to idea to working code, I present to you a great calculator. I have been coding in the dark for many days now, to shine it upon the light!

So, you ask why it's the best calculator on Repl?

Let's compare 2 calculators including mine (thanks to a friend for making it):

Here's a more complete (and slightly less biased lol) version with 3 being compared:

Has:MineHeneryeth'sFlaminHotValdez's
Additionyesyesyes
Subtractionyesyesyes
Multiplication /w *yesyesyes
Multiplication /w xyesnono
Divisionyesyesyes
Exponentsyesyesyes
** for exponents tooyesnono
Modulusyesyesno
Unary operatorsyesyes (but no use)no
Negative numbersyesnono
Multiplication by parenthesisyesnono
Factorialsyesyesno
Scientific notationyesnono
Square roots ((2^2)s returns sqrt of 2^2)yesnono
Use calculator more than 1 time per runyesyesno
Built in generally fast languageyesnoyes
Lots of colors!yesnono
Algebranonono
Fast startup timesyesyesno
Greater than or equal toyesnono
Less than or equal toyesnono
Less thanyesnono
Greater thanyesnono
Equal toyesnono
No floating point inaccuraciesyes (as I'm aware of)noyes
Decimalsyesyesyes
Exclude the 0 in floats without occasional side effects (like 1+.9 instead of 1+0.9yesnono
Error handlingyesnono

Yes, you just saw error handling in my calculator's features maybe solely because I don't want people abusing this calculator
I have everything the two other calculators have (as I currently know) and more!
Here are some great pics showing off the calculator's capabilities!

Notes:

  • Inspired to do this after @henryeth made a calculator (to expand knowledge)
  • Made by converting the expression/equation to Reverse Polish Notation with the Shunting yard algorithm, which is then easily solved
  • Any inaccuracies in this post that should be corrected please tell me
  • I made a goal to not use any external dependencies other than those rust has itself, which meant lots of code.
  • Please don't look at the code it's ugly don't blame me for writing
    432 lines of bad code distributed among 13 files I already know :(
  • No hate/spam/unconstructive criticism plez
Voters
MattDESTROYER
xxpertHacker
programmeruser
JBloves27
Soccer135246
FlaminHotValdez
henryeth
LegendaryWolf
Whippingdot
ch1ck3n
Comments
hotnewtop
Coder100


this is the reason why replit needs to have CARGO and not RUSTC

smh

Kudos

@Coder100
Heh. I could have used cargo by running cargo init in the terminal and changed the run command to cargo run but I'm a masochist by nature ;)

FlaminHotValdez

Fine I concede defeat >:(

Kudos

@FlaminHotValdez
HURRAH!
HURRAH!
THE KING'S SUCCESSOR FINALLY REIGNS SUPREME!

FlaminHotValdez

@Kudos rip... But can we just take a moment to appreciate the fact that you commented on AJK4's post about how his code is literally just spam if statements and an eval() function. He denied it, I argued with him, and guess what he does? He goes and deletes the post. Srsly.

Kudos

@FlaminHotValdez @AJK4 Hehe, I know him personally, nothing new.

FlaminHotValdez

@Kudos ah ok

Kudos

@FlaminHotValdez

He sometimes gives me a laugh

FlaminHotValdez

@Kudos tell him that his work is just spam if statements

JBloves27
ch1ck3n

oK THIS IS THE BESt

Kudos

@ch1ck3n
The best calculator doesn't deserve an upvote? ;) gotem

ch1ck3n

@Kudos

this happens

Kudos

@ch1ck3n
It's the thought that counts :) (btw send that to support as an issue because that's not supposed to happen)

ch1ck3n

@Kudos nah it worked

Kudos
Coder100


haha get rekt

Kudos

@Coder100
NOOOOOOOOOOOOOOOOOOOO SOLViNG IT
Edit: solved

Whippingdot

I admit it, this is godly:

NOICE

Kudos

@Whippingdot
Shoutout to @math for the godliness!

Whippingdot

lul @Kudos

henryeth

@Kudos When there actually is a user called math...

henryeth

@Kudos you literally just need to go to the history and bring it back

Kudos

@henryeth
I think it's fixed but there might be some bugs when I restored it.

DeluxeDrxps

It looks AMAZING! I'm usually good at errors and bugs and I couldn't find any, great job!

FlaminHotValdez

I'm aware that this is an old post but...My post does not have floating point inaccuracies, and well...the slow startup time? BLAME REPLIT

EDIT: Mine also has decimals...-_-

Kudos

@FlaminHotValdez
Maybe you could change the run command to execute the binary instead of compiling it every single time (what I did).

Your post does not have floating point inaccuracies, and has decimals.
But there aren't any floating point inaccuracies because the number is truncated to the first 10 digits.

FlaminHotValdez

@Kudos I truncate it to 10 digits because nobody really cares after that lol...we are a coding community, not NASA trying to calculate the value of pi to the millionth decimal point.

Kudos
IOP3

BenCavanaugh

no PEMDAS

should equal 9.8 if you are using PEMDAS, (parenthesis, exponents, multiplication, division, addition, subtraction.)

Kudos

@BenCavanaugh
I acknowledge that's the wrong answer, but how in the world does that expression equal 9.8? Google says it is 10.

BenCavanaugh

@Kudos google does the division first when they should put multiplication first.

5 + 5 - 5 % 5 * 5

5 + 5 - 5 % 25
5 % 25 = 0.2

5 + 5 - 0.2

10 - 0.2 = 9.8

Kudos

@BenCavanaugh

I thought 5 modulo 25 is 5???

It looks like you're doing division where there's a modulo operator...

FlaminHotValdez

@BenCavanaugh % means modulus or remainder, not divide.

xxpertHacker

I thought that this would be parsed as (2 ^ (3 ^ 4)), therefore it would be (2 ^ 81) and then (2417851639229258349412352)?

Otherwise, nice!

Now allow me to to type in:

;)

Kudos

@xxpertHacker
Ah, just saw this. I'll might loop over the equation in reverse and solve the exponents backwards as a result, or do a look ahead to see if there is an exponent sign immediately following another exponent sign.

xxpertHacker

@Kudos Well, first, what do others think?
Is that a good order to go in?

Kudos

@xxpertHacker

I just made a small change to the algorithm, exponents now solve correctly. Didn't have to do anything excessive.

xxpertHacker

@Kudos Cool, good to hear that it wasn't hard either.

JBloves27

Really nice calculator!

Kudos

@JBloves27
Thanks :)

JBloves27

Np! :) @Kudos

henryeth

I think I have caught this in the middle of testing...

TalinSharma

Huh?

Kudos

@TalinSharma
It's called scientific notation and it's used for really big numbers. I just noted that the scientific notation my calculator uses differs from what google uses

TalinSharma

Actually ever mind... I meant to enter 2*100^1000 so I got the wrong output.. nvm

@Kudos

henryeth

You cannot layer unary operators for example (2^2)s! and 3!! raise artificial errors.

Kudos

@henryeth
Yikes. You can use parenthesis for now, but I'll include that in.

Edit: Old post but I came back to this and it's fixed

henryeth

YYYEEESSS I FOUND SMTH MINE DOES AND URS DOESN'T. Mine ignores illegal characters and urs raises errors for them I mean c'mon...

Kudos

@henryeth
Lol that's fair, but [custom] errors mean that there will be less people abusing my calculator because 1n is -1, and more people will just simply be getting annoyed that they can't make an unexpected result ;) gotem

henryeth

Well played. Thank you especially for pinging me twice in the description and mentioning me on my calculator and mispelling my name once in the description. I will get this title back do not worry hehe. Maybe in Python though, the "slow" programming language.

Kudos

@henryeth
If you outdo me I'll re-outdo you 😁

henryeth

@Kudos Might need algebra for that... I wonder how long this will go on for.

FlaminHotValdez

fml I make a post titled "Actual good calculator" and now there are like 2 more best calculator on replit wannabes. :'(

henryeth
Kudos

@FlaminHotValdez
I just googled that acronym and I didn't get a pretty result..

henryeth

@Kudos umm yes, indeed

FlaminHotValdez

@Kudos Sowwy

FlaminHotValdez

Our dear community hates calculators and will spam hate comments here. Like fr just read my comment section :'(

Whippingdot
henryeth

@FlaminHotValdez Begging doesn't work eh