From owner-freebsd-bugs Mon Nov 24 01:11:20 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id BAA18584 for bugs-outgoing; Mon, 24 Nov 1997 01:11:20 -0800 (PST) (envelope-from owner-freebsd-bugs) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id BAA18576; Mon, 24 Nov 1997 01:11:11 -0800 (PST) (envelope-from bde@zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.6.9) id UAA06647; Mon, 24 Nov 1997 20:01:52 +1100 Date: Mon, 24 Nov 1997 20:01:52 +1100 From: Bruce Evans Message-Id: <199711240901.UAA06647@godzilla.zeta.org.au> To: cagney@tpgi.com.au, freebsd-bugs@FreeBSD.ORG, joerg@FreeBSD.ORG Subject: Re: bin/5135 Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >Synopsis: scanf accepts %Lg but treates it as %g > >State-Changed-From-To: open-closed >State-Changed-By: joerg >State-Changed-When: Mon Nov 24 08:49:18 MET 1997 >State-Changed-Why: > >Fixed by Bruce in rev 1.12 of src/lib/libc/stdio/vfscanf.c a couple of >days ago (also merged to 2.2-stable). I even reported it to bug-gdb. Of course, the simple fix of reading long doubles as doubles doesn't actually work if the input has more than double precision or is too large for a double. The corresponding simplistic conversions for printf causes more problems: --- #include main() { fprintf(stderr, "%.20Lg\n", 12345678901234567890.0L); fprintf(stderr, "%.20Lg\n", 12345678901234567890.0e1234L); } --- Here the first printf loses precision and the second printf causes SIGFPE for overflow (unless overflow exceptions are masked; then then it loses precision and the result is "Inf"). Bruce