CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: jakllsch Date: Sun Jun 9 15:06:07 UTC 2024 Modified Files: src/lib/libc/gdtoa: hdtoa.c Log Message: Fix hdtoa() for VAX D floating point To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gdtoa/hdtoa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: jakllsch Date: Sun Jun 9 15:06:07 UTC 2024 Modified Files: src/lib/libc/gdtoa: hdtoa.c Log Message: Fix hdtoa() for VAX D floating point To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gdtoa/hdtoa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gdtoa/hdtoa.c diff -u src/lib/libc/gdtoa/hdtoa.c:1.13 src/lib/libc/gdtoa/hdtoa.c:1.14 --- src/lib/libc/gdtoa/hdtoa.c:1.13 Thu May 9 12:24:24 2024 +++ src/lib/libc/gdtoa/hdtoa.c Sun Jun 9 15:06:07 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: hdtoa.c,v 1.13 2024/05/09 12:24:24 riastradh Exp $ */ +/* $NetBSD: hdtoa.c,v 1.14 2024/06/09 15:06:07 jakllsch Exp $ */ /*- * Copyright (c) 2004, 2005 David Schultz @@ -30,7 +30,7 @@ #if 0 __FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.4 2007/01/03 04:57:58 das Exp $"); #else -__RCSID("$NetBSD: hdtoa.c,v 1.13 2024/05/09 12:24:24 riastradh Exp $"); +__RCSID("$NetBSD: hdtoa.c,v 1.14 2024/06/09 15:06:07 jakllsch Exp $"); #endif #include @@ -59,8 +59,12 @@ __RCSID("$NetBSD: hdtoa.c,v 1.13 2024/05 #define INFSTR "Infinity" #define NANSTR "NaN" +#ifndef __vax__ #define DBL_ADJ (DBL_MAX_EXP - 2 + ((DBL_MANT_DIG - 1) % 4)) #define LDBL_ADJ (LDBL_MAX_EXP - 2 + ((LDBL_MANT_DIG - 1) % 4)) +#else /* __vax__ */ +#define DBL_ADJ (DBL_MAX_EXP + 4 + ((DBL_MANT_DIG) % 4)) +#endif /* * Round up the given digit string. If the digit string is fff...f, @@ -152,6 +156,11 @@ hdtoa(double d, const char *xdigs, int n u.dblu_d = d; *sign = u.dblu_dbl.dbl_sign; +#ifdef __vax__ + u.dfltu_dflt.dflt_fracl = + ((u.dfltu_dflt.dflt_fracl >> 16) & 0x) | + ((u.dfltu_dflt.dflt_fracl & 0x) << 16); +#endif switch (fpclassify(d)) { case FP_NORMAL: @@ -160,16 +169,11 @@ hdtoa(double d, const char *xdigs, int n case FP_ZERO: *decpt = 1; return (nrv_alloc("0", rve, 1)); +#ifndef __vax__ case FP_SUBNORMAL: -#ifdef __vax__ - /* (DBL_MAX_EXP=127 / 2) + 2 = 65? */ - u.dblu_d *= 0x1p65; - *decpt = u.dblu_dbl.dbl_exp - (65 + DBL_ADJ); -#else /* (DBL_MAX_EXP=1024 / 2) + 2 = 514? */ u.dblu_d *= 0x1p514; *decpt = u.dblu_dbl.dbl_exp - (514 + DBL_ADJ); -#endif break; case FP_INFINITE: *decpt = INT_MAX; @@ -177,6 +181,7 @@ hdtoa(double d, const char *xdigs, int n case FP_NAN: *decpt = INT_MAX; return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1)); +#endif default: abort(); } @@ -210,7 +215,8 @@ hdtoa(double d, const char *xdigs, int n u.dblu_dbl.dbl_fracl >>= 4; } #ifdef DBL_FRACMBITS - for (; s > s0; s--) { + for (; s > s0 + sigfigs - ((DBL_FRACLBITS + DBL_FRACMBITS) / 4) - 1 +&& s > s0; s--) { *s = u.dblu_dbl.dbl_fracm & 0xf; u.dblu_dbl.dbl_fracm >>= 4; }
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: rillig Date: Mon May 13 21:17:24 UTC 2024 Modified Files: src/lib/libc/gdtoa: Makefile.inc Log Message: libc/hdtoa: suppress lint warning about possible accuracy loss on sparc64: hdtoa.c(340): warning: conversion from 'unsigned long' to 'char' may lose accuracy [132] To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gdtoa/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gdtoa/Makefile.inc diff -u src/lib/libc/gdtoa/Makefile.inc:1.13 src/lib/libc/gdtoa/Makefile.inc:1.14 --- src/lib/libc/gdtoa/Makefile.inc:1.13 Sat Oct 7 12:15:53 2023 +++ src/lib/libc/gdtoa/Makefile.inc Mon May 13 21:17:24 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.13 2023/10/07 12:15:53 rin Exp $ +# $NetBSD: Makefile.inc,v 1.14 2024/05/13 21:17:24 rillig Exp $ # gdtoa sources .PATH: ${.CURDIR}/gdtoa @@ -44,3 +44,5 @@ SRCS+= dmisc.c \ .if ${MACHINE_ARCH} != "vax" SRCS+= strtord.c .endif + +LINTFLAGS.hdtoa.c+= -X 132 # conversion may lose accuracy
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: rillig Date: Mon May 13 21:17:24 UTC 2024 Modified Files: src/lib/libc/gdtoa: Makefile.inc Log Message: libc/hdtoa: suppress lint warning about possible accuracy loss on sparc64: hdtoa.c(340): warning: conversion from 'unsigned long' to 'char' may lose accuracy [132] To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gdtoa/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: christos Date: Tue Jan 23 15:31:58 UTC 2024 Modified Files: src/lib/libc/gdtoa: strtod.c Log Message: fix vax build (unused variable) To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/lib/libc/gdtoa/strtod.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gdtoa/strtod.c diff -u src/lib/libc/gdtoa/strtod.c:1.19 src/lib/libc/gdtoa/strtod.c:1.20 --- src/lib/libc/gdtoa/strtod.c:1.19 Fri Aug 11 02:02:46 2023 +++ src/lib/libc/gdtoa/strtod.c Tue Jan 23 10:31:58 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: strtod.c,v 1.19 2023/08/11 06:02:46 mrg Exp $ */ +/* $NetBSD: strtod.c,v 1.20 2024/01/23 15:31:58 christos Exp $ */ / @@ -96,7 +96,7 @@ _int_strtod_l(CONST char *s00, char **se #ifdef Avoid_Underflow int scale; #endif - int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, decpt, dsign, + int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; CONST char *s, *s0, *s1; double aadj; @@ -117,7 +117,7 @@ _int_strtod_l(CONST char *s00, char **se #endif /*USE_LOCALE}}*/ #ifdef Honor_FLT_ROUNDS /*{*/ - int Rounding; + int Rounding, decpt = 0; #ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ Rounding = Flt_Rounds; #else /*}{*/ @@ -130,7 +130,7 @@ _int_strtod_l(CONST char *s00, char **se #endif /*}}*/ #endif /*}*/ - sign = nz0 = nz = decpt = 0; + sign = nz0 = nz = 0; dval() = 0.; for(s = s00;;s++) switch(*s) { case '-': @@ -211,7 +211,9 @@ _int_strtod_l(CONST char *s00, char **se if (c == '.') { c = *++s; #endif +#ifdef Honor_FLT_ROUNDS decpt = 1; +#endif if (!nd) { for(; c == '0'; c = *++s) nz++; @@ -349,6 +351,7 @@ _int_strtod_l(CONST char *s00, char **se if (nd <= DBL_DIG #ifndef RND_PRODQUOT #ifndef Honor_FLT_ROUNDS + /*CONSTCOND*/ && Flt_Rounds == 1 #endif #endif
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: christos Date: Tue Jan 23 15:31:58 UTC 2024 Modified Files: src/lib/libc/gdtoa: strtod.c Log Message: fix vax build (unused variable) To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/lib/libc/gdtoa/strtod.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: mrg Date: Fri Aug 11 06:02:46 UTC 2023 Modified Files: src/lib/libc/gdtoa: strtod.c Log Message: remove the -O0 force for _int_strtod_l() and GCC 9, it's fixed in GCC 10 and 12. this was triggering sh3 GCC 12 to fail compiles because of ssp.h's memcpy() frontend having the always_inline attribute that didn't match -O0 or so. tested with pkgsrc gcc9 to confirm it hangs there, but newer versions are fine. also known as PR#55668, which now has a real fix (gcc 10 :-). To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/lib/libc/gdtoa/strtod.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gdtoa/strtod.c diff -u src/lib/libc/gdtoa/strtod.c:1.18 src/lib/libc/gdtoa/strtod.c:1.19 --- src/lib/libc/gdtoa/strtod.c:1.18 Thu May 6 16:15:33 2021 +++ src/lib/libc/gdtoa/strtod.c Fri Aug 11 06:02:46 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: strtod.c,v 1.18 2021/05/06 16:15:33 christos Exp $ */ +/* $NetBSD: strtod.c,v 1.19 2023/08/11 06:02:46 mrg Exp $ */ / @@ -90,9 +90,6 @@ sulp } #endif /*}*/ -#if __GNUC_PREREQ__(9, 3) -__attribute__((__optimize__("O0"))) -#endif static double _int_strtod_l(CONST char *s00, char **se, locale_t loc) {
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: mrg Date: Fri Aug 11 06:02:46 UTC 2023 Modified Files: src/lib/libc/gdtoa: strtod.c Log Message: remove the -O0 force for _int_strtod_l() and GCC 9, it's fixed in GCC 10 and 12. this was triggering sh3 GCC 12 to fail compiles because of ssp.h's memcpy() frontend having the always_inline attribute that didn't match -O0 or so. tested with pkgsrc gcc9 to confirm it hangs there, but newer versions are fine. also known as PR#55668, which now has a real fix (gcc 10 :-). To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/lib/libc/gdtoa/strtod.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: dholland Date: Sat Apr 1 23:44:11 UTC 2023 Modified Files: src/lib/libc/gdtoa: gdtoa.c Log Message: Fix lying comment. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/lib/libc/gdtoa/gdtoa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gdtoa/gdtoa.c diff -u src/lib/libc/gdtoa/gdtoa.c:1.8 src/lib/libc/gdtoa/gdtoa.c:1.9 --- src/lib/libc/gdtoa/gdtoa.c:1.8 Thu May 6 16:15:33 2021 +++ src/lib/libc/gdtoa/gdtoa.c Sat Apr 1 23:44:11 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: gdtoa.c,v 1.8 2021/05/06 16:15:33 christos Exp $ */ +/* $NetBSD: gdtoa.c,v 1.9 2023/04/01 23:44:11 dholland Exp $ */ / @@ -128,7 +128,7 @@ gdtoa arguments of ecvt and fcvt; trailing zeros are suppressed from the returned string. If not null, *rve is set to point to the end of the return value. If d is +-Infinity or NaN, - then *decpt is set to . + then *decpt is set to -32768. be = exponent: value = (integer represented by bits) * (2 to the power of be). mode:
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: dholland Date: Sat Apr 1 23:44:11 UTC 2023 Modified Files: src/lib/libc/gdtoa: gdtoa.c Log Message: Fix lying comment. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/lib/libc/gdtoa/gdtoa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: riastradh Date: Wed Aug 7 15:37:46 UTC 2019 Modified Files: src/lib/libc/gdtoa: gdtoaimp.h Log Message: Mark the libc fegetround weak reference unused. Not all .c files that include gdtoaimp.h use it, which makes clang unhappy. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/lib/libc/gdtoa/gdtoaimp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gdtoa/gdtoaimp.h diff -u src/lib/libc/gdtoa/gdtoaimp.h:1.16 src/lib/libc/gdtoa/gdtoaimp.h:1.17 --- src/lib/libc/gdtoa/gdtoaimp.h:1.16 Thu Aug 1 02:27:43 2019 +++ src/lib/libc/gdtoa/gdtoaimp.h Wed Aug 7 15:37:46 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: gdtoaimp.h,v 1.16 2019/08/01 02:27:43 riastradh Exp $ */ +/* $NetBSD: gdtoaimp.h,v 1.17 2019/08/07 15:37:46 riastradh Exp $ */ / @@ -200,7 +200,8 @@ THIS SOFTWARE. #include "gd_qnan.h" #ifdef Honor_FLT_ROUNDS #include -__weakref_visible int __libc_fegetround_ref(void) __weak_reference(fegetround); +__unused __weakref_visible int __libc_fegetround_ref(void) + __weak_reference(fegetround); #define fegetround() \ (__libc_fegetround_ref ? __libc_fegetround_ref() : FE_TONEAREST) #endif
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: riastradh Date: Wed Aug 7 15:37:46 UTC 2019 Modified Files: src/lib/libc/gdtoa: gdtoaimp.h Log Message: Mark the libc fegetround weak reference unused. Not all .c files that include gdtoaimp.h use it, which makes clang unhappy. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/lib/libc/gdtoa/gdtoaimp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: riastradh Date: Thu Aug 1 02:27:43 UTC 2019 Modified Files: src/lib/libc/gdtoa: g_Qfmt.c g_dfmt.c g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gdtoa.h gdtoaimp.h ldtoa.c strtoIQ.c strtoId.c strtoIdd.c strtoIf.c strtoIg.c strtoIx.c strtoIxL.c strtod.c strtodI.c strtopd.c strtopdd.c strtopf.c strtorQ.c Log Message: Sprinkle some more const in. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gdtoa/g_Qfmt.c \ src/lib/libc/gdtoa/g_xLfmt.c src/lib/libc/gdtoa/g_xfmt.c \ src/lib/libc/gdtoa/strtorQ.c cvs rdiff -u -r1.3 -r1.4 src/lib/libc/gdtoa/g_dfmt.c \ src/lib/libc/gdtoa/g_ffmt.c src/lib/libc/gdtoa/strtoIg.c \ src/lib/libc/gdtoa/strtodI.c src/lib/libc/gdtoa/strtopd.c \ src/lib/libc/gdtoa/strtopdd.c src/lib/libc/gdtoa/strtopf.c cvs rdiff -u -r1.6 -r1.7 src/lib/libc/gdtoa/gdtoa.c cvs rdiff -u -r1.10 -r1.11 src/lib/libc/gdtoa/gdtoa.h cvs rdiff -u -r1.15 -r1.16 src/lib/libc/gdtoa/gdtoaimp.h cvs rdiff -u -r1.5 -r1.6 src/lib/libc/gdtoa/ldtoa.c cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gdtoa/strtoIQ.c \ src/lib/libc/gdtoa/strtoId.c src/lib/libc/gdtoa/strtoIdd.c \ src/lib/libc/gdtoa/strtoIf.c src/lib/libc/gdtoa/strtoIx.c \ src/lib/libc/gdtoa/strtoIxL.c cvs rdiff -u -r1.14 -r1.15 src/lib/libc/gdtoa/strtod.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gdtoa/g_Qfmt.c diff -u src/lib/libc/gdtoa/g_Qfmt.c:1.4 src/lib/libc/gdtoa/g_Qfmt.c:1.5 --- src/lib/libc/gdtoa/g_Qfmt.c:1.4 Sun Mar 20 23:15:35 2011 +++ src/lib/libc/gdtoa/g_Qfmt.c Thu Aug 1 02:27:43 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: g_Qfmt.c,v 1.4 2011/03/20 23:15:35 christos Exp $ */ +/* $NetBSD: g_Qfmt.c,v 1.5 2019/08/01 02:27:43 riastradh Exp $ */ / @@ -58,7 +58,7 @@ g_Qfmt(buf, V, ndig, bufsize) char *buf; g_Qfmt(char *buf, void *V, int ndig, size_t bufsize) #endif { - static FPI fpi0 = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, 0 }; + static CONST FPI fpi0 = { 113, 1-16383-113+1, 32766 - 16383 - 113 + 1, 1, 0 }; char *b, *s, *se; ULong bits[4], *L, sign; int decpt, ex, i, mode; Index: src/lib/libc/gdtoa/g_xLfmt.c diff -u src/lib/libc/gdtoa/g_xLfmt.c:1.4 src/lib/libc/gdtoa/g_xLfmt.c:1.5 --- src/lib/libc/gdtoa/g_xLfmt.c:1.4 Sun Mar 20 23:15:35 2011 +++ src/lib/libc/gdtoa/g_xLfmt.c Thu Aug 1 02:27:43 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: g_xLfmt.c,v 1.4 2011/03/20 23:15:35 christos Exp $ */ +/* $NetBSD: g_xLfmt.c,v 1.5 2019/08/01 02:27:43 riastradh Exp $ */ / @@ -56,7 +56,7 @@ g_xLfmt(buf, V, ndig, bufsize) char *buf g_xLfmt(char *buf, void *V, int ndig, size_t bufsize) #endif { - static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; + static CONST FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; char *b, *s, *se; ULong bits[2], *L, sign; int decpt, ex, i, mode; Index: src/lib/libc/gdtoa/g_xfmt.c diff -u src/lib/libc/gdtoa/g_xfmt.c:1.4 src/lib/libc/gdtoa/g_xfmt.c:1.5 --- src/lib/libc/gdtoa/g_xfmt.c:1.4 Sun Mar 20 23:15:35 2011 +++ src/lib/libc/gdtoa/g_xfmt.c Thu Aug 1 02:27:43 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: g_xfmt.c,v 1.4 2011/03/20 23:15:35 christos Exp $ */ +/* $NetBSD: g_xfmt.c,v 1.5 2019/08/01 02:27:43 riastradh Exp $ */ / @@ -60,7 +60,7 @@ g_xfmt(buf, V, ndig, bufsize) char *buf; g_xfmt(char *buf, void *V, int ndig, size_t bufsize) #endif { - static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; + static CONST FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, 0 }; char *b, *s, *se; ULong bits[2], sign; UShort *L; Index: src/lib/libc/gdtoa/strtorQ.c diff -u src/lib/libc/gdtoa/strtorQ.c:1.4 src/lib/libc/gdtoa/strtorQ.c:1.5 --- src/lib/libc/gdtoa/strtorQ.c:1.4 Sun Mar 20 23:15:35 2011 +++ src/lib/libc/gdtoa/strtorQ.c Thu Aug 1 02:27:43 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: strtorQ.c,v 1.4 2011/03/20 23:15:35 christos Exp $ */ +/* $NetBSD: strtorQ.c,v 1.5 2019/08/01 02:27:43 riastradh Exp $ */ / @@ -101,8 +101,9 @@ strtorQ(s, sp, rounding, L) CONST char * strtorQ(CONST char *s, char **sp, int rounding, void *L) #endif { - static FPI fpi0 = { 113, 1-16383-113+1, 32766-16383-113+1, 1, SI }; - FPI *fpi, fpi1; + static CONST FPI fpi0 = { 113, 1-16383-113+1, 32766-16383-113+1, 1, SI }; + CONST FPI *fpi; + FPI fpi1; ULong bits[4]; Long expt; int k; Index: src/lib/libc/gdtoa/g_dfmt.c diff -u src/lib/libc/gdtoa/g_dfmt.c:1.3 src/lib/libc/gdtoa/g_dfmt.c:1.4 --- src/lib/libc/gdtoa/g_dfmt.c:1.3 Sun Mar 20 23:15:35 2011 +++ src/lib/libc/gdtoa/g_dfmt.c Thu Aug 1 02:27:43 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: g_dfmt.c,v 1.3 2011/03/20 23:15:35 christos Exp $ */ +/* $NetBSD:
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: riastradh Date: Thu Aug 1 02:27:43 UTC 2019 Modified Files: src/lib/libc/gdtoa: g_Qfmt.c g_dfmt.c g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gdtoa.h gdtoaimp.h ldtoa.c strtoIQ.c strtoId.c strtoIdd.c strtoIf.c strtoIg.c strtoIx.c strtoIxL.c strtod.c strtodI.c strtopd.c strtopdd.c strtopf.c strtorQ.c Log Message: Sprinkle some more const in. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gdtoa/g_Qfmt.c \ src/lib/libc/gdtoa/g_xLfmt.c src/lib/libc/gdtoa/g_xfmt.c \ src/lib/libc/gdtoa/strtorQ.c cvs rdiff -u -r1.3 -r1.4 src/lib/libc/gdtoa/g_dfmt.c \ src/lib/libc/gdtoa/g_ffmt.c src/lib/libc/gdtoa/strtoIg.c \ src/lib/libc/gdtoa/strtodI.c src/lib/libc/gdtoa/strtopd.c \ src/lib/libc/gdtoa/strtopdd.c src/lib/libc/gdtoa/strtopf.c cvs rdiff -u -r1.6 -r1.7 src/lib/libc/gdtoa/gdtoa.c cvs rdiff -u -r1.10 -r1.11 src/lib/libc/gdtoa/gdtoa.h cvs rdiff -u -r1.15 -r1.16 src/lib/libc/gdtoa/gdtoaimp.h cvs rdiff -u -r1.5 -r1.6 src/lib/libc/gdtoa/ldtoa.c cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gdtoa/strtoIQ.c \ src/lib/libc/gdtoa/strtoId.c src/lib/libc/gdtoa/strtoIdd.c \ src/lib/libc/gdtoa/strtoIf.c src/lib/libc/gdtoa/strtoIx.c \ src/lib/libc/gdtoa/strtoIxL.c cvs rdiff -u -r1.14 -r1.15 src/lib/libc/gdtoa/strtod.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: riastradh Date: Thu Aug 1 02:06:31 UTC 2019 Modified Files: src/lib/libc/gdtoa: Makefile.inc gdtoa_fltrnds.h gdtoaimp.h Log Message: Honour the floating-point rounding mode in floating-point formatting. C99, Sec. 7.19.6.1 `The fprintf function', paragraph 13, p. 281: (Recommended practice) For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most DECIMAL_DIG, then the result should be correctly rounded. If the number of significant decimal digits is more than DECIMAL_DIG but the source value is exactly representable with DECIMAL_DIG digits, then the result should be an exact representation with trailing zeros. Otherwise, the source value is bounded by two adjacent decimal strings L < U, both having DECIMAL_DIG significant idgits; the value of the resultant decimal string D should satisfy L <= D <= U, _with the extra stipulation that the error should have a correct sign for the current rounding direction_. [emphasis added] The gdtoa code base already supports respecting the floating-point rounding mode, as long as we compile it with Honor_FLT_ROUNDS defined. However, for this to work, fegetround must be available in libc, which it is not currently -- the fenv logic is in libm. Fortunately, we don't have to move all of fenv from libm to libc -- programs that do not link against libm don't have fesetround, so the rounding mode is always the default (barring asm shenanigans that bypass the API -- tough). So use a weak reference to fegetround; by default, assume FE_TONEAREST if it is not defined. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/libc/gdtoa/Makefile.inc cvs rdiff -u -r1.1.1.1 -r1.2 src/lib/libc/gdtoa/gdtoa_fltrnds.h cvs rdiff -u -r1.14 -r1.15 src/lib/libc/gdtoa/gdtoaimp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: riastradh Date: Thu Aug 1 02:06:31 UTC 2019 Modified Files: src/lib/libc/gdtoa: Makefile.inc gdtoa_fltrnds.h gdtoaimp.h Log Message: Honour the floating-point rounding mode in floating-point formatting. C99, Sec. 7.19.6.1 `The fprintf function', paragraph 13, p. 281: (Recommended practice) For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most DECIMAL_DIG, then the result should be correctly rounded. If the number of significant decimal digits is more than DECIMAL_DIG but the source value is exactly representable with DECIMAL_DIG digits, then the result should be an exact representation with trailing zeros. Otherwise, the source value is bounded by two adjacent decimal strings L < U, both having DECIMAL_DIG significant idgits; the value of the resultant decimal string D should satisfy L <= D <= U, _with the extra stipulation that the error should have a correct sign for the current rounding direction_. [emphasis added] The gdtoa code base already supports respecting the floating-point rounding mode, as long as we compile it with Honor_FLT_ROUNDS defined. However, for this to work, fegetround must be available in libc, which it is not currently -- the fenv logic is in libm. Fortunately, we don't have to move all of fenv from libm to libc -- programs that do not link against libm don't have fesetround, so the rounding mode is always the default (barring asm shenanigans that bypass the API -- tough). So use a weak reference to fegetround; by default, assume FE_TONEAREST if it is not defined. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/lib/libc/gdtoa/Makefile.inc cvs rdiff -u -r1.1.1.1 -r1.2 src/lib/libc/gdtoa/gdtoa_fltrnds.h cvs rdiff -u -r1.14 -r1.15 src/lib/libc/gdtoa/gdtoaimp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gdtoa/Makefile.inc diff -u src/lib/libc/gdtoa/Makefile.inc:1.10 src/lib/libc/gdtoa/Makefile.inc:1.11 --- src/lib/libc/gdtoa/Makefile.inc:1.10 Thu Jan 16 20:31:42 2014 +++ src/lib/libc/gdtoa/Makefile.inc Thu Aug 1 02:06:31 2019 @@ -1,10 +1,14 @@ -# $NetBSD: Makefile.inc,v 1.10 2014/01/16 20:31:42 christos Exp $ +# $NetBSD: Makefile.inc,v 1.11 2019/08/01 02:06:31 riastradh Exp $ # gdtoa sources .PATH: ${.CURDIR}/gdtoa CPPFLAGS+=-I${.CURDIR}/gdtoa -I${.CURDIR}/locale +.if ${MACHINE_ARCH} == "vax" CPPFLAGS+=-DNO_FENV_H +.else +CPPFLAGS+=-DHonor_FLT_ROUNDS +.endif # machine-dependent directory must provide the following: # arith.h gd_qnan.h Index: src/lib/libc/gdtoa/gdtoa_fltrnds.h diff -u src/lib/libc/gdtoa/gdtoa_fltrnds.h:1.1.1.1 src/lib/libc/gdtoa/gdtoa_fltrnds.h:1.2 --- src/lib/libc/gdtoa/gdtoa_fltrnds.h:1.1.1.1 Sat Mar 19 16:26:37 2011 +++ src/lib/libc/gdtoa/gdtoa_fltrnds.h Thu Aug 1 02:06:31 2019 @@ -1,4 +1,5 @@ - FPI *fpi, fpi1; + CONST FPI *fpi; + FPI fpi1; int Rounding; #ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */ Rounding = Flt_Rounds; Index: src/lib/libc/gdtoa/gdtoaimp.h diff -u src/lib/libc/gdtoa/gdtoaimp.h:1.14 src/lib/libc/gdtoa/gdtoaimp.h:1.15 --- src/lib/libc/gdtoa/gdtoaimp.h:1.14 Fri Apr 19 10:41:53 2013 +++ src/lib/libc/gdtoa/gdtoaimp.h Thu Aug 1 02:06:31 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: gdtoaimp.h,v 1.14 2013/04/19 10:41:53 joerg Exp $ */ +/* $NetBSD: gdtoaimp.h,v 1.15 2019/08/01 02:06:31 riastradh Exp $ */ / @@ -200,6 +200,9 @@ THIS SOFTWARE. #include "gd_qnan.h" #ifdef Honor_FLT_ROUNDS #include +__weakref_visible int __libc_fegetround_ref(void) __weak_reference(fegetround); +#define fegetround() \ + (__libc_fegetround_ref ? __libc_fegetround_ref() : FE_TONEAREST) #endif #ifdef DEBUG
Re: CVS commit: src/lib/libc/gdtoa
Christos Zoulas chris...@netbsd.org writes: Modified Files: src/lib/libc/gdtoa: misc.c I've noticed that this code casually enclosing piece of code including return statement with ACQUIRE_LOCK/FREE_LOCK. I guess the lock need to be freed (i.e., unlocked) before return. enami.
Re: CVS commit: src/lib/libc/gdtoa
i386 build is still broken with lint issues in dtoa.c, gdtoa.c and strtod.c at least. Joerg On Sun, Mar 20, 2011 at 07:15:36PM -0400, Christos Zoulas wrote: Module Name: src Committed By: christos Date: Sun Mar 20 23:15:35 UTC 2011 Modified Files: src/lib/libc/gdtoa: dtoa.c g_Qfmt.c g_ddfmt.c g_dfmt.c g_ffmt.c g_xLfmt.c g_xfmt.c gdtoa.c gdtoa.h gdtoaimp.h gethex.c hexnan.c makefile misc.c smisc.c strtoIg.c strtod.c strtodI.c strtodg.c strtodnrp.c strtof.c strtopQ.c strtopd.c strtopdd.c strtopf.c strtopx.c strtopxL.c strtorQ.c strtordd.c strtorf.c strtorx.c strtorxL.c ulp.c src/lib/libc/gdtoa/test: Qtest.c makefile xLtest.c xtest.c Log Message: Merge the new gdtoa: Note that the built-in tests fail the same way as with the old gdtoa. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/lib/libc/gdtoa/dtoa.c src/lib/libc/gdtoa/misc.c \ src/lib/libc/gdtoa/strtod.c cvs rdiff -u -r1.3 -r1.4 src/lib/libc/gdtoa/g_Qfmt.c \ src/lib/libc/gdtoa/g_xLfmt.c src/lib/libc/gdtoa/g_xfmt.c \ src/lib/libc/gdtoa/hexnan.c src/lib/libc/gdtoa/makefile \ src/lib/libc/gdtoa/smisc.c src/lib/libc/gdtoa/strtof.c \ src/lib/libc/gdtoa/strtorQ.c src/lib/libc/gdtoa/strtorx.c \ src/lib/libc/gdtoa/strtorxL.c cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gdtoa/g_ddfmt.c \ src/lib/libc/gdtoa/g_dfmt.c src/lib/libc/gdtoa/g_ffmt.c \ src/lib/libc/gdtoa/strtoIg.c src/lib/libc/gdtoa/strtodI.c \ src/lib/libc/gdtoa/strtodnrp.c src/lib/libc/gdtoa/strtopd.c \ src/lib/libc/gdtoa/strtopdd.c src/lib/libc/gdtoa/strtopf.c \ src/lib/libc/gdtoa/strtordd.c src/lib/libc/gdtoa/strtorf.c \ src/lib/libc/gdtoa/ulp.c cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gdtoa/gdtoa.c \ src/lib/libc/gdtoa/gethex.c src/lib/libc/gdtoa/strtopQ.c \ src/lib/libc/gdtoa/strtopx.c src/lib/libc/gdtoa/strtopxL.c cvs rdiff -u -r1.8 -r1.9 src/lib/libc/gdtoa/gdtoa.h \ src/lib/libc/gdtoa/gdtoaimp.h cvs rdiff -u -r1.6 -r1.7 src/lib/libc/gdtoa/strtodg.c cvs rdiff -u -r1.1.1.1 -r1.2 src/lib/libc/gdtoa/test/Qtest.c \ src/lib/libc/gdtoa/test/makefile src/lib/libc/gdtoa/test/xLtest.c \ src/lib/libc/gdtoa/test/xtest.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/lib/libc/gdtoa
Module Name:src Committed By: wiz Date: Sun Jan 17 23:06:31 UTC 2010 Modified Files: src/lib/libc/gdtoa: arithchk.c Log Message: Close file handle after using it. Found by cppcheck. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gdtoa/arithchk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.