🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

maths

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

maths

0.0.14
Rubygems
Version published
Maintainers
1
Created
Source

Maths

Maths is a command line calculator. I do a lot of number crunching, and always get frustrated with other solutions, like my phone calculator, a physical calculator, or Alfred because they don't keep a good record of what I've done with them when I'm using them for more than one calculation at a time.

Installation

Just install the gem:

$ gem install maths

Usage

To start maths, just run it in your terminal:

maths

Then do some math:

Welcome to maths (version 0.0.1)!
Type "exit" to quit.

maths> 5 + 5
= 10
maths> 5 / 5
= 1
maths> 20 * 3
= 60
maths> 8 - 4
= 4
maths> 4.4 + 3.2
= 7.6

Maths also supports assigning variables:

maths> x = 10
= 10
maths> x
= 10
maths> x + 4
= 14

You can even assign multiple variables at once:

maths> x = y = z = 25
= 25

There's even a special variable, $, that is always set to the result of the last calculation:

maths> 5 + 5
= 10
maths> $
= 10

And of course, sometimes you'll want to close the app:

maths> exit

Variables persist in maths between runs of the command, so feel free to exit and reopen maths all you want - those variables will stick around between executions.

If you'd like to list all defined variables, use the vars command:

maths> vars

Defined Variables:
s: 10
$: 12345
z: 25
y: 25
x: 0.4

You can also copy your last result to your system clipboard with the copy command:

maths> 5 + 5 
= 10
maths> copy
Copied 10 to your system clipboard.

Tell Us More, Bob

Maths can do all sorts of great math!

Absolute Values!

maths> |-5|
= 5

Square Roots!

maths> sqrt 25
= 5

Cubed Roots!

maths> cbrt 27
= 3

More Trig than you can shake a stick at!

maths> sin 30
= -0.9880316240928618
maths> asin 30
= -0.9880316240928618
maths> sinh 30
= 5343237290762.231
maths> asinh 30
= 4.09462222433053
maths> cos 30
= 0.15425144988758405
maths> acos 1
= 0
maths> cosh 30
= 5343237290762.231
maths> acosh 30
= 4.0940666686320855
maths> tan 25
= -0.13352640702153587
maths> atan 25
= 1.5308176396716067

Logarithms!

maths> ln 25
= 3.2188758248682006
maths> log 25
= 1.3979400086720377
maths> log2 32
= 5

Rounding!

maths> floor 5.5
= 5
maths> ceiling 5.5
= 6
maths> round 5.5
= 6

Exponents!

maths> 2 ^ 4
= 16

Percentages!

maths> 2 as a % of 4
= 50%
maths> 5 as a % change from 10
= -50%

Maths also includes some constants:

Pi!

maths> pi
= 3.14159265358979323846264338327

Maths is still pretty new - I hacked the original version together on a flight, and it's still maturing. If you'd like to see something added, let me know in the issue tracker.

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

FAQs

Package last updated on 26 Jan 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts