001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.numbers.gamma;
018
019/**
020 * Inverse of the <a href="http://mathworld.wolfram.com/Erfc.html">complementary error function</a>.
021 * <p>
022 * This implementation is described in the paper:
023 * <a href="http://people.maths.ox.ac.uk/gilesm/files/gems_erfinv.pdf">Approximating
024 * the erfinv function</a> by Mike Giles, Oxford-Man Institute of Quantitative Finance,
025 * which was published in GPU Computing Gems, volume 2, 2010.
026 * The source code is available <a href="http://gpucomputing.net/?q=node/1828">here</a>.
027 * </p>
028 */
029public final class InverseErfc {
030    /** Private constructor. */
031    private InverseErfc() {
032        // intentional empty.
033    }
034
035    /**
036     * Returns the inverse complementary error function.
037     *
038     * @param x Value.
039     * @return t such that {@code x =} {@link Erfc#value(double) Erfc.value(t)}.
040     */
041    public static double value(double x) {
042        return InverseErf.value(1 - x);
043    }
044}