forked from luyan/epmet-cloud-lingshan
				
			
				 20 changed files with 103 additions and 46 deletions
			
			
		@ -1,17 +1,30 @@ | 
				
			|||||
package com.epmet.stats.test.normalizing; | 
					package com.epmet.stats.test.normalizing; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import java.math.BigDecimal; | 
				
			||||
 | 
					import java.math.RoundingMode; | 
				
			||||
 | 
					
 | 
				
			||||
public class MathUtilTest { | 
					public class MathUtilTest { | 
				
			||||
    public static void main(String[] args) { | 
					    public static void main(String[] args) { | 
				
			||||
 | 
					        //值 域:(-π/2,π/2)  ->(60,100)
 | 
				
			||||
        double tan = Math.atan(4); | 
					        double tan = Math.atan(4); | 
				
			||||
        double tan2 = Math.atan(1); | 
					        double tan2 = Math.atan(1); | 
				
			||||
        double tan3 = Math.atan(8); | 
					        double tan3 = Math.atan(8); | 
				
			||||
        double tan4 = Math.atan(3); | 
					        double tan4 = Math.atan(1000); | 
				
			||||
 | 
					        double min = 60; | 
				
			||||
 | 
					        double max = 100; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        System.out.println(tan * ((max - min) / (Math.PI / 2)) + min); | 
				
			||||
 | 
					        System.out.println(tan2 * ((max - min) / (Math.PI / 2)) + min); | 
				
			||||
 | 
					        System.out.println(tan3 * ((max - min) / (Math.PI / 2)) + min); | 
				
			||||
 | 
					        System.out.println(tan4 * ((max - min) / (Math.PI / 2)) + min); | 
				
			||||
 | 
					
 | 
				
			||||
        System.out.println((tan / Math.PI)); | 
					        BigDecimal maxValue = new BigDecimal(100); | 
				
			||||
        System.out.println((tan2 / Math.PI)); | 
					        BigDecimal minValue = new BigDecimal(60); | 
				
			||||
        System.out.println((tan3 / Math.PI)); | 
					        BigDecimal normalizeValue = new BigDecimal(Math.atan(new Double("0"))) | 
				
			||||
        System.out.println((tan4 / Math.PI * 200)); | 
					                .multiply( | 
				
			||||
 | 
					                        (maxValue.subtract(minValue).divide(new BigDecimal(Math.PI / 2), 10, RoundingMode.HALF_UP))).add(minValue).setScale(6, RoundingMode.HALF_UP); | 
				
			||||
 | 
					        System.out.println(normalizeValue); | 
				
			||||
 | 
					        //new BigDecimal(Math.atan(new Double(vo.getSampleValue().toString())) / Math.PI * 100).setScale(6, RoundingMode.HALF_UP);
 | 
				
			||||
    } | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
} | 
					} | 
				
			||||
 | 
				
			|||||
					Loading…
					
					
				
		Reference in new issue