Java Number Minus minusPIO2(final double angRad)

Here you can find the source of minusPIO2(final double angRad)

Description

minus PIO

License

Open Source License

Parameter

Parameter Description
angRad An angle, in radians.

Return

angRad - PI/2, accurately computed.

Declaration

public static double minusPIO2(final double angRad) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static final double PIO2_HI = Double.longBitsToDouble(0x3FF921FB54400000L);
    private static final double PIO2_LO = Double.longBitsToDouble(0x3DD0B4611A626331L);

    /**/*  w  w  w  .  jav  a 2 s  . co m*/
     * @param angRad
     *            An angle, in radians.
     * @return angRad - PI/2, accurately computed.
     */
    public static double minusPIO2(final double angRad) {
        if (angRad < Math.PI / 4) {
            // LO then HI, for better accuracy (if starting near 0).
            return angRad - PIO2_LO - PIO2_HI;
        } else {
            // HI then LO, for better accuracy (if ending near 0).
            return angRad - PIO2_HI - PIO2_LO;
        }
    }
}

Related

  1. minusEquals(int[] vals, int min)
  2. minusEqualsInverse(double[] w, double[] v, double a)
  3. minusExact(final int a, final int b)
  4. minusExact(long a, long b)
  5. minusPercent(float maxValue, float minusValue)