View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.statistics.distribution;
18  
19  /**
20   * Constants for distribution calculations.
21   *
22   * <p>Constants should evaluate to the closest IEEE {@code double}.
23   * Expressions may have been computed using an arbitrary precision math
24   * library or obtained from existing online resources.
25   * Some expressions will not be the closest {@code double} if evaluated
26   * using the JDK's Math functions using {@code double} precision.
27   */
28  final class Constants {
29      /** sqrt(2). https://oeis.org/A002193. */
30      static final double ROOT_TWO        = 1.4142135623730951;
31      /** sqrt(2 / pi). https://oeis.org/A076668. */
32      static final double ROOT_TWO_DIV_PI = 0.7978845608028654;
33      /** sqrt(pi / 2). https://oeis.org/A069998. */
34      static final double ROOT_PI_DIV_TWO = 1.2533141373155003;
35      /** ln(2). https://oeis.org/A002162. */
36      static final double LN_TWO          = 0.6931471805599453;
37      /** 0.5 * ln(2 pi). https://oeis.org/A075700. */
38      static final double HALF_LOG_TWO_PI = 0.9189385332046728;
39  
40      /** No instances. */
41      private Constants() {}
42  }