File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,9 +51,7 @@ function _is_one_for_printing(coef)
5151 return _is_zero_for_printing (abs (coef) - oneunit (coef))
5252end
5353
54- function _is_one_for_printing (coef:: Complex )
55- return _is_one_for_printing (real (coef)) && _is_zero_for_printing (imag (coef))
56- end
54+ _is_one_for_printing (coef:: Complex{T} ) where {T} = coef == one (T)
5755
5856function _is_zero_for_printing (coef:: Complex )
5957 return _is_zero_for_printing (real (coef)) &&
Original file line number Diff line number Diff line change @@ -965,6 +965,14 @@ function test_show_latex_parameter()
965965 return
966966end
967967
968+ function test_minus_one_complex_aff_expr ()
969+ model = Model ()
970+ @variable (model, x)
971+ f = 1.0im * x + 1.0im
972+ @test sprint (show, im * f) == " (-1.0 + 0.0im) x + (-1.0 + 0.0im)"
973+ return
974+ end
975+
968976end
969977
970978TestPrint. runtests ()
You can’t perform that action at this time.
0 commit comments