Java Utililty Methods atan

List of utility methods to do atan

Description

The list of methods to do atan are organized into topic(s).

Method

doubleatan(double a)
Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
return Math.atan(a);
doubleatan(double a)
Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
double w, s1, s2, z;
int id;
long hx = Double.doubleToLongBits(a);
long ix = hx & no_sign_mask;
if (ix >= 0x4410000000000000L) {
    if (ix > exp_mask) {
        return (a + a);
    if (hx > 0)
        return (atanhi[3] + atanlo[3]);
    else
        return (-atanhi[3] - atanlo[3]);
if (ix < 0x3fdc000000000000L) {
    if (ix < 0x3e20000000000000L) {
        return (a);
    id = -1;
} else {
    a = Math.abs(a);
    if (ix < 0x3ff3000000000000L) {
        if (ix < 0x3fe6000000000000L) {
            id = 0;
            a = (2.0 * a - 1.0) / (2.0 + a);
        else {
            id = 1;
            a = (a - 1.0) / (a + 1.0);
    } else {
        if (ix < 0x4003800000000000L) {
            id = 2;
            a = (a - 1.5) / (1.0 + 1.5 * a);
        } else {
            id = 3;
            a = -1.0 / a;
z = a * a;
w = z * z;
s1 = z * (aT[0] + w * (aT[2] + w * (aT[4] + w * (aT[6] + w * (aT[8] + w * aT[10])))));
s2 = w * (aT[1] + w * (aT[3] + w * (aT[5] + w * (aT[7] + w * aT[9]))));
if (id < 0)
    return (a - a * (s1 + s2));
else {
    z = atanhi[id] - ((a * (s1 + s2) - atanlo[id]) - a);
    if (hx < 0)
        return (-z);
    else
        return (z);
doubleatan(double arg)
atan
if (arg > 0) {
    return msatan(arg);
return -msatan(-arg);
doubleatan(double x)
Approximates the atan function.
double res;
if (Math.abs(x) < 1) {
    res = x / (1 + 0.28 * x * x);
} else {
    if (x < 0.0) {
        x = -x;
        res = (Math.PI / 2 - x / (x * x + 0.28));
        res = -res;
...
floatatan(float tan_value)
atan
if (tan_value < -32f) {
    return -1.54f;
} else if (tan_value > 32f) {
    return 1.54f;
} else {
    return atan_table[(int) ((tan_value + 32f) * accuracy_level / 64f)];
floatatan(float value)
atan
return (float) Math.atan(value);
floatatan(float x)
Arctan
boolean signChange = false;
boolean Invert = false;
int sp = 0;
float x2, a;
if (x < 0.) {
    x = -x;
    signChange = true;
if (x > 1.) {
    x = 1 / x;
    Invert = true;
while (x > (float) Math.PI / 12) {
    sp++;
    a = x + SQRT3;
    a = 1 / a;
    x = x * SQRT3;
    x = x - 1;
    x = x * a;
x2 = x * x;
a = x2 + 1.4087812f;
a = 0.55913709f / a;
a = a + 0.60310579f;
a = a - (x2 * 0.05160454f);
a = a * x;
while (sp > 0) {
    a = a + (float) Math.PI / 6;
    sp--;
if (Invert)
    a = (float) Math.PI / 2 - a;
if (signChange)
    a = -a;
return a;
intatan(int f)
atan
int sqr = mul(f, f);
int result = 1365;
result = mul(result, sqr);
result -= 5579;
result = mul(result, sqr);
result += 11805;
result = mul(result, sqr);
result -= 21646;
...
doubleatan(Integer a)
Atan.
return Math.atan(a.doubleValue());
doubleatan(Number x)
atan
return Math.atan(x.doubleValue());