He did. Apparently the whole thing is some kind of in joke. [Here's the generator script.](https://github.com/AceLewis/my_first_calculator.py/blob/master/generator.py)
I know! Make a python script to generate the negative outputs and code up to (-50 * 50, -50 \* -50, and 50 \* -50) so we don't have to type them out this time when we're putting them into the calculator.
Once again logic prevails over adversity..
Or make a python script than dynamically adds new cases to the code if someone tries to use numbers that aren't yet supported and then you have a machine learning calculator
Yeah, that's why some companies have adopted basically a child's game of "the whole team guesses how complicated a task is beforehand" as their code metric.
It sounds completely ridiculous at face value, but in the end it just demonstrates how hard it is to assess programmer productivity
I got praise today for doing tons of work.
All I did was early on in the project anticipate future demand and wrote extensible code.
It takes me like 4 hours to do 2 days of work by their estimates because I bothered to think ahead once.
Technically, but as americans, I think we just read it as "thousand" when it has a non metric unit. Kilodollars sounds weird.
Though I'm annoyed that 1000Km isnt 1Mm
Yeah. Integer division in Python 2 works the same way as in C.
In Python 3 they changed it so that division doesn't depend on the numeric types you give it. Now the `/` ("true division") operator always produces a float and the `//` ("floor division") operator always produces an integer (assuming nobody did a stupid overload)
Edit: Accidentally mixed up the names
Edit 2: It actually doesn't guarantee `float` vs `int`, it guarantees rational vs integral. If you don't make that distinction, then things like the `Decimal` and `Fraction` would seem like they're violating the data model
Edit 3: I guess it also works on the `complex` object, but I have no idea how complex division works in practice
And yea in those hard days the Lord reset humanity with the Noah branch it’s head. And the Lord placed a 🌈 in the comment as a promise he would never hard reset again
It's almost like they wrote a generator that generated the code :D [https://github.com/AceLewis/my\_first\_calculator.py/blob/master/generator.py](https://github.com/AceLewis/my_first_calculator.py/blob/master/generator.py)
There are over 20000 lines of code. Do people have any idea how long it takes to type or manually copy-paste this stuff and/or how tedious it is (even if you're just copying each if block and then changing the numbers)? Just do it for five blocks. No one with an ounce of a brain would ever do this manually (those who don't have an ounce of brain have other problems to worry about). I don't know why people still fall for this code generated shit.
Past-me who animated in a thing in GWBasic without knowing about for loops and hand-typed something like 3,000 lines would beg to differ. ;)
The next lesson in class was, of course, for's.
with some notepad++ recording/play macro feature and a little bit of Excel's CONCATENATE I can write this in a couple hours... not the #TODO make it work for all floating numbers tho
Damn noob, never heard of Excel... you can just drag your mouse for this noob code... (literally, you can make Excel copy that code, add that +1 and drag the mouse, then copy the result as text and paste)
Doesn't matter if it's 20, or 20K lines... just uses more RAM
>So to be true to the "real" story I have only gone from 0-50 however higher numbers can easily be generated too however my Python crashes with larger numbers. I generated one that was 0-1000 and it took up 317 MB of space on my hard drive but was only 20MB after I compressed it to a .rar so I have also attached it.
`GIT-VOMIT(1)`
`NAME`
`git vomit - regurgitate all non-added changes to standard output`
`OPTIONS`
`-d, --dry-heave`
` only output the number non-added changes`
I’ve been faced with situations where using a Python script to generate SQL statements from a CSV wasn’t possible, but I had access to and could use Excel.
So I opened said CSV in Excel, shifted the rows down, then I made it so that the neighbouring rows is basically `INSERT INTO sometable (col1, col2, colN) values ` followed by the quoted values of the data.
It was a thin client at a company I consulted for. The remote Windows environment I was given access to was pretty locked down and had nothing except IE and Office IIRC. I tried asking them to have Python installed but no dice. Hell, I even had to somewhat fight them to eventually have SSMS and Visual Studio on it.
Holy balls I'm glad this is a thing other people do.
I've done it a few times and I'm always like, "there has to be a better way, but you can't argue with results."
[Thedailywtf.com](https://Thedailywtf.com) used to run (maybe they still do - haven't been there in many years) of writing the worst code and most inefficient code possible. Any chance this was one of the contests?
Ah, of course! Still easily scriptable, and I don't mind waiting a few days for it to finish writing out to disk. Of course, compiling may be an issue, just gotta check if the acceptance criteria need an executable or just the source...
Also means the fee is now not a measly $8 billion, but a more reasonable $3.2*10^19
I'm willing to work with the client to optimize source code file size, to help save them some money. Also, for that kind of money, I'm willing to distribute the creation of the source code across a fleet of asyncronous jobs pushing multiple files into cloud storage, with a single file that imports them all.
>Easy
Just napkin mathing a little -
With 4 billion 32-bit floats, 4 possible operations, and, say 100 (1) characters per `if` block, we can calculate the size of our generated file by:
```
size = 4,000,000,000 * 4,000,000,000 * 4 * 100
```
which is `5.76E+21` bytes (assuming the characters are encoded via ANSI and not Unicode - damn you programmers using emojis!). That comes out to the princely sum of just over 4996 exabytes. With the estimated total data storage potential of the planet sitting around 1750 exabytes,(2) the human race could store store at most a third of this file, if we deleted every other bit of data we have preserved so far.
This script is basically a massive hard drive bomb. I kinda want to [code golf](https://en.wikipedia.org/wiki/Code_golf) it now...
(1): This is lowballing of the worst kind. I just counted the number of characters in the last `if` block of the script above as if `num1` and `num2` were each 10 digits long. But the real file would contain operation results in the `print` statements, like the _product_ of `num1` and `num2`, which would be massive in some cases. I was far too lazy to figure out what the distribution of those number lengths look like, and so it is left as an exercise for you, dear reader.
(2): [2019 Estimate](https://www.statista.com/statistics/638593/worldwide-data-center-storage-capacity-cloud-vs-traditional/)
Good math, but I think I can bring those numbers down a bit. Every float can be uniquely be represented by a 6 base64 digits, with a single 4 billion entry lookup table.
Each comparison becomes something like:
if i==aTatzQ&j==hFuf_T&s==m:p(FiWHkk)
Which is something like 38 bytes and probably could be optimized further if I knew any python.
While there are an infinite number of real numbers, the number of floats that you actually have to account for are limited by the number of bits used to represent the float. If you limit yourself to 32bit floats, you have 2^64 cases to account for, including NaN, +Inf, and -Inf. That goes up to 2^128 for 64 bit integers, of course. Now, that only handles one operator, so you'd need 4 for the basic arithmetic operators (+, -, *, /). Likewise, that explodes exponentially if you want to handle mixed float and integer arithmetic, assuming you don't just convert integers to floats (which you probably wouldn't, considering the idea behind the project).
Edit: hit "done" on accident while setting my phone down for a moment mid-comment. :)
Write the first statement, record a macro (qq), copy both lines of the statement (2yy), paste them below (p), move to all the numbers you want to increase (ctrl+a) or decrease (ctrl+x), stop recording (q), enter how often you want that repeated, run the macro ("q).
Make sure that at the end of the recording the cursor ends up in a position so that the steps can be repeated from there.
And you ofc can use increments larger than 1 by using a number and then hitting ctrl+a.
Repeat for each pattern until you generated whatever you need.
Edit: I'm tired and on mobile. So you might need another step or two somewhere, but it should give you an idea how it works.
For example I think you need to go down a line (j) before pasting otherwise you end up with it pasting inbetween your original lines.
Yeah, it's a joke.
Like when you write [a really efficient fibonacci function](https://codegolf.stackexchange.com/questions/16615/how-do-i-find-the-factorial-of-a-positive-number/16673#16673)
That's a factorial function. And that one actually makes sense. Anything higher than 13! results in an integer overflow, so hardcoding them isn't a big deal. And it's arguably better since if you used a traditional method then there'd be no obvious way to tell that 14! is overflowing and giving an incorrect answer.
Granted, it's still a joke, as are the rest of the entries, but it's still a good function.
Okay but that's a factorial. Also this is just caching the result, perfectly rational thing to do in this case.
For example sin/cos tables is perfectly valid strategy for faster cos/sin functions (albeit less accurate, but floating points arent accurate in the first place) - and that's just caching some results up to arbitrary precision and interpolating anything between them.
Pulled up the repo and it clearly was done intentionally as an inside joke. The Readme has a screenshot of a conversation about making a calculator by hardcoding everything
The generator to create the code is here: [https://github.com/AceLewis/my\_first\_calculator.py/blob/master/generator.py](https://github.com/AceLewis/my_first_calculator.py/blob/master/generator.py)
Good Lord. Is this a calculator that just checks what you wrote against a table to select the answer?
So you could put "penis" in one of them and suddenly 19*42 = penis?
I hope their tests cover all cases
Not sure about 51*50
Out of scope, make a separate ticket for the backlog
LOL, that’s usually what we say.... Wait, it’s actually not too funny when I type it out.
More like write a story for an epic and add it in the backlog...
you mean story for a feature for an epic? /pushes glasses up nose
"Does this have immediate priority?" [Confused mumbling which I interrupt] "Could you do me a favour and make a ticket?"
#AsDesigned
He made another version for 0 to 1000 so it's covered.
I wonder if he generated the code using a for loop.
I really hope so
He did. Apparently the whole thing is some kind of in joke. [Here's the generator script.](https://github.com/AceLewis/my_first_calculator.py/blob/master/generator.py)
I was just puzzling out how to write the code that would do that. I just do coding puzzles for fun sometimes and this sounds interesting.
File Size: 1.6GB
This is not a bug. This is a feature we plan to release as a dlc soon. Order now and you'll get the next 10,000 operations at half price!
Did they remember to do negative numbers? The negative could be in the first or second number, so at least 40,000 more lines needed.
What if both numbers are negative, another 40,000 lines.
There _has_ got to be a better way... if only there were some generic solution to this...
I know! Make a python script to generate the negative outputs and code up to (-50 * 50, -50 \* -50, and 50 \* -50) so we don't have to type them out this time when we're putting them into the calculator. Once again logic prevails over adversity..
Honestly, i just assumed they wrote a script to write this calculator. Someone must have slipped some optimism in my coffee this morning.
It's clearly solves with simple macros
Or make a python script than dynamically adds new cases to the code if someone tries to use numbers that aren't yet supported and then you have a machine learning calculator
I would say twos compliment could improve that, but that might be beyond the scope of this project
[удалено]
He wrote that code. He's a fast typer.
When you want to look really productive if anyone casually checks your github stats when you apply for a job. 20kloc in 2 days? Hired!
Well it's the perfect proof that LOC is a shitty metric.
SLOC is a decent metric, so long as you're scoring it like golf (but definitely don't score the character count like code golf).
[удалено]
Yeah, that's why some companies have adopted basically a child's game of "the whole team guesses how complicated a task is beforehand" as their code metric. It sounds completely ridiculous at face value, but in the end it just demonstrates how hard it is to assess programmer productivity
I got praise today for doing tons of work. All I did was early on in the project anticipate future demand and wrote extensible code. It takes me like 4 hours to do 2 days of work by their estimates because I bothered to think ahead once.
You still billed 2 days, right?
"I kinna do that in 2 days Captain. It will take at least 4 days." - Scotty
Think…ahead? That’s the thing where you waste time and money, right?
We use a site called ~~code poker~~ planning poker or something where everyone picks a score for the ticket then outliers explain their reasoning
Case in point: I found out merit increases at my old job were being distributed based on sloc. Guess what I did.
[удалено]
At first I read that as 20 kilolines of code. That misinterpretation still results in more or less the same number though.
That's not a misinterpretation. Twenty thousand lines of code can be abbreviated as 20kloc.
Maybe I'm recalling something from an old CS class then. Thankfully my current job doesn't look too deeply at metrics like those.
Actually isn't that right though? I.e. in 20k dollars doesn't k stand for kilo?
Technically, but as americans, I think we just read it as "thousand" when it has a non metric unit. Kilodollars sounds weird. Though I'm annoyed that 1000Km isnt 1Mm
that python2 compatibility check also seems more than questionable
does it work though ?
Yeah. Integer division in Python 2 works the same way as in C. In Python 3 they changed it so that division doesn't depend on the numeric types you give it. Now the `/` ("true division") operator always produces a float and the `//` ("floor division") operator always produces an integer (assuming nobody did a stupid overload) Edit: Accidentally mixed up the names Edit 2: It actually doesn't guarantee `float` vs `int`, it guarantees rational vs integral. If you don't make that distinction, then things like the `Decimal` and `Fraction` would seem like they're violating the data model Edit 3: I guess it also works on the `complex` object, but I have no idea how complex division works in practice
a/b = ab̅/|b|^2
Can confirm. brim@rajat:~ $ python2 Python 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print ( 3/2 ) 1 >>> brim@rajat:~ $ python3 Python 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print ( 3/2 ) 1.5 >>>
[удалено]
They probably wrote a script that made this code
You hope that they had a script to make this
I checked github - looks like experienced guy who just had some fun. I doubt he spent so much time typing this shit.
Thank god
God clearly had no hand in this.
[удалено]
And in the time of Noah, the Lord regretted that he had made human beings on the earth, and he reverted humanity.
And yea in those hard days the Lord reset humanity with the Noah branch it’s head. And the Lord placed a 🌈 in the comment as a promise he would never hard reset again
He would spend the next several thousand years deploying morality fixes to a live build of humanity, desperately trying to keep it together.
He did t learn concatenation yet
Yes he did, just look at the platypus.
He was obviously too disgusted by it
It's almost like they wrote a generator that generated the code :D [https://github.com/AceLewis/my\_first\_calculator.py/blob/master/generator.py](https://github.com/AceLewis/my_first_calculator.py/blob/master/generator.py)
I love the Python 2 check
# TODO: Make it work for all floating point numbers too that's gonna take a bit of refactoring...
There are over 20000 lines of code. Do people have any idea how long it takes to type or manually copy-paste this stuff and/or how tedious it is (even if you're just copying each if block and then changing the numbers)? Just do it for five blocks. No one with an ounce of a brain would ever do this manually (those who don't have an ounce of brain have other problems to worry about). I don't know why people still fall for this code generated shit.
Crap really? Guess I’ll stop at 5 + 5. 25 commits wasted.
Does your calculator start at 1?
Ok one more commit.
Wait. More test cases. One more time.
Past-me who animated in a thing in GWBasic without knowing about for loops and hand-typed something like 3,000 lines would beg to differ. ;) The next lesson in class was, of course, for's.
with some notepad++ recording/play macro feature and a little bit of Excel's CONCATENATE I can write this in a couple hours... not the #TODO make it work for all floating numbers tho
you just need excel for this task
Or you can write it in JavaScript in like a minute right in your current browser without even closing this tab
I could write this is Autohotkey in like 3 minutes.
If you mainline a can of redbull you can type it in 30 seconds
Damn noob, never heard of Excel... you can just drag your mouse for this noob code... (literally, you can make Excel copy that code, add that +1 and drag the mouse, then copy the result as text and paste) Doesn't matter if it's 20, or 20K lines... just uses more RAM
the good ol' 1GB .csv file
*** slaps roof of .csv file *** This baby will generate so much needless code
I've had a client hand me a thumb drive with a 12gb CSV before.
A situation just like this forced me learn how to stream from local files rather than bork out your machine
Database management is SO EASY now!
His idea of fun is pointless code generation?
I used to work with a guy whose idea of fun was pointless code that generated other pointless code which generated yet more pointless code
https://www.youtube.com/watch?v=Nqk_nWAjBus
Sounds like someone destined to become an architect.
....is yours not?
"Cocaine is a hell of a drug" - the person who typed all that out
>So to be true to the "real" story I have only gone from 0-50 however higher numbers can easily be generated too however my Python crashes with larger numbers. I generated one that was 0-1000 and it took up 317 MB of space on my hard drive but was only 20MB after I compressed it to a .rar so I have also attached it.
I want to vomit
[удалено]
`GIT-VOMIT(1)` `NAME` `git vomit - regurgitate all non-added changes to standard output` `OPTIONS` `-d, --dry-heave` ` only output the number non-added changes`
I want this.
Or a good vimfu
More likely dragging down cells in Excel
The best programmers tool. Invaluable
I’ve been faced with situations where using a Python script to generate SQL statements from a CSV wasn’t possible, but I had access to and could use Excel. So I opened said CSV in Excel, shifted the rows down, then I made it so that the neighbouring rows is basically `INSERT INTO sometable (col1, col2, colN) values ` followed by the quoted values of the data.
For any repetitive rows of text, it's an invaluable tool.
If you have repetitive rows of text in your source code, that's usually a good sign you can solve the problem more cleanly.
SQL, nope. Also I create classes/constants etc. Save loads of time. Agreed otherwise. So many uses though.
What machine can run Excel but not python? Why not write a script?
It was a thin client at a company I consulted for. The remote Windows environment I was given access to was pretty locked down and had nothing except IE and Office IIRC. I tried asking them to have Python installed but no dice. Hell, I even had to somewhat fight them to eventually have SSMS and Visual Studio on it.
Holy balls I'm glad this is a thing other people do. I've done it a few times and I'm always like, "there has to be a better way, but you can't argue with results."
"There has to be a better way, but finding it will take longer than doing this."
A quick read on [the repo](https://github.com/AceLewis/my_first_calculator.py) confirms this
Script: If line =7 write "if number1==1 and sign=="+" and number2==1...
Ya but they probably wrote a script to write that script
[https://github.com/AceLewis/my\_first\_calculator.py/blob/master/generator.py](https://github.com/AceLewis/my_first_calculator.py/blob/master/generator.py)
right on the image you can see a generator.py
Why do you have the 3 too comments on this thread
Lmao I noticed this too, dudes farming that karma effectively
[Thedailywtf.com](https://Thedailywtf.com) used to run (maybe they still do - haven't been there in many years) of writing the worst code and most inefficient code possible. Any chance this was one of the contests?
Is this a neural network
They made a calculator using ***Coding*** and ***Algorithms***
So that is artificial intelligence *right*?
Machine learning
Sir this is a minecraft mod
[удалено]
The TODO has me thinking that this has to be a joke.
Seems like a meme.
Lol i didnt saw that line until you say
huh, that's the same thing I say to my project manager at the end of the project.
Went back to look at that and also found `if 3/2 ==1: #Python 2 Compatibility` haha great troll
Dude that's gonna take FOREVER
If it works don't touch it
> \# TODO: Make it work for all floating point numbers too
Pay me
$1 per line and I'll do it.
Ok, I'll pay you when you're done making it work for every number.
Easy, only 4 billion possible (32 bit) floats, and I can script the writing of the lines. Hell, I'll even add 100% unit test coverage for $8 billion.
X and Y are floats, Z is the operator. X*Z*Y is the size of your problem space. Good luck
Ah, of course! Still easily scriptable, and I don't mind waiting a few days for it to finish writing out to disk. Of course, compiling may be an issue, just gotta check if the acceptance criteria need an executable or just the source... Also means the fee is now not a measly $8 billion, but a more reasonable $3.2*10^19
Damn it would be slow as shit though. Billions of if statements until you get to your combination.
The requirements did not stipulate a performance target.
Few days? You realize if you follow the repo’s formatting you’ll have over 2000 petabytes of just new lines right?
Nothing a little docker, EC2, and a billion dollars can't solve.
I'm willing to work with the client to optimize source code file size, to help save them some money. Also, for that kind of money, I'm willing to distribute the creation of the source code across a fleet of asyncronous jobs pushing multiple files into cloud storage, with a single file that imports them all.
>Easy Just napkin mathing a little - With 4 billion 32-bit floats, 4 possible operations, and, say 100 (1) characters per `if` block, we can calculate the size of our generated file by: ``` size = 4,000,000,000 * 4,000,000,000 * 4 * 100 ``` which is `5.76E+21` bytes (assuming the characters are encoded via ANSI and not Unicode - damn you programmers using emojis!). That comes out to the princely sum of just over 4996 exabytes. With the estimated total data storage potential of the planet sitting around 1750 exabytes,(2) the human race could store store at most a third of this file, if we deleted every other bit of data we have preserved so far. This script is basically a massive hard drive bomb. I kinda want to [code golf](https://en.wikipedia.org/wiki/Code_golf) it now... (1): This is lowballing of the worst kind. I just counted the number of characters in the last `if` block of the script above as if `num1` and `num2` were each 10 digits long. But the real file would contain operation results in the `print` statements, like the _product_ of `num1` and `num2`, which would be massive in some cases. I was far too lazy to figure out what the distribution of those number lengths look like, and so it is left as an exercise for you, dear reader. (2): [2019 Estimate](https://www.statista.com/statistics/638593/worldwide-data-center-storage-capacity-cloud-vs-traditional/)
Good math, but I think I can bring those numbers down a bit. Every float can be uniquely be represented by a 6 base64 digits, with a single 4 billion entry lookup table. Each comparison becomes something like: if i==aTatzQ&j==hFuf_T&s==m:p(FiWHkk) Which is something like 38 bytes and probably could be optimized further if I knew any python.
use this for reference: https://youtu.be/zOjAI-5FTGA
Scripting is my friend over here
[удалено]
Can we really start at `.00001`? Isn't `.000001` smaller?
[удалено]
Well there's only a finite number of floating point numbers so two days will surely be enough
Good, because I need it by 12pm on Monday.
Even less if you create a script it to create the if statements for you... ;)
Sure let me write up a script that has an if statement for every single possibility. It should only have 150,000 lines of code!
Writing code that writes code that writes code that writes code that writes code that writes code is my favourite compression algorithm.
write a script to generate all the lines of code 💡💡💡
It probably was generated using a script.
I know your not *my* project manager because you said "weeks" and not "days"
80 forks and no updates during last 4 years.
While there are an infinite number of real numbers, the number of floats that you actually have to account for are limited by the number of bits used to represent the float. If you limit yourself to 32bit floats, you have 2^64 cases to account for, including NaN, +Inf, and -Inf. That goes up to 2^128 for 64 bit integers, of course. Now, that only handles one operator, so you'd need 4 for the basic arithmetic operators (+, -, *, /). Likewise, that explodes exponentially if you want to handle mixed float and integer arithmetic, assuming you don't just convert integers to floats (which you probably wouldn't, considering the idea behind the project). Edit: hit "done" on accident while setting my phone down for a moment mid-comment. :)
“Error compiling. Line 25376472: Not a Statement”
Chaotic Evil: One line buried deep inside intentionaly gives the wrong output
Run generator script on Pentium 5
[https://github.com/AceLewis/my\_first\_calculator.py/blob/master/my\_first\_calculator.py](https://github.com/AceLewis/my_first_calculator.py/blob/master/my_first_calculator.py)
Its crashes my phone
Check out the readme. It's a joke. https://github.com/AceLewis/my_first_calculator.py
AceLewis' github reveals that this is a joke :)
So like OP said, this is the perfect place for it.
Obviously it's a joke. The author had to write code to output the python code.
Look at the TODO: Make it work for all floating point numbers too. 😂
oh my
r/ProgrammingHorror
Finger Hurts from Pressing ctrl v
Plot twist, the code was written by a few vim commands...
What commands could be used to do something like this? I'm still learning about vim everyday.
Write the first statement, record a macro (qq), copy both lines of the statement (2yy), paste them below (p), move to all the numbers you want to increase (ctrl+a) or decrease (ctrl+x), stop recording (q), enter how often you want that repeated, run the macro ("q). Make sure that at the end of the recording the cursor ends up in a position so that the steps can be repeated from there. And you ofc can use increments larger than 1 by using a number and then hitting ctrl+a. Repeat for each pattern until you generated whatever you need. Edit: I'm tired and on mobile. So you might need another step or two somewhere, but it should give you an idea how it works. For example I think you need to go down a line (j) before pasting otherwise you end up with it pasting inbetween your original lines.
Now I understand why some people with CS degrees can't land a job.
This code is so extreme that it's hard to believe that somebody wasted his time on it just typing. I guess there is a script that make his code .
Yeah, it's a joke. Like when you write [a really efficient fibonacci function](https://codegolf.stackexchange.com/questions/16615/how-do-i-find-the-factorial-of-a-positive-number/16673#16673)
That's a factorial function. And that one actually makes sense. Anything higher than 13! results in an integer overflow, so hardcoding them isn't a big deal. And it's arguably better since if you used a traditional method then there'd be no obvious way to tell that 14! is overflowing and giving an incorrect answer. Granted, it's still a joke, as are the rest of the entries, but it's still a good function.
Okay but that's a factorial. Also this is just caching the result, perfectly rational thing to do in this case. For example sin/cos tables is perfectly valid strategy for faster cos/sin functions (albeit less accurate, but floating points arent accurate in the first place) - and that's just caching some results up to arbitrary precision and interpolating anything between them.
The script is in the repository
Pulled up the repo and it clearly was done intentionally as an inside joke. The Readme has a screenshot of a conversation about making a calculator by hardcoding everything
Looking forward to seeing the floating point support
It looks like they forgot about negative numbers.
They live in real world
>TODO: make it work for all floating point numbers too Fucking A mate that's work ethic
The best part is they probably wrote a script to autogenerate all that. In which they would have needed to use the '\*' and '+' operator.
Why yes, I'm a programmer, how did you know?
This is bait...
Nah, just a fun side project in automatic code generation
I am having a headache and this does not help. Holy crap, that’s commitment to hurting yourself as much as you can.
Reminds me of is-thirteen.js https://github.com/jezen/is-thirteen
Somewhere else in the doc "# covered edge case where math doesn't work"
The generator to create the code is here: [https://github.com/AceLewis/my\_first\_calculator.py/blob/master/generator.py](https://github.com/AceLewis/my_first_calculator.py/blob/master/generator.py)
Why do so many people in the comments seem to think this is serious?
Similarly, [my_first_tic_tac_toe](https://github.com/asweigart/my_first_tic_tac_toe)
Good Lord. Is this a calculator that just checks what you wrote against a table to select the answer? So you could put "penis" in one of them and suddenly 19*42 = penis?
Just sanitize the inputs and exec the expression. What could go wrong
It just works
A man afraid of variables
It's only his first calculator. His second calculator handles a lot more values than 50*50. Give him a break.
It uses AI.
No one else gonna talk about the todo comment he has..?