minor refactoring
This commit is contained in:
parent
126c104bb3
commit
19e434facb
18 changed files with 138 additions and 115 deletions
|
|
@ -1,6 +1,6 @@
|
|||
package btools.util;
|
||||
|
||||
public final class CheapRulerSingleton {
|
||||
public final class CheapRuler {
|
||||
/**
|
||||
* Cheap-Ruler Java implementation
|
||||
* See
|
||||
24
brouter-util/src/main/java/btools/util/FastMath.java
Normal file
24
brouter-util/src/main/java/btools/util/FastMath.java
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package btools.util;
|
||||
|
||||
/**
|
||||
* Some fast approximations to mathematical functions
|
||||
*
|
||||
* @author ab
|
||||
*/
|
||||
public class FastMath
|
||||
{
|
||||
/**
|
||||
* Approximation to Math.exp for small negative arguments
|
||||
*/
|
||||
public static double exp( double e )
|
||||
{
|
||||
double x = e;
|
||||
double f = 1.;
|
||||
while( e < -1. )
|
||||
{
|
||||
e += 1.;
|
||||
f *= 0.367879;
|
||||
}
|
||||
return f*( 1. + x*( 1. + x * ( 0.5 + x * ( 0.166667 + 0.0416667 * x) ) ) );
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue