libm: Add frexpf and frexpl on VAX.
These are trivial subroutines, not symbol aliases, for separate reasons: - frexpf has a different ABI from frexp (float vs double argument) - frexp is defined in libc, not libm, so although long double is the same as double, frexpl can't be an alias in libm of a symbol defined in libc
This commit is contained in:
parent
22479c33fe
commit
210c9d72b1
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.233 2024/05/09 00:04:23 riastradh Exp $
|
||||
# $NetBSD: Makefile,v 1.234 2024/05/09 14:42:09 riastradh Exp $
|
||||
#
|
||||
# @(#)Makefile 5.1beta 93/09/24
|
||||
#
|
||||
|
@ -359,8 +359,9 @@ COPTS.compat_cabsf.c= ${${ACTIVE_CC} == "gcc":? -fno-builtin-cabsf :}
|
|||
# math routines for non-IEEE architectures.
|
||||
NOIEEE_SRCS = n_asincos.c n_acosh.c n_asinh.c n_atan.c n_atanh.c n_atanhf.c \
|
||||
n_cosh.c \
|
||||
n_erf.c n_exp.c n_exp2.c n_exp2f.c n_exp__E.c n_expm1.c n_floor.c \
|
||||
n_fmod.c n_gamma.c n_ilogb.c \
|
||||
n_erf.c n_exp.c n_exp2.c n_exp2f.c n_exp__E.c n_expm1.c \
|
||||
n_floor.c n_fmod.c n_frexpf.c n_frexpl.c \
|
||||
n_gamma.c n_ilogb.c \
|
||||
n_lgamma.c n_j0.c n_j1.c n_jn.c n_log.c n_log10.c n_log1p.c \
|
||||
n_log2.c n_log__L.c n_pow.c n_sinh.c n_tanh.c \
|
||||
n_sincos.c n_sincos1.c n_tan.c \
|
||||
|
|
|
@ -188,6 +188,8 @@ fminf
|
|||
fmod
|
||||
fmodf
|
||||
fmodl
|
||||
frexpf
|
||||
frexpl
|
||||
gamma
|
||||
hypot
|
||||
hypotf
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/* $NetBSD: n_frexpf.c,v 1.1 2024/05/09 14:42:10 riastradh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2024 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: n_frexpf.c,v 1.1 2024/05/09 14:42:10 riastradh Exp $");
|
||||
|
||||
#include "namespace.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
float
|
||||
frexpf(float x, int *e)
|
||||
{
|
||||
|
||||
/*
|
||||
* We assume every value representable by float is also
|
||||
* representable by double. The normalized result of frexp
|
||||
* differs only by the exponent, which is set to -1 (result
|
||||
* lies in [1/2, 1) or is zero), so it is also still
|
||||
* representable by float.
|
||||
*
|
||||
* This can't simply be a symbol alias, however, because the
|
||||
* ABI of float frexpf(float, int *) is different from the ABI
|
||||
* of double frexp(double, int *).
|
||||
*/
|
||||
return frexp(x, e);
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/* $NetBSD: n_frexpl.c,v 1.1 2024/05/09 14:42:10 riastradh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2024 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: n_frexpl.c,v 1.1 2024/05/09 14:42:10 riastradh Exp $");
|
||||
|
||||
#include "namespace.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __HAVE_LONG_DOUBLE
|
||||
#error This file is only for machiens where long double is the same as double.
|
||||
#endif
|
||||
|
||||
long double
|
||||
frexpl(long double x, int *e)
|
||||
{
|
||||
|
||||
/*
|
||||
* This can't be a symbol alias because frexp is defined in
|
||||
* libc, but frexpl is defined in libm, and ELF symbol aliases
|
||||
* can't reach across libraries.
|
||||
*/
|
||||
return frexp(x, e);
|
||||
}
|
Loading…
Reference in New Issue