anj1/AlgebraicNumbers.jl

i+1 == 2

Closed this issue · 0 comments

zenon commented

The composed sum of (the coeffs of) 1 and i gives a wrong result.

Reproduce like:

i = sqrt(AlgebraicNumber(-1))
# ≈0.0 + 1.0im
uno  = AlgebraicNumber(1)
# ≈1.0 + 0.0im
two = AlgebraicNumber(2)
# ≈2.0 + 0.0im
ipu = 1+i

[ipu == two, two.coeff == ipu.coeff, two.prec == ipu.prec, two.apprx == ipu.apprx]'
#  true  true  true  false

(i+1).coeff'
# -2  1
AlgebraicNumbers.composed_sum(uno.coeff, i.coeff)'
# -2  1

The polynomial should be x²-2x+2, thus the coeffs [2,-2,1]