Files
gcc/libga68/ga68-math.c
Jose E. Marchesi a60cf319b6 a68: avoid libga68 dependency on libm
Using some of the operators and routines in the standard prelude lead
to a dependency on standard system math routines, usually available in
libm.  This is the case for sin, cos, etc.

If no such operator/routine is used by the user program, however, the
dependency should not be there.  We recently implemented some parts of
libga68 in Algol 68, and these use the entier operator.  Using this
operator drags in a dependency on floor, floorf and floorl via some
GCC built-ins.

This patch adds the gnulib implementation of floor, floorl and floorf
to libga68.

Tested in x86_64-pc-linux-gnu, in both -m64 and -m32 modes.
Tested in i686-pc-linux-gnu.

Signed-off-by: Jose E. Marchesi <jemarch@gnu.org>

libga68/ChangeLog

	* ga68-math.c: New file.
	* floor.c: Imported from gnulib.
	* configure.ac: Do not check for libm.
	* Makefile.am (libga68_la_SOURCES): Add ga68-match.c.
	* Makefile.in (am_libga68_la_OBJECTS): Regenerate.
	* configure (ac_res): Likewise.
2026-03-21 17:35:43 +01:00

41 lines
1.3 KiB
C

/* Run-time math routines.
Copyright (C) 2026 Jose E. Marchesi.
GCC is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
GCC 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 General Public License for more
details.
Under Section 7 of GPL version 3, you are granted additional permissions
described in the GCC Runtime Library Exception, version 3.1, as published by
the Free Software Foundation.
You should have received a copy of the GNU General Public License and a copy
of the GCC Runtime Library Exception along with this program; see the files
COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* The purpose of this file is to provide an implementation of math routines so
libga68.so doesn't have to depend on libm. */
/* floorl */
#define USE_LONG_DOUBLE
#include "floor.c"
#undef USE_LONG_DOUBLE
/* floorf */
#define USE_FLOAT
#include "floor.c"
#undef USE_FLOAT
/* floor */
#include "floor.c"