# Parse with exponent D

**URL:** https://discourse.julialang.org/t/parse-with-exponent-d/133715
**Category:** General Usage
**Tags:** numbers, parsing
**Created:** [November 6, 2025, 6:19pm UTC](https://discourse.julialang.org/t/parse-with-exponent-d/133715 "2025-11-06T18:19:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)
#### Post date: [November 6, 2025, 6:19pm UTC](https://discourse.julialang.org/t/parse-with-exponent-d/133715/1 "2025-11-06T18:19:13Z")

</div>

I tried parsing the values printed to file by some old Fortran code. This code uses the exponent D for double precision numbers, like `2.73150000000000003D+02`.

I can use the replace command to replace the “D” with “E”, but wondered if this should be built into parse.

Example

```julia-auto
julia> parse(Float64, "1.0E+4")
10000.0

julia> parse(Float64, "1.0D+4")
ERROR: ArgumentError: cannot parse "1.0D+4" as Float64
Stacktrace:
 [1] _parse_failure(T::Type, s::String, startpos::Int64, endpos::Int64)
   @ Base .\parse.jl:388
 [2] #tryparse_internal#623
   @ .\parse.jl:384 [inlined]
 [3] tryparse_internal
   @ .\parse.jl:381 [inlined]
 [4] parse(::Type{Float64}, s::String)
   @ Base .\parse.jl:394
 [5] top-level scope
   @ REPL[14]:1

julia>

```

---

<div class="post-metadata">

### Author: ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)
#### Post date: [November 6, 2025, 7:36pm UTC](https://discourse.julialang.org/t/parse-with-exponent-d/133715/2 "2025-11-06T19:36:46Z")

</div>

~~Fortran’s `D` is for decimal floating point — so I think this would make the most sense in DecFP.jl. Parsing them as `Float64`s would potentially yield different values.~~

~~I don’t think it currently supports `D`s in its `parse(Dec64, x)`, but I imagine it could without much consternation.~~

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [November 6, 2025, 9:43pm UTC](https://discourse.julialang.org/t/parse-with-exponent-d/133715/3 "2025-11-06T21:43:30Z")

</div>

> [@mbauman](#):
>
> Fortran’s `D` is for decimal floating point

No it isn’t. `D` exponents as in `1.0D+4` stand for [double precision](https://docs.oracle.com/cd/E19957-01/805-4939/z40007369250/index.html). By default this will be the same as Julia’s `Float64` on most hardware and compilers these days.

See also this stackoverflow thread: [https://stackoverflow.com/questions/77397170/why-cant-julia-parse-functions-parse-numbers-in-scientific-notation-with-d-inst?utm\_source=chatgpt.com](https://stackoverflow.com/questions/77397170/why-cant-julia-parse-functions-parse-numbers-in-scientific-notation-with-d-inst?utm_source=chatgpt.com) — currently the easiest solution is to do a `replace` call on the string before parsing.

See also this issue on whether we should have a more flexible `parse` for floating-point values: [`parse` can't parse our own Float32 output format · Issue #5690 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/5690) — currently even `parse(Float32, "1.0f0")` doesn’t work, even though the `"f"` exponent is allowed by Julia itself. Personally, my vote would be to allow more flexibility in accepting the most common formats when parsing data, since `parse(T, str)` is generally inequivalent to Julia syntax (`Meta.parse`) anyway.

---

<div class="post-metadata">

### Author: ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)
#### Post date: [November 6, 2025, 10:00pm UTC](https://discourse.julialang.org/t/parse-with-exponent-d/133715/4 "2025-11-06T22:00:27Z")

</div>

🤦 well, never mind me! That’s me misreading [these random docs](https://docs.oracle.com/cd/E19957-01/805-4939/z40007439c43/index.html) about the “decimal double-precision” — where decimal is apparently meaning just “fractional,” not base 10. It makes a bit more sense that that `2.7315` example isn’t quite exact.

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [November 7, 2025, 1:24pm UTC](https://discourse.julialang.org/t/parse-with-exponent-d/133715/5 "2025-11-07T13:24:04Z")

</div>

> [@Jake](#):
>
> wondered if this should be built into parse

It would probably be best to add this option to one of the generic parser libraries out there, eg

> **[GitHub - JuliaData/Parsers.jl: fast parsing machinery for basic types in Julia](https://github.com/JuliaData/Parsers.jl)**
>
> fast parsing machinery for basic types in Julia

I would suggest opening an issue.
