mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Added HUGE_VALF to <math.h>.
git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14934 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.68k,v 1.50 2005-05-07 13:21:49 obarthel Exp $
|
||||
# $Id: GNUmakefile.68k,v 1.51 2005-05-07 17:03:55 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -527,6 +527,7 @@ MATH_LIB = \
|
||||
math_fmod.o \
|
||||
math_frexp.o \
|
||||
math_huge_val.o \
|
||||
math_huge_valf.o \
|
||||
math_hypot.o \
|
||||
math_init_exit.o \
|
||||
math_isinf.o \
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.os4,v 1.53 2005-05-07 13:21:49 obarthel Exp $
|
||||
# $Id: GNUmakefile.os4,v 1.54 2005-05-07 17:03:55 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -527,6 +527,7 @@ MATH_LIB = \
|
||||
math_fmod.o \
|
||||
math_frexp.o \
|
||||
math_huge_val.o \
|
||||
math_huge_valf.o \
|
||||
math_hypot.o \
|
||||
math_init_exit.o \
|
||||
math_isnan.o \
|
||||
|
||||
@ -30,7 +30,10 @@
|
||||
|
||||
- The printf() family now supports the %hh, %j, %t and %z modifiers and the
|
||||
%a/%A conversions for C99. The %j is treated like %ll, %t and %z are treated
|
||||
like %l.
|
||||
like %l. Also, the "infinity"/"not a number" signals now come out as the
|
||||
strings "inf" and "nan".
|
||||
|
||||
- Added HUGE_VALF to <math.h>.
|
||||
|
||||
|
||||
c.lib 1.191 (9.4.2005)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: math.h,v 1.6 2005-02-25 10:14:22 obarthel Exp $
|
||||
* $Id: math.h,v 1.7 2005-05-07 17:04:07 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -110,6 +110,19 @@ extern double hypot(double x,double y);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The following is not part of the ISO 'C' (1994) standard, but it should
|
||||
be part of ISO/IEC 9899:1999, also known as "C99". */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern float __huge_val_float;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define HUGE_VALF ((const float)__huge_val_float)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: math_headers.h,v 1.7 2005-03-18 12:38:22 obarthel Exp $
|
||||
* $Id: math_headers.h,v 1.8 2005-05-07 17:03:55 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -222,4 +222,9 @@ extern double __get_huge_val(void);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* math_huge_valf.c */
|
||||
extern float __get_huge_valf(void);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _MATH_HEADERS_H */
|
||||
|
||||
44
library/math_huge_valf.c
Normal file
44
library/math_huge_valf.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* $Id: math_huge_valf.c,v 1.1 2005-05-07 17:03:55 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _MATH_HEADERS_H
|
||||
#include "math_headers.h"
|
||||
#endif /* _MATH_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
float
|
||||
__get_huge_valf(void)
|
||||
{
|
||||
return(__huge_val_float);
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: math_init_exit.c,v 1.15 2005-03-20 17:14:58 obarthel Exp $
|
||||
* $Id: math_init_exit.c,v 1.16 2005-05-07 17:03:55 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -73,7 +73,8 @@ struct Library * MathIeeeDoubTransBase;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
double __huge_val;
|
||||
float __huge_val_float;
|
||||
double __huge_val;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -114,6 +115,8 @@ MATH_DESTRUCTOR(math_exit)
|
||||
|
||||
MATH_CONSTRUCTOR(math_init)
|
||||
{
|
||||
union ieee_double * double_x;
|
||||
union ieee_single * single_x;
|
||||
BOOL success = FALSE;
|
||||
|
||||
ENTER();
|
||||
@ -163,34 +166,28 @@ MATH_CONSTRUCTOR(math_init)
|
||||
}
|
||||
#endif /* IEEE_FLOATING_POINT_SUPPORT */
|
||||
|
||||
/* Now fill in the HUGE_VAL constant, which is set to
|
||||
the largest representable floating point value. */
|
||||
if(sizeof(__huge_val) == 4) /* single precision */
|
||||
{
|
||||
union ieee_single * x = (union ieee_single *)&__huge_val;
|
||||
/* Now fill in HUGE_VAL and HUGE_VALF, respectively. TODO:
|
||||
also take care of HUGE_VALL. */
|
||||
|
||||
/* Exponent = +126, Mantissa = 8,388,607 */
|
||||
x->raw[0] = 0x7f7fffff;
|
||||
}
|
||||
else if (sizeof(__huge_val) == 8) /* double precision */
|
||||
{
|
||||
union ieee_double * x = (union ieee_double *)&__huge_val;
|
||||
/* Exponent = +126, Mantissa = 8,388,607 */
|
||||
single_x = (union ieee_single *)&__huge_val_float;
|
||||
single_x->raw[0] = 0x7f7fffff;
|
||||
|
||||
/* Exponent = +1022, Mantissa = 4,503,599,627,370,495 */
|
||||
x->raw[0] = 0x7fefffff;
|
||||
x->raw[1] = 0xffffffff;
|
||||
}
|
||||
#if defined(USE_LONG_DOUBLE)
|
||||
else if (sizeof(__huge_val) == 12) /* extended precision */
|
||||
/* Exponent = +1022, Mantissa = 4,503,599,627,370,495 */
|
||||
double_x = (union ieee_double *)&__huge_val;
|
||||
double_x->raw[0] = 0x7fefffff;
|
||||
double_x->raw[1] = 0xffffffff;
|
||||
|
||||
#if defined(USE_LONG_DOUBLE)
|
||||
{
|
||||
union ieee_long_double * x = (union ieee_long_double *)&__huge_val;
|
||||
union ieee_long_double * x = (union ieee_long_double *)&__huge_val_long_double;
|
||||
|
||||
/* Exponent = +32766, Mantissa = 18,446,744,073,709,551,615 */
|
||||
x->raw[0] = 0x7ffe0000;
|
||||
x->raw[1] = 0xffffffff;
|
||||
x->raw[2] = 0xffffffff;
|
||||
}
|
||||
#endif /* USE_LONG_DOUBLE */
|
||||
#endif /* USE_LONG_DOUBLE */
|
||||
|
||||
success = TRUE;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: smakefile,v 1.38 2005-05-07 13:21:49 obarthel Exp $
|
||||
# $Id: smakefile,v 1.39 2005-05-07 17:03:55 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -191,6 +191,7 @@ MATH_OBJ = \
|
||||
math_fmod.o \
|
||||
math_frexp.o \
|
||||
math_huge_val.o \
|
||||
math_huge_valf.o \
|
||||
math_hypot.o \
|
||||
math_init_exit.o \
|
||||
math_isinf.o \
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_vfprintf.c,v 1.13 2005-05-07 16:39:27 obarthel Exp $
|
||||
* $Id: stdio_vfprintf.c,v 1.14 2005-05-07 17:03:55 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -1362,7 +1362,7 @@ vfprintf(FILE * stream,const char * format, va_list arg)
|
||||
{
|
||||
char * byte_ptr;
|
||||
|
||||
byte_ptr = va_arg(arg, byte *);
|
||||
byte_ptr = va_arg(arg, char *);
|
||||
|
||||
assert( byte_ptr != NULL );
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_strtof.c,v 1.1 2005-05-07 13:21:49 obarthel Exp $
|
||||
* $Id: stdlib_strtof.c,v 1.2 2005-05-07 17:03:55 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -89,7 +89,7 @@ strtof(const char *str, char ** ptr)
|
||||
|
||||
__set_errno(EFAULT);
|
||||
|
||||
result = __get_huge_val();
|
||||
result = __get_huge_valf();
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -298,7 +298,7 @@ strtof(const char *str, char ** ptr)
|
||||
{
|
||||
__set_errno(error);
|
||||
|
||||
sum = __get_huge_val();
|
||||
sum = __get_huge_valf();
|
||||
}
|
||||
|
||||
if(is_negative)
|
||||
|
||||
Reference in New Issue
Block a user