Commit 1394b3f6 authored by Stuart Swales's avatar Stuart Swales
Browse files

Supply the single precision hyperbolic math routines which are not exported by...

Supply the single precision hyperbolic math routines which are not exported by the SharedCLibrary as a separate object file in C:o.Stubs, akin to mathl for long double precision functions. These are already correctly exported by C:o.AnsiLib, so are not added there.
parent 006d7c29
......@@ -623,17 +623,17 @@ rm_o.k_stub2_rm: kernel.s.k_stub2_rm
rm_o_rl.rl_stub_rm: rlib.s.rl_stub_rm
${AS} ${AFLAGS} ${ALFLAGS} -from rlib.s.rl_stub_rm -to $@
lib.stubs: o.cl_stub_r o.k_stub2_r o.cl_stub2_r o.mathl
${AR} ${LIBFLAGS} $@ o.cl_stub_r o.k_stub2_r o.cl_stub2_r o.mathl
lib.stubs: o.cl_stub_r o.k_stub2_r o.cl_stub2_r o.mathl o.mathhf
${AR} ${LIBFLAGS} $@ o.cl_stub_r o.k_stub2_r o.cl_stub2_r o.mathl o.mathhf
lib.rstubs: o_rl.rl_stub_r o.k_stub2_r o.cl_stub2_r o.mathl
${AR} ${LIBFLAGS} $@ o_rl.rl_stub_r o.k_stub2_r o.cl_stub2_r o.mathl
lib.rstubs: o_rl.rl_stub_r o.k_stub2_r o.cl_stub2_r o.mathl o.mathhf
${AR} ${LIBFLAGS} $@ o_rl.rl_stub_r o.k_stub2_r o.cl_stub2_r o.mathl o.mathhf
lib.romcstubs: rm_o.cl_stub_rm rm_o.k_stub2_rm rm_o.cl_stub2_rm o.mathl
${AR} ${LIBFLAGS} $@ rm_o.cl_stub_rm rm_o.k_stub2_rm rm_o.cl_stub2_rm o.mathl
lib.romcstubs: rm_o.cl_stub_rm rm_o.k_stub2_rm rm_o.cl_stub2_rm o.mathl o.mathhf
${AR} ${LIBFLAGS} $@ rm_o.cl_stub_rm rm_o.k_stub2_rm rm_o.cl_stub2_rm o.mathl o.mathhf
lib.romstubs: rm_o_rl.rl_stub_rm rm_o.k_stub2_rm rm_o.cl_stub2_rm o.mathl
${AR} ${LIBFLAGS} $@ rm_o_rl.rl_stub_rm rm_o.k_stub2_rm rm_o.cl_stub2_rm o.mathl
lib.romstubs: rm_o_rl.rl_stub_rm rm_o.k_stub2_rm rm_o.cl_stub2_rm o.mathl o.mathhf
${AR} ${LIBFLAGS} $@ rm_o_rl.rl_stub_rm rm_o.k_stub2_rm rm_o.cl_stub2_rm o.mathl o.mathhf
lib.romastubs: rlib.s.rl_stub_a
${AS} ${AFLAGS} -from rlib.s.rl_stub_a -to $@
......
/* Copyright 1996 Acorn Computers Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* mathhf.c: ANSI draft (X3J11 May 86) library code, section D.5 */
/* Copyright (C) Codemist Ltd, 1988 */
/*
This file contains code for the single precision hyperbolic math routines
which are present in math.c but are missing from SharedCLibrary Stubs.
Unlike mathl, this should not be included in AnsiLib as these routines
are already correctly exported from math.c there.
*/
#include <math.h>
#include <float.h>
#include <fenv.h>
#pragma STDC FENV_ACCESS ON
static float fetidyexceptf(const fenv_t *envp, float x)
{
int exc = fetestexcept(FE_ALL_EXCEPT);
if (exc & (FE_DIVBYZERO|FE_INVALID))
{ if (exc & (FE_UNDERFLOW|FE_OVERFLOW|FE_INEXACT))
feclearexcept(FE_UNDERFLOW|FE_OVERFLOW|FE_INEXACT);
}
else if (exc & FE_UNDERFLOW)
{ /* Got to check for spurious underflow. We are allowed to raise underflow */
/* whenever result is tiny (even if exact), so this is sufficient. */
if (!isless(fabsf(x), FLT_MIN))
feclearexcept(FE_UNDERFLOW);
}
feupdateenv(envp);
return x;
}
/* Simple forms for now */
float coshf(float x)
{
fenv_t env;
feholdexcept(&env);
return fetidyexceptf(&env, (float)cosh(x));
}
float sinhf(float x)
{
fenv_t env;
feholdexcept(&env);
return fetidyexceptf(&env, (float)sinh(x));
}
float tanhf(float x)
{
fenv_t env;
feholdexcept(&env);
return fetidyexceptf(&env, (float)tanh(x));
}
/* end of mathhf.c */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment