The following are fields for Math.
public static final Double PI
Type: Double
The following are methods for Math. All methods are static.
public static Decimal atan2(Decimal xCoordinate, Decimal yCoordinate)
Type: Decimal
public static Double atan2(Double xCoordinate, Double yCoordinate)
Type: Double
public static Decimal max(Decimal decimalValue1, Decimal decimalValue2)
Type: Decimal
Decimal larger = math.max(12.3, 156.6);
system.assertEquals(larger, 156.6);
public static Decimal min(Decimal decimalValue1, Decimal decimalValue2)
Type: Decimal
Decimal smaller = math.min(12.3, 156.6);
system.assertEquals(smaller, 12.3);
public static Integer mod(Integer integerValue1, Integer integerValue2)
Type: Integer
Integer remainder = math.mod(12, 2); system.assertEquals(remainder, 0); Integer remainder2 = math.mod(8, 3); system.assertEquals(remainder2, 2);
public static Double random()
Type: Double
public static Integer round(Double doubleValue)
Type: Integer
public static Integer round(Decimal decimalValue)
Type: Integer
Note that this rounding mode statistically minimizes cumulative error when applied repeatedly over a sequence of calculations.
Decimal d1 = 4.5; Integer i1 = Math.round(d1); System.assertEquals(4, i1); Decimal d2 = 5.5; Integer i2 = Math.round(d2); System.assertEquals(6, i2);
public static Long roundToLong(Decimal decimalValue)
Type: Long
Note that this rounding mode statistically minimizes cumulative error when applied repeatedly over a sequence of calculations.
Decimal d1 = 4.5; Long i1 = Math.roundToLong(d1); System.assertEquals(4, i1); Decimal d2 = 5.5; Long i2 = Math.roundToLong(d2); System.assertEquals(6, i2);
public static Decimal tanh(Decimal decimalAngle)
Type: Decimal
public static Double tanh(Double doubleAngle)
Type: Double