The first result is slightly less, the second one is slightly more
accurate representation of 0.1 compared to the exected value thanks to
the rounding.

IMO it makes sense to omit the digits that are below the accuracy limit
and the man page does not suggest the opposite.

If you deeply believe that glibc needs to be fixed in this aspect please
report the issue upstream, because this is not a deliberate change in
the Ubuntu packaging.

Out of curiosity I've checked the results on Fedora and they are the
same:

 [root@fedora ~]# cat > test.c
#include <stdio.h>
#include <stdlib.h>

int main(void) {
 char ebuf[80];

 gcvt(0.1, 55, ebuf);
 printf("%s\n", ebuf);

 qgcvt(0.1L, 67, ebuf);
 printf("%s\n", ebuf);

 return 0;
}
[root@fedora ~]# gcc test.c 
[root@fedora ~]# ./a.out 
0.10000000000000001
0.100000000000000000001


** Changed in: glibc (Ubuntu)
       Status: New => Won't Fix

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1899553

Title:
  gcvt and qgcvt do not always provide requested precsion

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1899553/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to