src/libm/s_atan.c
changeset 8004 13da154af020
parent 6044 35448a5ea044
child 8056 abd9434c5d3e
     1.1 --- a/src/libm/s_atan.c	Sat Nov 16 21:52:56 2013 -0500
     1.2 +++ b/src/libm/s_atan.c	Sat Nov 16 18:56:02 2013 -0800
     1.3 @@ -112,3 +112,29 @@
     1.4  	}
     1.5  }
     1.6  libm_hidden_def(atan)
     1.7 +
     1.8 +double SDL_acos(double val)
     1.9 +{
    1.10 +    double result;
    1.11 +    if (val == -1.0) {
    1.12 +        result = M_PI;
    1.13 +    } else {
    1.14 +        result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
    1.15 +        if (result < 0.0)
    1.16 +        {
    1.17 +            result += M_PI;
    1.18 +        }
    1.19 +    }
    1.20 +    return result;
    1.21 +}
    1.22 +
    1.23 +double SDL_asin(double val)
    1.24 +{
    1.25 +    double result;
    1.26 +    if (val == -1.0) {
    1.27 +        result = -(M_PI / 2.0);
    1.28 +    } else {
    1.29 +        result = (M_PI / 2.0) - SDL_acos(val);
    1.30 +    }
    1.31 +    return result;
    1.32 +}