#1079105 coreutils: printf "%.8f" outputs huge random looking number when read from a variable

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
Richard Ulrich
Date:
2025-09-03 16:47:03 UTC
Severity:
normal
Tags:
#1079105#5
Date:
2024-08-20 08:21:58 UTC
From:
To:
Dear Maintainer,

Up until some weeks ago, the output of the following was as expected, but after upgrading the OS packages, the output changed to some hughe random looking numbers:

mynumber=0.0
printf "%.8f\n" $mynumber

output before: 0.00000000

output now: 100659343671425158268899429462533789689816976257294885146455633784489074259769712021806609425516027094734142336186527542881113177243583820764212800336966890680929038744480475088875604095967744458970118613748778953976685910872466532772395254462136136658675405376516468169903844613979325120791825102945927666407685292041198228478980266237818769318008014364996603992114424065310850816932632425345365473553624858624.00000000

#1079105#10
Date:
2024-12-04 12:11:36 UTC
From:
To:
Hi all,

i just ran into the same bug and it's a bug in bash (#1078556), you
can check with:

root@trixie:/# sh -c 'printf "%f\n" 3'
3.000000

root@trixie:/# bash -c 'printf "%f\n" 3'
0.000000

root@trixie:/# /usr/bin/printf "%f\n" 3
3.000000

The /usr/bin/printf is the coreutils-version, which is not affected.

Thank's to @sur5r for figuring this out.

#1079105#15
Date:
2024-12-04 12:11:08 UTC
From:
To:
Are you sure this is in coreutils and not in bash?

To me, this seems to be the same bug as
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1078556

Cheers,
sur5r

#1079105#38
Date:
2025-09-03 16:45:34 UTC
From:
To: