This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
test that gcvt/qgcvt are not buggy (Issue 18170)
authorH.Merijn Brand <perl5@tux.freedom.nl>
Sat, 24 Oct 2020 10:23:52 +0000 (12:23 +0200)
committerH.Merijn Brand <perl5@tux.freedom.nl>
Sat, 24 Oct 2020 10:23:52 +0000 (12:23 +0200)
Backport of e8b4b5cb56db51c60d23a47fbb2f897e1206c9af
Author: sisyphus <sisyphus@cpan.org>
Date:   Wed Oct 21 10:52:11 2020 +1100

But style adjusted to surrounding code

U/compline/d_gconvert.U

index d72a5cf..d1a6329 100644 (file)
@@ -207,6 +207,14 @@ int main()
        else
            checkit("1e+34", buf);
 
+        /* Test for an Ubuntu/Debian bug in gcvt and qgcvt. See:        *
+         * https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1899553 */
+       Gconvert((DOUBLETYPE)0.4, 53, 0, buf);
+       if(sizeof(DOUBLETYPE) == 8)
+           checkit("0.40000000000000002220446049250313080847263336181640625", buf);
+       else
+           checkit("0.40000000000000000000542101086242752217003726400434971", buf);
+
        /* For Perl, if you add additional tests here, also add them to
         * t/base/num.t for benefit of platforms not using Configure or
         * overriding d_Gconvert */