math.jwave.tools
Class AncientEgyptianMultiplication
- java.lang.Object
-
- math.jwave.tools.AncientEgyptianMultiplication
-
public class AncientEgyptianMultiplication extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor and Description AncientEgyptianMultiplication()Some how useless ~8>
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intcompose(int[] ancientEgyptianMultipliers)The method converts a list of ancient Egyptian multipliers to the corresponding integer.int[]decompose(int number)The method converts a positive integer to the ancient Egyptian multipliers which are actually the multipliers to display the number by a sum of the largest possible powers of two.intgetExponent(double f)Replaced Math.getExponent due to google's Android OS is not supporting it in Math library.doublescalb(double f, int scaleFactor)Replaced Math.scalb due to google's Android OS is not supporting it in Math library.
-
-
-
Constructor Detail
-
AncientEgyptianMultiplication
public AncientEgyptianMultiplication()
Some how useless ~8>
-
-
Method Detail
-
decompose
public int[] decompose(int number) throws JWaveExceptionThe method converts a positive integer to the ancient Egyptian multipliers which are actually the multipliers to display the number by a sum of the largest possible powers of two. E.g. 42 = 2^5 + 2^3 + 2^1 = 32 + 8 + 2. However, odd numbers always 2^0 = 1 as the last entry. Also see: http://en.wikipedia.org/wiki/Ancient_Egyptian_multiplication- Parameters:
number-- Returns:
- Throws:
JWaveException
-
compose
public int compose(int[] ancientEgyptianMultipliers) throws JWaveExceptionThe method converts a list of ancient Egyptian multipliers to the corresponding integer. The ancient Egyptian multipliers are actually the multipliers to display am integer by a sum of the largest possible powers of two. E.g. 42 = 2^5 + 2^3 + 2^1 = 32 + 8 + 2. Also see: http://en.wikipedia.org/wiki/Ancient_Egyptian_multiplication- Parameters:
ancientEgyptianMultipliers- an integer array keeping the ancient Egyptian multipliers- Returns:
- resulting integer as sum of powers of two
- Throws:
JWaveException
-
getExponent
public int getExponent(double f)
Replaced Math.getExponent due to google's Android OS is not supporting it in Math library.- Parameters:
f-- Returns:
- p of 2^p <= f < 2^(p+1)
-
scalb
public double scalb(double f, int scaleFactor)Replaced Math.scalb due to google's Android OS is not supporting it in Math library.- Parameters:
f-scaleFactor-- Returns:
- f times 2^(scaleFactor)
-
-
DMelt 3.0 © DataMelt by jWork.ORG