USINGMAC.com

USINGMAC.com

FUN WITH USING A MAC

FUN WITH USING A MAC

FEB
20

Besides doing logical expression, Leopard Spotlight can also do some mathematical calculations. Are you curious what are those functions?

I know a little bit about Java Programming Language, so I try to use the Math library, which contains some functions to do scientific calculations, on Spotlight. To my surprise, some of these functions work.

Here are some examples :

Trigonometry

  • sin(0.5) = 0.479
    sinus of 0.5, result in radian.
  • cos(0.5) = 0.878
    cosinus of 0.5, result in radian.
  • tan(0.25) = 0.255
    tangent of 0.25, result in radian.
  • asin(1) = 1.57
    arc sinus of 1 radian.
  • acos(1) = 0
    arc cosinus of 1 radian.
  • atan(1) = 0.785
    arc tangent of 1 radian.

Approximation

  • ceil(0.48) = 1
    Rounded to nearest smaller integer value.
  • rint(0.51) = 1
    Rounded to nearest integer value.

Exponential and Logarithm

  • exp(2) = 7.389
    Euler's number e to the power of 2.
  • pow(5,2) = 25
    5 to the power of 2.
  • sqrt(36) = 6
    Square-root of 36.
  • cbrt(216) = 6
    Cube-root of 216.
  • log(1e3) = 3
    Logarithmic base 10 of 1*10^3.

COMMENTS

Himavanth B

February 20th, 2008 at 11:47 PM

well i don't no that it can even calculate Trigonometry and others thanks

Peter

February 21st, 2008 at 11:34 PM

heh great stuff..

christian

February 22nd, 2008 at 01:27 AM

Of what kind is the relation between Spotlight and the Java Math library?

Juan de Dios Santander Vela

May 15th, 2008 at 05:46 PM

In fact, Spotlight is written in Objective-C, and uses math.h functions. Java took some of those functions for the java.math package. I've written a exhaustive exploration of math.h functions available through Spotlight's calculator in Spanish, but the functions summary is easily understandable. http://www.entremaqueros.com/bitacoras/memoria/?p=946


LEAVE.A.REPLY

Your Name:

Your Email:

Your Website: