@@ -880,6 +880,52 @@ test scan-14.2 {negative infinity} {
880
880
return $d
881
881
} -Inf
882
882
883
+ test scan-15.1 {scan %g overflow for small numbers and big mantissa bug 42d14c495a} {
884
+ set result [list]
885
+ # xfail: n<num> = not expected at all, x<num> expected when unfixed
886
+ foreach {exp numdig ret xfail} {
887
+ -321 190 1.111647703142804724397279783953498087821e-321 n0
888
+ -321 191 1.111647703142804724397279783953498087821e-321 x1
889
+ -321 300 1.111647703142804724397279783953498087821e-321 x2
890
+ -321 1600 1.111647703142804724397279783953498087821e-321 x3
891
+ -400 110 0 n4
892
+ -400 111 0 n5
893
+ -400 300 0 n6
894
+ -221 290 1.111111111111110993454921768172890541494e-221 n7
895
+ -221 291 1.111111111111110993454921768172890541494e-221 x8
896
+ -221 400 1.111111111111110993454921768172890541494e-221 x9
897
+ -221 1600 1.111111111111110993454921768172890541494e-221 x10
898
+ -121 390 1.111111111111111182884141698869046969295e-121 n11
899
+ -121 391 1.111111111111111182884141698869046969295e-121 x12
900
+ -121 500 1.111111111111111182884141698869046969295e-121 x13
901
+ -121 1600 1.111111111111111182884141698869046969295e-121 x14
902
+ 308 202 1.111111111111111167662077577927612945036e+308 n15
903
+ 308 203 1.111111111111111167662077577927612945036e+308 n16
904
+ 308 300 1.111111111111111167662077577927612945036e+308 n17
905
+ 308 1600 1.111111111111111167662077577927612945036e+308 x18
906
+ 400 110 inf n19
907
+ 400 111 inf n20
908
+ 400 300 inf n21
909
+ 221 291 1.111111111111111207481621395250718679869e+221 n22
910
+ 221 292 1.111111111111111207481621395250718679869e+221 n23
911
+ 221 400 1.111111111111111207481621395250718679869e+221 n24
912
+ 221 1600 1.111111111111111207481621395250718679869e+221 x25
913
+ 121 391 1.11111111111111112711771954138363761759e+121 n26
914
+ 121 392 1.11111111111111112711771954138363761759e+121 n27
915
+ 121 500 1.11111111111111112711771954138363761759e+121 n28
916
+ 121 1600 1.11111111111111112711771954138363761759e+121 x29
917
+ } {
918
+ set s 1.[string repeat 1 $numdig]e$exp
919
+ set d "no_scan"
920
+ scan $s %g d
921
+ set r [format %.40g $d]
922
+ if {$r ne $ret} {
923
+ lappend result $xfail=[format %.40g $d]
924
+ }
925
+ }
926
+ set result
927
+ } {}
928
+
883
929
# TODO - also need to scan NaN's
884
930
885
931
catch {rename int_range {}}
0 commit comments