In [1]:
# This is a comment
# I want to be able to use the Plots module
using Plots
INFO: Precompiling module Plots...
In [1]:
# Julia is typed
1+1
Out[1]:
2
In [2]:
1. + 1.
Out[2]:
2.0
In [3]:
@show typeof(1+1)
typeof(1 + 1) = Int64
Out[3]:
Int64

In [5]:
@show typeof(1.+1.)
typeof(1 .+ 1.0) = Float64
Out[5]:
Float64

In [8]:
# Having types can be helpful!
# Matlab really has types too, it's just many things default to Float64
set_bigfloat_precision(256)
BigFloat(1.)+BigFloat(1.)
Out[8]:
2.000000000000000000000000000000000000000000000000000000000000000000000000000000
In [12]:
# BigFloat's can be confusing
@show BigFloat(2.1)          # represents 2.1 as a Float64, then convert to BigFloat
@show parse(BigFloat,"2.1")  # parse the string "2.1" as a BigFloat
@show big"2.1"               # shorthand for parse(BigFloat)
BigFloat(2.1) = 2.100000000000000088817841970012523233890533447265625000000000000000000000000000
Out[12]:
2.099999999999999999999999999999999999999999999999999999999999999999999999999986
parse(BigFloat,"2.1") = 2.099999999999999999999999999999999999999999999999999999999999999999999999999986
@big_str("2.1") = 2.099999999999999999999999999999999999999999999999999999999999999999999999999986