org.apfloat.calc

## Interface CalculatorImpl

• ### Method Summary

All Methods
Modifier and Type Method and Description
`Number` ```add(Number x, Number y)```
`Number` ```divide(Number x, Number y)```
Division.
`String` `format(Number x)`
Convert a number to a String.
`Number` ```function(String name, List<Number> arguments)```
Arbitrary function.
`Number` `getVariable(String name)`
Get a variable.
`Number` ```mod(Number x, Number y)```
Remainder.
`Number` ```multiply(Number x, Number y)```
Multiplication.
`Number` `negate(Number x)`
Negative value.
`Number` `parseDecimal(String value)`
Parse a string to a floating-point number.
`Number` `parseInteger(String value)`
Parse a string to an integer number.
`Number` ```pow(Number x, Number y)```
Power.
`void` `setFormat(boolean pretty)`
Set the formatting option.
`void` ```setVariable(String name, Number value)```
Set a variable.
`Number` ```subtract(Number x, Number y)```
Subtraction.
• ### Method Detail

• #### negate

```Number negate(Number x)
throws ParseException```
Negative value.
Parameters:
`x` - The argument.
Returns:
`-x`
Throws:
`ParseException` - In case of invalid argument.

```Number add(Number x,
Number y)
throws ParseException```
Parameters:
`x` - First argument.
`y` - Second argument.
Returns:
`x + y`
Throws:
`ParseException` - In case of invalid arguments.
• #### subtract

```Number subtract(Number x,
Number y)
throws ParseException```
Subtraction.
Parameters:
`x` - First argument.
`y` - Second argument.
Returns:
`x - y`
Throws:
`ParseException` - In case of invalid arguments.
• #### multiply

```Number multiply(Number x,
Number y)
throws ParseException```
Multiplication.
Parameters:
`x` - First argument.
`y` - Second argument.
Returns:
`x * y`
Throws:
`ParseException` - In case of invalid arguments.
• #### divide

```Number divide(Number x,
Number y)
throws ParseException```
Division.
Parameters:
`x` - First argument.
`y` - Second argument.
Returns:
`x / y`
Throws:
`ParseException` - In case of invalid arguments.
• #### mod

```Number mod(Number x,
Number y)
throws ParseException```
Remainder.
Parameters:
`x` - First argument.
`y` - Second argument.
Returns:
`x % y`
Throws:
`ParseException` - In case of invalid arguments.
• #### pow

```Number pow(Number x,
Number y)
throws ParseException```
Power.
Parameters:
`x` - First argument.
`y` - Second argument.
Returns:
`xy`
Throws:
`ParseException` - In case of invalid arguments.
• #### function

```Number function(String name,
List<Number> arguments)
throws ParseException```
Arbitrary function.
Parameters:
`name` - Name of the function.
`arguments` - Function arguments.
Returns:
Function value.
Throws:
`ParseException` - In case of invalid arguments.
• #### parseInteger

```Number parseInteger(String value)
throws ParseException```
Parse a string to an integer number.
Parameters:
`value` - The string to parse.
Returns:
The number.
Throws:
`ParseException` - In case of invalid number.
• #### parseDecimal

```Number parseDecimal(String value)
throws ParseException```
Parse a string to a floating-point number.
Parameters:
`value` - The string to parse.
Returns:
The number.
Throws:
`ParseException` - In case of invalid number.
• #### getVariable

```Number getVariable(String name)
throws ParseException```
Get a variable.
Parameters:
`name` - Name of the variable.
Returns:
Value of the variable, or `null` if the variable is not defined.
Throws:
`ParseException` - In case of invalid argument.
• #### setVariable

```void setVariable(String name,
Number value)
throws ParseException```
Set a variable.
Parameters:
`name` - Name of the variable.
`value` - Value of the variable.
Throws:
`ParseException` - In case of invalid arguments.
• #### setFormat

`void setFormat(boolean pretty)`
Set the formatting option.
Parameters:
`pretty` - If a fixed-point or a floating-point notation should be used.
• #### format

`String format(Number x)`
Convert a number to a String. The current formatting option is used.
Parameters:
`x` - The number.
Returns:
The String.