# How to catch a instability in an ODE using Julia?

**URL:** <https://discourse.julialang.org/t/how-to-catch-a-instability-in-an-ode-using-julia/112324>\
**Category:** Modelling & Simulations\
**Tags:** question, differentialequation\
**Created:** [March 30, 2024, 10:58am UTC](https://discourse.julialang.org/t/how-to-catch-a-instability-in-an-ode-using-julia/112324 "2024-03-30T10:58:25Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [March 30, 2024, 12:56pm UTC](https://discourse.julialang.org/t/how-to-catch-a-instability-in-an-ode-using-julia/112324/3 "2024-03-30T12:56:43Z")

</div>

> [@Luigi\_Marongiu](#):
>
> ALSO: in theory, kappa should be displayed with two digits; instead, it goes into a floating point. How can I force two digits?

You set `kappa = 2.2e7`, which is a `Float64` value (53 binary digits, internally). You can _display_ it with any number of digits you want, using e.g the Printf standard library:

```julia
julia> using Printf

julia> @printf("%.2g", kappa)
2.2e+07
julia> @printf("%.1g", kappa)
2e+07

```

See also

- [PSA: floating-point arithmetic](https://discourse.julialang.org/t/psa-floating-point-arithmetic/8678)
- [How do I restrict the number of digits in the REPL display?](https://discourse.julialang.org/t/how-do-i-restrict-the-number-of-digits-in-the-repl-display/107501)

---

_[View the full topic](https://discourse.julialang.org/t/how-to-catch-a-instability-in-an-ode-using-julia/112324)._
