# Odd result with negative exponents of 10 in Julia 1.5.2

**URL:** <https://discourse.julialang.org/t/odd-result-with-negative-exponents-of-10-in-julia-1-5-2/48640>\
**Category:** New to Julia\
**Created:** [October 19, 2020, 4:25pm UTC](https://discourse.julialang.org/t/odd-result-with-negative-exponents-of-10-in-julia-1-5-2/48640 "2020-10-19T16:25:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_K](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/david_k/32/18780_2.png) [@David\_K](https://discourse.julialang.org/u/David_K)\
**Post date:** [October 19, 2020, 4:25pm UTC](https://discourse.julialang.org/t/odd-result-with-negative-exponents-of-10-in-julia-1-5-2/48640/1 "2020-10-19T16:25:35Z")

</div>

Hi, I’m relatively new to Julia and just installed version 1.5.2. Can someone explain to me how exponentiation works in this language? This might be incredibly basic, but negative exponents of 10 that are less than -1 throw incorrect answers.

Normal results:  
julia\> 10^-1  
0.1  
julia\> 10^2  
100  
julia\> 2^-4  
0.0625  
julia\> 1e-5  
1.0e-5

Weird results:  
julia\> 10^-2  
0.010000000000000002  
julia\> 10^-5  
1.0000000000000003e-5

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [October 19, 2020, 4:33pm UTC](https://discourse.julialang.org/t/odd-result-with-negative-exponents-of-10-in-julia-1-5-2/48640/2 "2020-10-19T16:33:23Z")

</div>

This is just that Julia (and most programming languages) use Float64 as their default numeric type. Fundamentally computers can’t store all real numbers, so no approach will never round for all numbers.

---

<div class="post-metadata">

**Author:** ![David\_K](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/david_k/32/18780_2.png) [@David\_K](https://discourse.julialang.org/u/David_K)\
**Post date:** [October 19, 2020, 4:35pm UTC](https://discourse.julialang.org/t/odd-result-with-negative-exponents-of-10-in-julia-1-5-2/48640/3 "2020-10-19T16:35:45Z")

</div>

Thanks!

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [October 19, 2020, 4:45pm UTC](https://discourse.julialang.org/t/odd-result-with-negative-exponents-of-10-in-julia-1-5-2/48640/4 "2020-10-19T16:45:56Z")

</div>

yeah when you type `0.01`, the `0.01` it shows is an illusion:

```julia
julia> 0.01
0.01

julia> using Printf

julia> @sprintf "%.19f" 0.01
"0.0100000000000000002"

```

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [October 19, 2020, 6:05pm UTC](https://discourse.julialang.org/t/odd-result-with-negative-exponents-of-10-in-julia-1-5-2/48640/5 "2020-10-19T18:05:16Z")

</div>

For lots more detail, see: [PSA: floating-point arithmetic](https://discourse.julialang.org/t/psa-floating-point-arithmetic/8678)
