@@ -1476,37 +1476,40 @@ if (is(T == float) || is(T == double)
14761476
14771477 assertCTFEable! (
14781478 {
1479- // log2 is broken for x87-reals on some computers in CTFE
1480- // the following tests excludes these computers from the tests
1481- // (https://issues.dlang.org/show_bug.cgi?id=21757)
1482- enum test = cast (int ) log2(3.05e2312L );
1483- static if (real .mant_dig == 64 && test == 7681 )
1479+ static if (real .mant_dig == 64 ) // 80 bit reals
14841480 {
1485- auto f = FormatSpec! dchar (" " );
1486- f.spec = ' e' ;
1487- assert (printFloat(real .infinity, f) == " inf" );
1488- assert (printFloat(10.0L , f) == " 1.000000e+01" );
1489- assert (printFloat(2.6080L , f) == " 2.608000e+00" );
1490- assert (printFloat(3.05e2312L , f) == " 3.050000e+2312" );
1491-
1492- f.precision = 60 ;
1493- assert (printFloat(2.65e-54L , f) ==
1494- " 2.650000000000000000059009987400547013941028940935296547599415e-54" );
1495-
1496- /*
1497- commented out, because CTFE is currently too slow for 5000 digits with extreme values
1498-
1499- f.precision = 5000;
1500- auto result2 = printFloat(1.2119e-4822L, f);
1501- assert(result2.length == 5008);
1502- assert(result2[$ - 20 .. $] == "60729486595339e-4822");
1503- auto result3 = printFloat(real.min_normal, f);
1504- assert(result3.length == 5008);
1505- assert(result3[$ - 20 .. $] == "20781410082267e-4932");
1506- auto result4 = printFloat(real.min_normal.nextDown, f);
1507- assert(result4.length == 5008);
1508- assert(result4[$ - 20 .. $] == "81413263331006e-4932");
1509- */
1481+ // log2 is broken for x87-reals on some computers in CTFE
1482+ // the following tests excludes these computers from the tests
1483+ // (https://issues.dlang.org/show_bug.cgi?id=21757)
1484+ enum test = cast (int ) log2(3.05e2312L );
1485+ static if (test == 7681 )
1486+ {
1487+ auto f = FormatSpec! dchar (" " );
1488+ f.spec = ' e' ;
1489+ assert (printFloat(real .infinity, f) == " inf" );
1490+ assert (printFloat(10.0L , f) == " 1.000000e+01" );
1491+ assert (printFloat(2.6080L , f) == " 2.608000e+00" );
1492+ assert (printFloat(3.05e2312L , f) == " 3.050000e+2312" );
1493+
1494+ f.precision = 60 ;
1495+ assert (printFloat(2.65e-54L , f) ==
1496+ " 2.650000000000000000059009987400547013941028940935296547599415e-54" );
1497+
1498+ /*
1499+ commented out, because CTFE is currently too slow for 5000 digits with extreme values
1500+
1501+ f.precision = 5000;
1502+ auto result2 = printFloat(1.2119e-4822L, f);
1503+ assert(result2.length == 5008);
1504+ assert(result2[$ - 20 .. $] == "60729486595339e-4822");
1505+ auto result3 = printFloat(real.min_normal, f);
1506+ assert(result3.length == 5008);
1507+ assert(result3[$ - 20 .. $] == "20781410082267e-4932");
1508+ auto result4 = printFloat(real.min_normal.nextDown, f);
1509+ assert(result4.length == 5008);
1510+ assert(result4[$ - 20 .. $] == "81413263331006e-4932");
1511+ */
1512+ }
15101513 }
15111514 });
15121515}
@@ -2149,39 +2152,42 @@ if (is(T == float) || is(T == double)
21492152
21502153 assertCTFEable! (
21512154 {
2152- // log2 is broken for x87-reals on some computers in CTFE
2153- // the following tests excludes these computers from the tests
2154- // (https://issues.dlang.org/show_bug.cgi?id=21757)
2155- enum test = cast (int ) log2(3.05e2312L );
2156- static if (real .mant_dig == 64 && test == 7681 )
2155+ static if (real .mant_dig == 64 ) // 80 bit reals
21572156 {
2158- auto f = FormatSpec! dchar (" " );
2159- f.spec = ' f' ;
2160- assert (printFloat(real .infinity, f) == " inf" );
2161- assert (printFloat(10.0L , f) == " 10.000000" );
2162- assert (printFloat(2.6080L , f) == " 2.608000" );
2163- auto result1 = printFloat(3.05e2312L , f);
2164- assert (result1.length == 2320 );
2165- assert (result1[0 .. 20 ] == " 30499999999999999999" );
2166-
2167- f.precision = 60 ;
2168- assert (printFloat(2.65e-54L , f) ==
2169- " 0.000000000000000000000000000000000000000000000000000002650000" );
2170-
2171- /*
2172- commented out, because CTFE is currently too slow for 5000 digits with extreme values
2173-
2174- f.precision = 5000;
2175- auto result2 = printFloat(1.2119e-4822L, f);
2176- assert(result2.length == 5002);
2177- assert(result2[$ - 20 .. $] == "60076763752233836613");
2178- auto result3 = printFloat(real.min_normal, f);
2179- assert(result3.length == 5002);
2180- assert(result3[$ - 20 .. $] == "47124010882722980874");
2181- auto result4 = printFloat(real.min_normal.nextDown, f);
2182- assert(result4.length == 5002);
2183- assert(result4[$ - 20 .. $] == "52925846892214823939");
2184- */
2157+ // log2 is broken for x87-reals on some computers in CTFE
2158+ // the following tests excludes these computers from the tests
2159+ // (https://issues.dlang.org/show_bug.cgi?id=21757)
2160+ enum test = cast (int ) log2(3.05e2312L );
2161+ static if (test == 7681 )
2162+ {
2163+ auto f = FormatSpec! dchar (" " );
2164+ f.spec = ' f' ;
2165+ assert (printFloat(real .infinity, f) == " inf" );
2166+ assert (printFloat(10.0L , f) == " 10.000000" );
2167+ assert (printFloat(2.6080L , f) == " 2.608000" );
2168+ auto result1 = printFloat(3.05e2312L , f);
2169+ assert (result1.length == 2320 );
2170+ assert (result1[0 .. 20 ] == " 30499999999999999999" );
2171+
2172+ f.precision = 60 ;
2173+ assert (printFloat(2.65e-54L , f) ==
2174+ " 0.000000000000000000000000000000000000000000000000000002650000" );
2175+
2176+ /*
2177+ commented out, because CTFE is currently too slow for 5000 digits with extreme values
2178+
2179+ f.precision = 5000;
2180+ auto result2 = printFloat(1.2119e-4822L, f);
2181+ assert(result2.length == 5002);
2182+ assert(result2[$ - 20 .. $] == "60076763752233836613");
2183+ auto result3 = printFloat(real.min_normal, f);
2184+ assert(result3.length == 5002);
2185+ assert(result3[$ - 20 .. $] == "47124010882722980874");
2186+ auto result4 = printFloat(real.min_normal.nextDown, f);
2187+ assert(result4.length == 5002);
2188+ assert(result4[$ - 20 .. $] == "52925846892214823939");
2189+ */
2190+ }
21852191 }
21862192 });
21872193}
@@ -2830,37 +2836,40 @@ if (is(T == float) || is(T == double)
28302836
28312837 assertCTFEable! (
28322838 {
2833- // log2 is broken for x87-reals on some computers in CTFE
2834- // the following tests excludes these computers from the tests
2835- // (https://issues.dlang.org/show_bug.cgi?id=21757)
2836- enum test = cast (int ) log2(3.05e2312L );
2837- static if (real .mant_dig == 64 && test == 7681 )
2839+ static if (real .mant_dig == 64 ) // 80 bit reals
28382840 {
2839- auto f = FormatSpec! dchar (" " );
2840- f.spec = ' g' ;
2841- assert (printFloat(real .infinity, f) == " inf" );
2842- assert (printFloat(10.0L , f) == " 10" );
2843- assert (printFloat(2.6080L , f) == " 2.608" );
2844- assert (printFloat(3.05e2312L , f) == " 3.05e+2312" );
2845-
2846- f.precision = 60 ;
2847- assert (printFloat(2.65e-54L , f) ==
2848- " 2.65000000000000000005900998740054701394102894093529654759941e-54" );
2849-
2850- /*
2851- commented out, because CTFE is currently too slow for 5000 digits with extreme values
2852-
2853- f.precision = 5000;
2854- auto result2 = printFloat(1.2119e-4822L, f);
2855- assert(result2.length == 5007);
2856- assert(result2[$ - 20 .. $] == "26072948659534e-4822");
2857- auto result3 = printFloat(real.min_normal, f);
2858- assert(result3.length == 5007);
2859- assert(result3[$ - 20 .. $] == "72078141008227e-4932");
2860- auto result4 = printFloat(real.min_normal.nextDown, f);
2861- assert(result4.length == 5007);
2862- assert(result4[$ - 20 .. $] == "48141326333101e-4932");
2863- */
2841+ // log2 is broken for x87-reals on some computers in CTFE
2842+ // the following tests excludes these computers from the tests
2843+ // (https://issues.dlang.org/show_bug.cgi?id=21757)
2844+ enum test = cast (int ) log2(3.05e2312L );
2845+ static if (test == 7681 )
2846+ {
2847+ auto f = FormatSpec! dchar (" " );
2848+ f.spec = ' g' ;
2849+ assert (printFloat(real .infinity, f) == " inf" );
2850+ assert (printFloat(10.0L , f) == " 10" );
2851+ assert (printFloat(2.6080L , f) == " 2.608" );
2852+ assert (printFloat(3.05e2312L , f) == " 3.05e+2312" );
2853+
2854+ f.precision = 60 ;
2855+ assert (printFloat(2.65e-54L , f) ==
2856+ " 2.65000000000000000005900998740054701394102894093529654759941e-54" );
2857+
2858+ /*
2859+ commented out, because CTFE is currently too slow for 5000 digits with extreme values
2860+
2861+ f.precision = 5000;
2862+ auto result2 = printFloat(1.2119e-4822L, f);
2863+ assert(result2.length == 5007);
2864+ assert(result2[$ - 20 .. $] == "26072948659534e-4822");
2865+ auto result3 = printFloat(real.min_normal, f);
2866+ assert(result3.length == 5007);
2867+ assert(result3[$ - 20 .. $] == "72078141008227e-4932");
2868+ auto result4 = printFloat(real.min_normal.nextDown, f);
2869+ assert(result4.length == 5007);
2870+ assert(result4[$ - 20 .. $] == "48141326333101e-4932");
2871+ */
2872+ }
28642873 }
28652874 });
28662875}
0 commit comments