Commit 7c20816 1 parent b8c2461 commit 7c20816 Copy full SHA for 7c20816
File tree 2 files changed +4
-3
lines changed
2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -815,8 +815,8 @@ Set the precision (in bits) to be used for `T` arithmetic.
815
815
setting.
816
816
"""
817
817
function setprecision (:: Type{BigFloat} , precision:: Integer )
818
- if precision < 2
819
- throw (DomainError (precision, " `precision` cannot be less than 2 ." ))
818
+ if precision < 1
819
+ throw (DomainError (precision, " `precision` cannot be less than 1 ." ))
820
820
end
821
821
DEFAULT_PRECISION[] = precision
822
822
return precision
Original file line number Diff line number Diff line change 475
475
@test precision (z) == 240
476
476
x = BigFloat (12 )
477
477
@test precision (x) == old_precision
478
- @test_throws DomainError setprecision (1 )
478
+ @test precision (setprecision (1 ) do ; BigFloat (23 ); end ) == 1 # minimum-precision
479
+ @test_throws DomainError setprecision (0 )
479
480
@test_throws DomainError BigFloat (1 , precision = 0 )
480
481
@test_throws DomainError BigFloat (big (1.1 ), precision = 0 )
481
482
@test_throws DomainError BigFloat (2.5 , precision = - 900 )
You can’t perform that action at this time.
0 commit comments