minor refactoring

This commit is contained in:
Arndt Brenschede 2019-04-17 11:33:07 +02:00
parent 126c104bb3
commit 19e434facb
18 changed files with 138 additions and 115 deletions

View file

@ -1,6 +1,6 @@
package btools.util;
public final class CheapRulerSingleton {
public final class CheapRuler {
/**
* Cheap-Ruler Java implementation
* See

View 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) ) ) );
}
}