this repo has no description
1
2/*
3 * erfcf.c
4 *
5 * by Ian Ollmann
6 *
7 * Copyright (c) 2007, Apple Inc. All Rights Reserved.
8 */
9
10#include <math.h>
11#include <stdint.h>
12#include "erf.h"
13
14float erfcf( float x )
15{
16 union{ float d; uint32_t u;} u = { x };
17
18
19 //Inf, NaN, 0
20 if( (u.u & 0x7fffffffU) - 1U >= 0x7f800000U - 1U )
21 {
22 if( 0.0f == x )
23 return 1.0f;
24
25 if( x != x )
26 return x + x;
27
28 u.u = 0x3f800000U | (u.u & 0x80000000U);
29 return 1.0f - u.d;
30 }
31
32 float result = (float) ErrFunApprox( (double) x, 0.0, 1 );
33
34 if( x < 0.0f )
35 return 2.0f - result;
36
37 return result;
38}