History log of /src/lib/libc/tests/stdio/printfloat_test.c (Results 1 – 25 of 31)
Revision Date Author Comments
# 455426da 14-Sep-2025 Warner Losh <imp@FreeBSD.org>

Fix floaing point test. (again)

Fixes: 9dd78db9c30a


# 4c91a542 14-Sep-2025 Warner Losh <imp@FreeBSD.org>

Fix floaing point test.

I botched a style fix to a pull request, and didn't catch it on amd64,
but it broke almost everything else. It's a false positive to the style
program and spaces cannot be in

Fix floaing point test.

I botched a style fix to a pull request, and didn't catch it on amd64,
but it broke almost everything else. It's a false positive to the style
program and spaces cannot be inserted here. It's not math, but a funky
notation.

Fixes: 9dd78db9c30a

show more ...


# 9dd78db9 04-Sep-2025 Osamu Sho <osamusho@gmail.com>

libc: prevent incorrect %a/%La rounding at full precision

In __hdtoa() and __hldtoa(), rounding is incorrectly applied when
the requested precision exactly matches the number of significant
hexadeci

libc: prevent incorrect %a/%La rounding at full precision

In __hdtoa() and __hldtoa(), rounding is incorrectly applied when
the requested precision exactly matches the number of significant
hexadecimal digits. In this case, the redux adjustment can trigger
an unintended exponent increment and shift the rounding position
left by one bit. This causes the least significant digit to be
rounded incorrectly.

The fix adds a new condition based on MAX_HEX_DIGITS (derived from
MANT_DIG) so that rounding is performed only when precision is
strictly less than the number of significant digits. This avoids
the unintended shift while preserving correct rounding for other
cases.

A new regression test
(printfloat_test:hexadecimal_rounding_offset_eq_exp) covers both
the binary64 (%.13a) and binary128 (%.28La on arm64) cases that
previously fail, ensuring the bug does not regress.

Note: MAX_HEX_DIGITS represents the maximum number of hexadecimal
digits needed to express the mantissa. It is computed by subtracting
the implicit integer bit from [L]DBL_MANT_DIG, dividing the remaining
mantissa bits by 4 (with +3 to round up any remainder), and finally
adding +1 for the leading integer digit. This makes its meaning
explicit and distinct from SIGFIGS, which serves a different purpose.

Fixes: 76303a9735ee ("Make several changes to the way printf handles hex floating point (%a):")
Signed-off-by: Osamu Sho <osamusho@gmail.com>
Reviewed by: imp,jlduran
Pull Request: https://github.com/freebsd/freebsd-src/pull/1837

show more ...


# 559a218c 01-Nov-2023 Warner Losh <imp@FreeBSD.org>

libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Kee

libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42385

show more ...


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 0e4ff0ac 01-Mar-2021 Alex Richardson <arichardson@FreeBSD.org>

AArch64: Don't set flush-subnormals-to-zero flag on startup

This flag has been set on startup since 65618fdda0f272a823e6701966421bdca0efa301.
However, This causes some of the math-related tests to f

AArch64: Don't set flush-subnormals-to-zero flag on startup

This flag has been set on startup since 65618fdda0f272a823e6701966421bdca0efa301.
However, This causes some of the math-related tests to fail as they report
zero instead of a tiny number. This fixes at least
/usr/tests/lib/msun/ldexp_test and possibly others.
Additionally, setting this flag prevents printf() from printing subnormal
numbers in decimal form.
See also https://www.openwall.com/lists/musl/2021/02/26/1

PR: 253847
Reviewed By: mmel
Differential Revision: https://reviews.freebsd.org/D28938

show more ...


# 455426da 14-Sep-2025 Warner Losh <imp@FreeBSD.org>

Fix floaing point test. (again)

Fixes: 9dd78db9c30a


# 4c91a542 14-Sep-2025 Warner Losh <imp@FreeBSD.org>

Fix floaing point test.

I botched a style fix to a pull request, and didn't catch it on amd64,
but it broke almost everything else. It's a false positive to the style
program and spaces cannot be in

Fix floaing point test.

