# Scientific notation + sum() function

**URL:** <https://discourse.julialang.org/t/scientific-notation-sum-function/64368>\
**Category:** Numerics\
**Created:** [July 9, 2021, 5:35pm UTC](https://discourse.julialang.org/t/scientific-notation-sum-function/64368 "2021-07-09T17:35:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Tantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alex_tantos/32/10636_2.png) [@Alex\_Tantos](https://discourse.julialang.org/u/Alex_Tantos)\
**Post date:** [July 9, 2021, 5:35pm UTC](https://discourse.julialang.org/t/scientific-notation-sum-function/64368/1 "2021-07-09T17:35:40Z")

</div>

Hi there! As part of getting to know the language I am preparing the code for the softmax function and I just found out that the `sum()` function does not return the expected result when some of the numbers of a vector are output in scientific notation. Here is the sample code:

```julia
julia> a =[23,4,56,7,2,1,9,4,3,2]
julia> exp.(a)
10-element Vector{Float64}:
    9.744803446248903e9
   54.598150033144236
    2.091659496012996e24
 1096.6331584284585
    7.38905609893065
    2.718281828459045
 8103.083927575384
   54.598150033144236
   20.085536923187668
    7.38905609893065
julia> sum(exp.(a))
julia> 2.0916594960130058e24

```

There is definitely something I miss from this very simple case of numerical computing, but I don’t seem to get it.

Any advice or hint are greatly appreciated!

PS: No similar topic is shown up in the similar topics’ section.

---

<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:** [July 9, 2021, 5:59pm UTC](https://discourse.julialang.org/t/scientific-notation-sum-function/64368/2 "2021-07-09T17:59:03Z")

</div>

Try restarting Julia. It d like you have redefined sum

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [July 9, 2021, 6:01pm UTC](https://discourse.julialang.org/t/scientific-notation-sum-function/64368/3 "2021-07-09T18:01:50Z")

</div>

What is the expected output here? Is it not

> **[sum(exp(23),exp(4),exp(56), exp(7), exp(2), exp(1), exp(9), exp(4), exp(3),...](https://www.wolframalpha.com/input/?i=sum%28exp%2823%29%2Cexp%284%29%2Cexp%2856%29%2C%2Bexp%287%29%2C%2Bexp%282%29%2C%2Bexp%281%29%2C%2Bexp%289%29%2C%2Bexp%284%29%2C%2Bexp%283%29%2C%2Bexp%282%29%29)**
>
> Wolfram|Alpha brings expert-level knowledge and capabilities to the broadest possible range of people—spanning all professions and education levels.

so 2.09166e24?

---

<div class="post-metadata">

**Author:** ![Alex\_Tantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alex_tantos/32/10636_2.png) [@Alex\_Tantos](https://discourse.julialang.org/u/Alex_Tantos)\
**Post date:** [July 9, 2021, 6:08pm UTC](https://discourse.julialang.org/t/scientific-notation-sum-function/64368/4 "2021-07-09T18:08:58Z")

</div>

Oh! Am really sorry! You are so right, Nils! I just realised that the output was already written in scientific notation. I missed the e in there. Thank you both for your responses anyways!
