# Can I consider variables as Float32 or Float16 in JuMP

**URL:** <https://discourse.julialang.org/t/can-i-consider-variables-as-float32-or-float16-in-jump/121216>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [October 12, 2024, 8:29am UTC](https://discourse.julialang.org/t/can-i-consider-variables-as-float32-or-float16-in-jump/121216 "2024-10-12T08:29:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anassis\_b](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/anassis_b/32/212596_2.png) [@Anassis\_b](https://discourse.julialang.org/u/Anassis_b)\
**Post date:** [October 12, 2024, 8:29am UTC](https://discourse.julialang.org/t/can-i-consider-variables-as-float32-or-float16-in-jump/121216/1 "2024-10-12T08:29:28Z")

</div>

Hi all,

I’m working on an optimization problem using JuMP with IPOPT, and I noticed that by default, variables are declared as `Float64`. I would like to explore using `Float32` and `Float16` for my variables instead. Additionally, I am interested in using the [StochasticRounding](https://juliapackages.com/p/stochasticrounding) package, specifically to cast variables as `stochastic_round(Float16, x)`.

Is there a recommended way to configure JuMP and IPOPT to use these lower-precision types? Also, how can I integrate stochastic rounding into this process?

Thanks in advance for any suggestions!

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [October 12, 2024, 10:37am UTC](https://discourse.julialang.org/t/can-i-consider-variables-as-float32-or-float16-in-jump/121216/2 "2024-10-12T10:37:05Z")

</div>

Regarding JuMP.jl, this seems like what you want:

> **[Arbitrary precision arithmetic · JuMP](https://jump.dev/JuMP.jl/stable/tutorials/conic/arbitrary_precision/)**
>
> Documentation for JuMP.

Another option is to use MathOptInterface.jl.

But I’m not sure what arithmetics are supported by the ipopt solver. You might have better luck with a solver implemented in Julia?

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [October 12, 2024, 10:00pm UTC](https://discourse.julialang.org/t/can-i-consider-variables-as-float32-or-float16-in-jump/121216/3 "2024-10-12T22:00:45Z")

</div>

Hi @Aassis\_b, welcome to the forum.

No, Ipopt supports only Float64.
