Julia excels as a numeric computation language. It is even faster than C for certain tasks, but has a syntax almost as simple as that of python. Although, at the beginning, Julia syntax might seem similar to python, things start to change when you want the best performance, or specific numerical functionalities. This is the case of precision specification. When it comes to numerical computing you must be able to have as much precession as you want. Let’s say you have the geeky goal of memorizing the first hundred digits of pi. Just printing it to the console won’t cut it, since pi is an irrational number (represented in julia by the type ::Irrational{:π}):

π = 3.1415926535897...

If you want to print pi with more precession you have to unse it’s BigFloat representation:


Notice that it’s no longer an irrational representation (no dots at the end). This new representation of pi has a specific precession. Default precision is 256 bits:


This is the equivalent of four double values. Let’s try printing pi as represented by 1024 bits. This is done with the setprecision() function within a do block.

setprecision(2^10) do

As you can see, high precision floating numbers are a powerful tool in Julia. I suggest you try playing around with φ, the golden ratio.