I botched a style fix to a pull request, and didn't catch it on amd64,
but it broke almost everything else. It's a false positive to the style
program and spaces cannot be inserted here. It's not math, but a funky
notation.

Fixes: 9dd78db9c30a

show more ...


# 9dd78db9 04-Sep-2025 Osamu Sho <osamusho@gmail.com>

libc: prevent incorrect %a/%La rounding at full precision

In __hdtoa() and __hldtoa(), rounding is incorrectly applied when
the requested precision exactly matches the number of significant
hexadeci

libc: prevent incorrect %a/%La rounding at full precision

In __hdtoa() and __hldtoa(), rounding is incorrectly applied when
the requested precision exactly matches the number of significant
hexadecimal digits. In this case, the redux adjustment can trigger
an unintended exponent increment and shift the rounding position
left by one bit. This causes the least significant digit to be
rounded incorrectly.

The fix adds a new condition based on MAX_HEX_DIGITS (derived from
MANT_DIG) so that rounding is performed only when precision is
strictly less than the number of significant digits. This avoids
the unintended shift while preserving correct rounding for other
cases.

A new regression test
(printfloat_test:hexadecimal_rounding_offset_eq_exp) covers both
the binary64 (%.13a) and binary128 (%.28La on arm64) cases that
previously fail, ensuring the bug does not regress.

Note: MAX_HEX_DIGITS represents the maximum number of hexadecimal
digits needed to express the mantissa. It is computed by subtracting
the implicit integer bit from [L]DBL_MANT_DIG, dividing the remaining
mantissa bits by 4 (with +3 to round up any remainder), and finally
adding +1 for the leading integer digit. This makes its meaning
explicit and distinct from SIGFIGS, which serves a different purpose.

Fixes: 76303a9735ee ("Make several changes to the way printf handles hex floating point (%a):")
Signed-off-by: Osamu Sho <osamusho@gmail.com>
Reviewed by: imp,jlduran
Pull Request: https://github.com/freebsd/freebsd-src/pull/1837

show more ...


# 559a218c 01-Nov-2023 Warner Losh <imp@FreeBSD.org>

libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Kee

libc: Purge unneeded cdefs.h

These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42385

show more ...


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 0e4ff0ac 01-Mar-2021 Alex Richardson <arichardson@FreeBSD.org>

AArch64: Don't set flush-subnormals-to-zero flag on startup

This flag has been set on startup since 65618fdda0f272a823e6701966421bdca0efa301.
However, This causes some of the math-related tests to f

AArch64: Don't set flush-subnormals-to-zero flag on startup

This flag has been set on startup since 65618fdda0f272a823e6701966421bdca0efa301.
However, This causes some of the math-related tests to fail as they report
zero instead of a tiny number. This fixes at least
/usr/tests/lib/msun/ldexp_test and possibly others.
Additionally, setting this flag prevents printf() from printing subnormal
numbers in decimal form.
See also https://www.openwall.com/lists/musl/2021/02/26/1

PR: 253847
Reviewed By: mmel
Differential Revision: https://reviews.freebsd.org/D28938

show more ...


# 0653d1fb 07-Feb-2017 Enji Cooper <ngie@FreeBSD.org>

Fix :hexadecimal_floating_point on i386

Don't exclude i386 from LDBL_MANT_DIG == 64; it works properly in
that case.

While here, replace strcmp + atf_tc_fail with ATF_CHECK_MSG for 2
reasons:
- Gat

Fix :hexadecimal_floating_point on i386

Don't exclude i386 from LDBL_MANT_DIG == 64; it works properly in
that case.

While here, replace strcmp + atf_tc_fail with ATF_CHECK_MSG for 2
reasons:
- Gather as many results as possible instead of failing early and
not testing the rest of the cases.
- Simplify logic when checking test inputs vs outputs and printing
test result.

Tested on: amd64, i386
MFC after: 1 week
Sponsored by: Dell EMC Isilon

show more ...


# e57c1140 18-Sep-2016 Enji Cooper <ngie@FreeBSD.org>

Remove spurious newlines from atf_tc_fail calls

