# SumOfSquares with BigFloat

**URL:** https://discourse.julialang.org/t/sumofsquares-with-bigfloat/115009
**Category:** Optimization (Mathematical)
**Tags:** jump
**Created:** [May 31, 2024, 11:52am UTC](https://discourse.julialang.org/t/sumofsquares-with-bigfloat/115009 "2024-05-31T11:52:54Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jezzaparker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jezzaparker/32/51599_2.png) [@jezzaparker](https://discourse.julialang.org/u/jezzaparker)
#### Post date: [May 31, 2024, 11:52am UTC](https://discourse.julialang.org/t/sumofsquares-with-bigfloat/115009/1 "2024-05-31T11:52:55Z")

</div>

I’m trying to use SumOfSquares with arbitrary precision. Is this possible?

if I do

> ```
> model = GenericModel{BigFloat}(COSMO.Optimizer{BigFloat})
> #...
> @constraint(model, con1 in SOSCone())
> 
> ```

where con1 is a

> Polynomial{DynamicPolynomials.Commutative{DynamicPolynomials.CreationOrder}, Graded{LexOrder}, GenericAffExpr{BigFloat, GenericVariableRef{BigFloat}}}

Then I get a weird error

> ERROR: MethodError: no method matching promote\_operation(::typeof(-), ::Type{…}, ::Type{…}, ::Type{…})  
> Stacktrace:  
> [1] concrete\_bridge\_type(::Type{…}, F::Type{…}, ::Type{…})

Replacing BigFloat with Float64 works fine. Should this be supported? Or am I misunderstanding?

---

<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: [June 4, 2024, 1:35am UTC](https://discourse.julialang.org/t/sumofsquares-with-bigfloat/115009/2 "2024-06-04T01:35:15Z")

</div>

Hi @jezzaparker, I don’t think so. SumOfSquares.jl was written before JuMP gained support for other number types.

@blegat can confirm.

---

<div class="post-metadata">

### Author: ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)
#### Post date: [June 4, 2024, 9:22am UTC](https://discourse.julialang.org/t/sumofsquares-with-bigfloat/115009/3 "2024-06-04T09:22:18Z")

</div>

> [@jezzaparker](#):
>
> `model = GenericModel{BigFloat}(COSMO.Optimizer{BigFloat})`

Thanks for reporting the issue. It doesn’t seem too hard to fix, see [Fix bridge choice for non-Float64 by blegat · Pull Request #356 · jump-dev/SumOfSquares.jl · GitHub](https://github.com/jump-dev/SumOfSquares.jl/pull/356)  
SumOfSquares is going over a big refactoring though so you’ll need to checkout the dev branch of a few packages to try it out.  
It shouldn’t be too hard to backport the fix if needed.
