OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [machine/] [i386/] [f_expf.c] - Blame information for rev 862

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/*
2
 * ====================================================
3
 * Copyright (C) 1998, 2002 by Red Hat Inc. All rights reserved.
4
 *
5
 * Permission to use, copy, modify, and distribute this
6
 * software is freely granted, provided that this notice
7
 * is preserved.
8
 * ====================================================
9
 */
10
 
11
#if !defined(_SOFT_FLOAT)
12
 
13
/*
14
Fast version of exp using Intel float instructions.
15
 
16
   float _f_expf (float x);
17
 
18
Function computes e ** x.  The following special cases exist:
19
   1. if x is 0.0 ==> return 1.0
20
   2. if x is infinity ==> return infinity
21
   3. if x is -infinity ==> return 0.0
22
   4. if x is NaN ==> return x
23
There is no error checking or setting of errno.
24
*/
25
 
26
 
27
#include <math.h>
28
#include <ieeefp.h>
29
#include "f_math.h"
30
 
31
float _f_expf (float x)
32
{
33
   if (check_finitef(x))
34
     {
35
       float result;
36
       asm ("fldl2e; fmulp; fld %%st; frndint; fsub %%st,%%st(1); fxch;" \
37
          "fchs; f2xm1; fld1; faddp; fxch; fld1; fscale; fstp %%st(1); fmulp" :
38
          "=t"(result) : "0"(x));
39
       return result;
40
     }
41
   else if (x == -infinityf())
42
     return 0.0;
43
 
44
   return x;
45
}
46
 
47
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.