|
520 | 520 | @test parse(FD4, "1.5e-4", RoundToZero) == reinterpret(FD4, 0_0001) |
521 | 521 | end |
522 | 522 |
|
| 523 | + @testset "round throws" begin |
| 524 | + @test parse(FD2, "0.44", RoundThrows) == reinterpret(FD2, 0_44) |
| 525 | + @test parse(FD2, "0.440", RoundThrows) == reinterpret(FD2, 0_44) |
| 526 | + |
| 527 | + @test_throws InexactError parse(FD2, "0.444", RoundThrows) |
| 528 | + @test_throws InexactError parse(FD2, "0.445", RoundThrows) |
| 529 | + @test_throws InexactError parse(FD2, "0.446", RoundThrows) |
| 530 | + @test_throws InexactError parse(FD2, "0.454", RoundThrows) |
| 531 | + @test_throws InexactError parse(FD2, "0.455", RoundThrows) |
| 532 | + @test_throws InexactError parse(FD2, "0.456", RoundThrows) |
| 533 | + |
| 534 | + @test_throws InexactError parse(FD2, "-0.444", RoundThrows) |
| 535 | + @test_throws InexactError parse(FD2, "-0.445", RoundThrows) |
| 536 | + @test_throws InexactError parse(FD2, "-0.446", RoundThrows) |
| 537 | + @test_throws InexactError parse(FD2, "-0.454", RoundThrows) |
| 538 | + @test_throws InexactError parse(FD2, "-0.455", RoundThrows) |
| 539 | + @test_throws InexactError parse(FD2, "-0.456", RoundThrows) |
| 540 | + |
| 541 | + @test_throws InexactError parse(FD2, "0.009", RoundThrows) |
| 542 | + @test_throws InexactError parse(FD2, "-0.009", RoundThrows) |
| 543 | + |
| 544 | + @test_throws InexactError parse(FD4, "1.5e-4", RoundThrows) |
| 545 | + end |
| 546 | + |
523 | 547 | @testset "invalid" begin |
524 | 548 | @test_throws OverflowError parse(FD4, "1.2e100") |
525 | 549 | @test_throws ArgumentError parse(FD4, "foo") |
|
0 commit comments