@@ -421,7 +421,26 @@ fit(Poly, xx,yy,2)
421
421
# # Issue with overflow and polyder Issue #159
422
422
@test ! iszero (polyder (Poly (BigInt[0 , 1 ])^ 100 , 100 ))
423
423
424
+ @testset " `isreal` and `real`" begin
425
+ x = Polynomial ([1 // 2 , 2 + 0im , 3.0 , 4.0 + 0.0im ])
426
+ y = Polynomial ([1 // 2 , 2 + 0im , 3.0 , 4.0 + 0.1im ])
427
+ @test isreal (x) === true
428
+ @test isequal (x, real (x)) === true
429
+ @test eltype (real (x)) === Float64
430
+ @test real (x) == Polynomial ([1 // 2 , 2 , 3 , 4.0 ])
431
+ @test isreal (y) === false
432
+ @test real (y) == real (x)
433
+ end
424
434
435
+ @testset " `isintegerpoly` and `asintegerpoly`" begin
436
+ x = Polynomial ([1 // 1 , Int8 (2 ) + 0im , 3.0 , Int16 (4 ) + 0im ])
437
+ y = Polynomial ([1 // 2 , Int8 (2 ) + 0im , 3.0 , Int16 (4 ) + 0im ])
438
+ @test isintegerpoly (x) === true
439
+ @test eltype (asintegerpoly (x)) === Int
440
+ @test asintegerpoly (x) == Polynomial ([1 , 2 , 3 , 4 ])
441
+ @test isintegerpoly (y) === false
442
+ @test_throws InexactError asintegerpoly (y)
443
+ end
425
444
426
445
427
446
0 commit comments