Operations with Doubles
This static class contains methods and properties to expose common operations to work with double
types.
All members bellow returns the corresponding functions as delegates.
WARNING
All operations classes related to numerical values (
int
,decimal
edouble
) contains the same properties and methods.
Properties
Name | Type | Description |
Add | Func<double, double, double> | Function to represents addition operation (+) between two values. |
Subtract | Func<double, double, double> | Function to represents subtraction operation (-) between two values. |
Multiply | Func<double, double, double> | Function to represents multiplication operation (*) between two values. |
Divide | Func<double, double, double> | Function to represents division operation (/) between two values. |
Add3 | Func<double, double, double, double> | Function to represents addition operation (+) between three values. |
Subtract3 | Func<double, double, double, double> | Function to represents subtraction operation (-) between three values. |
Multiply3 | Func<double, double, double, double> | Function to represents multiplication operation (*) between three values. |
Divide3 | Func<double, double, double, double> | Function to represents division operation (/) between three values. |
Methods
Name | Parameters | Returns | Description |
AddWith | double value | Func<double, double> | Function to represents addition operation (+) between two values, applying first value as partial application on Add method. |
SubtractWith | double value | Func<double, double> | Function to represents subtraction operation (-) between two values, applying first value as partial application on Subtract method. |
MultiplyWith | double value | Func<double, double> | Function to represents multiplication operation (*) between two values, applying first value as partial application on Multiply method. |
DivideWith | double value | Func<double, double> | Function to represents multiplication operation (/) between two values, applying first value as partial application on Divide method. |
Add3With | double value | Func<double, double, double> | Function to represents addition operation (+) between three values, applying first value as partial application on Add3 method. |
Add3With | double value double value2 | Func<double, double> | Function to represents addition operation (+) between three values, applying first and second values as partial application on Add3 method. |
Subtract3With | double value | Func<double, double, double> | Function to represents subtraction operation (-) between three values, applying first value as partial application on Subtract3 method. |
Subtract3With | double value double value2 | Func<double, double> | Function to represents subtraction operation (-) between three values, applying first and second values as partial application on Subtract3 method. |
Multiply3With | double value | Func<double, double, double> | Function to represents multiplication operation (*) between three values, applying first value as partial application on Multiply3 method. |
Multiply3With | double value doublevalue2 | Func<double, double> | Function to represents multiplication operation (*) between three values, applying first and second values as partial application on Multiply3 method. |
Divide3With | double value | Func<double, double, double> | Function to represents division operation (/) between three values, applying first value as partial application on Divide3 method. |
Divide3With | double value double value2 | Func<double, double> | Function to represents division operation (/) between three values, applying first and second values as partial application on Divide3 method. |
Usage
The properties returns a delegate, so, it's possible to use it as a method.
Add
Subtract
Multiply
Divide
For methods you can use a little different sintax. It's necessary because these methods uses the property methods combined with Partial Application.
Because of that, you need to execute the method with the first parameter to creates a new single parameter function that perform the operation.
AddWith
You can also use it as a chainable operation:
The ~With operations are available to the four main operations, all of them follows the same caracteristics that the previous example.
You can use these methods as Partial Applications if you needs to.
Add3With
You can also use it as a chainable operation:
You can use the two parameters overload as well:
Last updated