|
539 | 539 |
|
540 | 540 | # signed integers using two's complement have one additional negative value
|
541 | 541 | if x < 0 && x == typemin(x)
|
542 |
| - @test_throws InexactError x / -one(x) |
| 542 | + @test x / -one(x) == x # -typemin(x) == typemin(x) |
543 | 543 | else
|
544 | 544 | @test x / -one(x) == -x
|
545 | 545 | end
|
|
631 | 631 |
|
632 | 632 | @test_throws OverflowError Base.checked_sub(FD{Int8,2}(1), FD{Int8,2}(-1))
|
633 | 633 | @test_throws OverflowError Base.checked_sub(1, FD{Int8,2}(-1))
|
634 |
| - @test_throws OverflowError Base.checked_sub(FD{Int8,2}(1), FD{Int8,2}(0.4)) |
| 634 | + @test_throws OverflowError Base.checked_sub(FD{Int8,2}(-1), FD{Int8,2}(0.4)) |
635 | 635 |
|
636 | 636 | @test_throws OverflowError Base.checked_div(FD{Int8,2}(1), FD{Int8,2}(0.5))
|
637 | 637 | @test_throws OverflowError Base.checked_div(1, FD{Int8,2}(0.5))
|
|
644 | 644 | @test_throws OverflowError checked_decimal_division(Int8(1), FD{Int8,2}(0.7))
|
645 | 645 | end
|
646 | 646 |
|
| 647 | + # Rounds down to 2 |
647 | 648 | @test_throws OverflowError Base.checked_fld(FD{Int8,2}(-1), FD{Int8,2}(0.9))
|
648 |
| - @test_throws OverflowError Base.checked_cld(FD{Int8,2}(-1), FD{Int8,2}(1.1)) |
| 649 | + # Rounds up to 2 |
| 650 | + @test_throws OverflowError Base.checked_cld(FD{Int8,2}(1), FD{Int8,2}(0.9)) |
649 | 651 |
|
650 | 652 | # Rem and Mod only throw DivideError and nothing more. They can't overflow, since
|
651 | 653 | # they can only return smaller values than the arguments.
|
|
0 commit comments