# Problems with Generic numeric type in JuMP

**URL:** <https://discourse.julialang.org/t/problems-with-generic-numeric-type-in-jump/103221>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [August 26, 2023, 2:27pm UTC](https://discourse.julialang.org/t/problems-with-generic-numeric-type-in-jump/103221 "2023-08-26T14:27:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![J\_T](https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/32.png) [@J\_T](https://discourse.julialang.org/u/J_T)\
**Post date:** [August 26, 2023, 2:27pm UTC](https://discourse.julialang.org/t/problems-with-generic-numeric-type-in-jump/103221/1 "2023-08-26T14:27:28Z")

</div>

For type `T = Float64` the following works, but it fails for either `T = Float32` and `T = BigFloat`:

```julia
using JuMP, COSMO
m = Model( COSMO.Optimizer{T}
@variable( m, t >= zero(T) )
@objective( m, Min, t )
optimize!( m )

```

It also fails for Clarabel and Tulip.  
Can someone tell me where Im going wrong ?

---

<div class="post-metadata">

**Author:** ![hellemo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hellemo/32/324_2.png) [@hellemo](https://discourse.julialang.org/u/hellemo)\
**Post date:** [August 26, 2023, 4:01pm UTC](https://discourse.julialang.org/t/problems-with-generic-numeric-type-in-jump/103221/2 "2023-08-26T16:01:10Z")

</div>

You have to use `GenericModel{T}` (not `Model` which is an alias for `GenericModel{Float64}` [Models · JuMP](https://jump.dev/JuMP.jl/stable/manual/models/#Changing-the-number-types:)

```julia
using JuMP, COSMO
T = Float32
m = GenericModel{T}( COSMO.Optimizer{T} )
@variable( m, t >= zero(T) )
optimize!( m )

typeof(objective_value(m)) # Float32

```

---

<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:** [August 26, 2023, 9:45pm UTC](https://discourse.julialang.org/t/problems-with-generic-numeric-type-in-jump/103221/3 "2023-08-26T21:45:58Z")

</div>

See also this tutorial: [Arbitrary precision arithmetic · JuMP](https://jump.dev/JuMP.jl/stable/tutorials/conic/arbitrary_precision/)
