# Extract exponent from numbers in julia

**URL:** https://discourse.julialang.org/t/extract-exponent-from-numbers-in-julia/30810
**Category:** New to Julia
**Created:** [November 6, 2019, 10:35pm UTC](https://discourse.julialang.org/t/extract-exponent-from-numbers-in-julia/30810 "2019-11-06T22:35:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)
#### Post date: [November 6, 2019, 10:35pm UTC](https://discourse.julialang.org/t/extract-exponent-from-numbers-in-julia/30810/1 "2019-11-06T22:35:06Z")

</div>

Hello,  
I have to compare numbers that are quite small – something like 10e-5 or 10e-13 etc. Is there a way to extract the exponent (or characteristic) of the numbers, so that I will be working with -5 and -13 only? (thus passing from a float64 to a more friendly number)  
Is it possible to extract such characteristic from a normal number? or instance, 2 should give 0 (as in 2x10e0).  
I would I convert a number into scientific? thus 2 into 2e0?  
Thank you

---

<div class="post-metadata">

### Author: ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)
#### Post date: [November 6, 2019, 10:40pm UTC](https://discourse.julialang.org/t/extract-exponent-from-numbers-in-julia/30810/2 "2019-11-06T22:40:07Z")

</div>

Couldn’t you simply take the `log10` of your numbers? (possibly rounding it)

```julia
julia> round(log10(1.45e-4), digits=2)
-3.84

julia> floor(log10(1.45e-4))
-4.0

```

---

<div class="post-metadata">

### Author: ![Luigi\_Marongiu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luigi_marongiu/32/7909_2.png) [@Luigi\_Marongiu](https://discourse.julialang.org/u/Luigi_Marongiu)
#### Post date: [November 7, 2019, 8:15am UTC](https://discourse.julialang.org/t/extract-exponent-from-numbers-in-julia/30810/3 "2019-11-07T08:15:30Z")

</div>

Yes I could and I will. Thank you!
