logo

How to Check Approximate Values in Julia 📂Julia

How to Check Approximate Values in Julia

Code

Using the comparison operator $\approx$, it only returns true when two values are sufficiently similar. can be used by entering \approx and then pressing Tab, just as in $\TeX$.

julia> π ≈ 3.141592653
true

julia> π ≈ 3.14159265
true

julia> π ≈ 3.1415926
false

julia> π ≈ 3.141592
false

Environment

  • OS: Windows
  • julia: v1.7.0