mirror of
git://sourceware.org/git/glibc.git
synced 2025-01-18 12:16:13 +08:00
Mon Feb 20 04:04:57 1995 Roland McGrath <roland@duality.gnu.ai.mit.edu>
* config.h.in [HAVE_ELF || HAVE_GNU_LD]: Define HAVE_WEAK_SYMBOLS. * stdlib/strtod.c (PASTE, PASTE1): New helper macros; use these in access to float.h macros. * misc/efgcvt.c: New file. * misc/Makefile (routines): Add efgcvt.
This commit is contained in:
parent
9c97d688c1
commit
0923c7a543
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
Mon Feb 20 04:04:57 1995 Roland McGrath <roland@duality.gnu.ai.mit.edu>
|
||||
|
||||
* config.h.in [HAVE_ELF || HAVE_GNU_LD]: Define HAVE_WEAK_SYMBOLS.
|
||||
|
||||
* stdlib/strtod.c (PASTE, PASTE1): New helper macros; use these in
|
||||
access to float.h macros.
|
||||
|
||||
* misc/efgcvt.c: New file.
|
||||
* misc/Makefile (routines): Add efgcvt.
|
||||
|
||||
Sun Feb 19 20:10:43 1995 Brendan Kehoe <brendan@zen.org>
|
||||
|
||||
* sysdeps/sparc/mul.S: Renamed to `dotmul.S'.
|
||||
|
@ -13,6 +13,13 @@
|
||||
|
||||
/* Define if using the GNU assembler, gas. */
|
||||
#undef HAVE_GNU_AS
|
||||
|
||||
/* ELF has weak symbols, and with GNU ld a.out does too. */
|
||||
#ifndef HAVE_WEAK_SYMBOLS
|
||||
#if defined (HAVE_ELF) || defined (HAVE_GNU_LD)
|
||||
#define HAVE_WEAK_SYMBOLS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* These symbols might be defined by some sysdeps configures. */
|
||||
|
||||
|
72
misc/efgcvt.c
Normal file
72
misc/efgcvt.c
Normal file
@ -0,0 +1,72 @@
|
||||
/* [efg]cvt -- compatibility functions for floating point formatting
|
||||
Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
|
||||
char *
|
||||
fcvt (value, ndigit, decpt, sign)
|
||||
double value;
|
||||
int ndigit, *decpt, *sign;
|
||||
{
|
||||
static char buf[100];
|
||||
int n, i;
|
||||
|
||||
*sign = value < 0.0;
|
||||
if (*sign)
|
||||
value = - value;
|
||||
|
||||
n = snprintf (buf, sizeof buf, "%.*f", ndigit, value);
|
||||
if (n < 0)
|
||||
return NULL;
|
||||
|
||||
i = 0;
|
||||
while (i < n && isdigit (buf[i]))
|
||||
++i;
|
||||
*decpt = i;
|
||||
do
|
||||
++i;
|
||||
while (! isdigit (buf[i]));
|
||||
memmove (&buf[i - *decpt], buf, n - (i - *decpt));
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
char *
|
||||
ecvt (value, ndigit, decpt, sign)
|
||||
double value;
|
||||
int ndigit, *decpt, *sign;
|
||||
{
|
||||
ndigit -= (int) floor (log10 (value));
|
||||
if (ndigit < 0)
|
||||
ndigit = 0;
|
||||
return fcvt (value, ndigit, decpt, sign);
|
||||
}
|
||||
|
||||
char *
|
||||
gcvt (value, ndigit, buf)
|
||||
double value;
|
||||
int ndigit;
|
||||
char *buf;
|
||||
{
|
||||
sprintf (buf, "%.*g", ndigit, value);
|
||||
return buf;
|
||||
}
|
@ -47,13 +47,16 @@ Cambridge, MA 02139, USA. */
|
||||
|
||||
|
||||
/* Constants we need from float.h; select the set for the FLOAT precision. */
|
||||
#define MANT_DIG FLT##_MANT_DIG
|
||||
#define MAX_EXP FLT##_MAX_EXP
|
||||
#define MIN_EXP FLT##_MIN_EXP
|
||||
#define MAX_10_EXP FLT##_MAX_10_EXP
|
||||
#define MIN_10_EXP FLT##_MIN_10_EXP
|
||||
#define MAX_10_EXP_LOG FLT##_MAX_10_EXP_LOG
|
||||
#define MANT_DIG PASTE(FLT,_MANT_DIG)
|
||||
#define MAX_EXP PASTE(FLT,_MAX_EXP)
|
||||
#define MIN_EXP PASTE(FLT,_MIN_EXP)
|
||||
#define MAX_10_EXP PASTE(FLT,_MAX_10_EXP)
|
||||
#define MIN_10_EXP PASTE(FLT,_MIN_10_EXP)
|
||||
#define MAX_10_EXP_LOG PASTE(FLT,_MAX_10_EXP_LOG)
|
||||
|
||||
/* Extra macros required to get FLT expanded before the pasting. */
|
||||
#define PASTE(a,b) PASTE1(a,b)
|
||||
#define PASTE1(a,b) a##b
|
||||
|
||||
/* Function to construct a floating point number from an MP integer
|
||||
containing the fraction bits, a base 2 exponent, and a sign flag. */
|
||||
|
@ -108,7 +108,8 @@ $(objpfx)stamp-errnos: $(hurd)/errnos.awk $(errno.texinfo) \
|
||||
# Make it unwritable so noone will edit it by mistake.
|
||||
-chmod a-w $(hurd)/errnos.h-tmp
|
||||
./$(..)move-if-change $(hurd)/errnos.h-tmp $(hurd)/errnos.h
|
||||
test -d CVS && cvs commit -m'Regenerated from $^' $@
|
||||
test -d CVS && \
|
||||
(cd $(hurd); cvs commit -m'Regenerated from $^' errnos.h)
|
||||
touch $@
|
||||
|
||||
$(hurd)/errlist.c: $(hurd)/errlist.awk $(errno.texinfo)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -20,6 +20,7 @@
|
||||
# @comment errno.h
|
||||
# @comment POSIX.1: Function not implemented
|
||||
# @deftypevr Macro int ENOSYS
|
||||
# @comment errno 123
|
||||
|
||||
BEGIN {
|
||||
printf "/* This file generated by";
|
||||
|
Loading…
Reference in New Issue
Block a user