e: Like a diamond bullet

I will apologize first, for the long lapse in communication. The end-of-season workload in real life took over late last week, and very foolishly I did not make preparations for posts during that time. I should have; I knew it was coming, but I acted all surprised when I suddenly had no time for the things I enjoy — like picking around at software.

But it should all be okay now. At least I have a better handle on real life responsibilities. :\

e is the topic of choice today, and what I’d really like to point out about e is this:

-rwxr-xr-x 1 kmandla users 6.9K Jul 11  2001 e
-rw-r--r-- 1 kmandla users 4.0K Jul 11  2001 e.c

Yup, the e binary is a meager 6.9K in size, and the source code would fit in an Atari 2600 game cartridge. Technically. Sort of. Maybe. 🙄

That’s impressive for a one-shot command-line expression evaluator — or calculator, as some like to call it. Hand just about any expression to e and it will click and sputter briefly before throwing out an answer.

And not just simple math either. All these things are legitimate e commands.

kmandla@6m47421: ~/downloads/e-0.02718$ ./e 128!

kmandla@6m47421: ~/downloads/e-0.02718$ ./e 1/2*1/3*1/4*1/5

kmandla@6m47421: ~/downloads/e-0.02718$ for i in {0..90..15} ; do ./e sin[${i}] ; done

That’s impressive for a 7K binary with no, repeat no dependencies. To quote from the home page, “It doesn’t need bison or anything else other than a C compiler. In fact it is a recursive-descent parser with one character look-ahead.”

For its size and its potential, e should be an addition to just about any system. No more mucking around with bc while trying to balance your checkbook. e can solve it all in a fraction of the time, and take up no more space than a postage stamp.

And if you enjoy math logic, the home page has an interesting (and convincing, from my uneducated perspective) treatise on why zero is not a number and why just a plus sign — “+” — should evaluate to zero. I’m a believer now.

By the way, I owe a small note of thanks to NiceGuyJoe on reddit who sent me a message months ago linking to e, and it has just come up in the rotation. A good lead, all the same. 🙂

Now, let’s talk about that one-character program name. … 😡

4 thoughts on “e: Like a diamond bullet

  1. livibetter

    I believe what you meant is sin[${i}*pi/180].

    By the way, anyone knows about who actually wrote e? Can’t find any names in the tarball. Although there is GPL to indicate the open source, still need a name.

    I am thinking about make it a Bash loadable extension for maximal performance, but not sure if that’s worth if anyone really needs doing mass calculations with float number in Bash scripts.

    1. K.Mandla Post author

      Yes, that would make more sense mathematically, wouldn’t it? 😉 I should have paid closer attention to the results instead of just copy-and-pasting the output.

      Sorry, I have no more information about e than what is on the home page. 😦 And by all means, make it a bash loadable, and if someone needs it, they will thank you. 🙂

      1. livibetter

        I managed to find it by searching the name of tarball, from there, I found a dead link to the original author’s website, whose name is Dimitromanolakis Apostolos and Wayback Machine has archive of it.

        I didn’t think I’d go ahead to do the loadable, but I did. If anyone is interested in that, though I doubt, e.bash is. Here, I will just give you a quick number: e = 554 runs, loadable with -v = 12,921, you can see the huge difference in performance, 23.3 times faster.

  2. Pingback: Links 19/8/2014: GNU/Linux Raves and Alternative to Proprietary Voice Chat | Techrights

Comments are closed.