This changes the results from broken (incorrect) to failed (correct) on
i386

MFC after: 1 week
Sponsored by: Dell EMC Isilon


# 3e227991 08-Dec-2015 Enji Cooper <ngie@FreeBSD.org>

Add missing va_ends for corresponding va_starts to clean up variable arguments
initialized in _test_fmt(..)

MFC after: 3 days
Reported by: cppcheck
Sponsored by: EMC / Isilon Storage Division


# 252f1a84 15-Nov-2015 Enji Cooper <ngie@FreeBSD.org>

Fix the Indian numbering system (hi_IN.ISCII-DEV) tests

Submitted by: ache
X-MFC with: r290494 (if that ever happens)
Sponsored by: EMC / Isilon Storage Division


# 1ee02192 08-Nov-2015 Enji Cooper <ngie@FreeBSD.org>

Integrate tools/regression/lib/libc/stdio into the FreeBSD test suite
as lib/libc/tests/stdio

- Fix some whitespace
- Convert the testcases to ATF
- Convert "/dev/null" to _PATH_DEVNULL

MFC after:

Integrate tools/regression/lib/libc/stdio into the FreeBSD test suite
as lib/libc/tests/stdio

- Fix some whitespace
- Convert the testcases to ATF
- Convert "/dev/null" to _PATH_DEVNULL

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division

show more ...


# 5d9e02db 14-Jan-2012 David Schultz <das@FreeBSD.org>

Update the tests for arm and other ports where long double is the same
as double, similar to r178141.


# acb3b7c6 31-Jan-2009 David Schultz <das@FreeBSD.org>

Test wprintf() in addition to printf().


# e058c00c 12-Apr-2008 David Schultz <das@FreeBSD.org>

Updates for changes in the way printf() handles hex floating point
numbers.


# 8b9f0f2a 03-Dec-2007 David Schultz <das@FreeBSD.org>

Make sure we set the locale to "C" when testing thousands' separator
support, rather than just "", which refers to the system default based
on the environment.


# b40c4c70 03-Dec-2007 David Schultz <das@FreeBSD.org>

Tests for rounding, and for the leading 0's bug.


# 73961b3d 01-Mar-2005 David Schultz <das@FreeBSD.org>

- Split the printfloat test into 11 individually wrapped and packaged
tests. (Buy 10, get one free!) The separate categories were
already there; they just weren't labeled.
- Use fesetround() in

- Split the printfloat test into 11 individually wrapped and packaged
tests. (Buy 10, get one free!) The separate categories were
already there; they just weren't labeled.
- Use fesetround() instead of fpsetround(), since the former is
standard and implemented on all supported architectures. Add
tests for each rounding mode.
- Add additional tests for subnormals.

Some of these tests won't pass until problems in vendor sources
(gdtoa and gcc) are fixed and new versions imported, but I
want to get these changes into the tree before I accidentally
blow them away.

show more ...


# 00e13b1d 11-Nov-2004 Nik Clayton <nik@FreeBSD.org>

Switch over to a different, more flexible test output protocol that's
understood by Perl's Test::Harness module and prove(1) commands.

Update README to describe the new protocol. The work's broken

Switch over to a different, more flexible test output protocol that's
understood by Perl's Test::Harness module and prove(1) commands.

Update README to describe the new protocol. The work's broken down into
two main sets of changes.

First, update the existing test programs (shell scripts and C programs)
to produce output in the ok/not ok format, and to, where possible, also
produce a header describing the number of tests that are expected to be
run.

Second, provide the .t files that actually run the tests. In some cases
these are copies of, or very similar too, scripts that already existed.
I've kept the old scripts around so that it's possible to verify that
behaviour under this new system (in terms of whether or not a test fails)
is identical to the behaviour under the old system.

Add a TODO file.

show more ...


# 5b9c5efc 13-Oct-2004 Giorgos Keramidas <keramida@FreeBSD.org>

Add a regression test for floating-point output in the Greek locale.
See revision 1.3 of src/share/numericdef/el_GR.ISO8859-7.src

Reviewed by: das (a while ago)


12