https://github.com/malinduliyanage/mathssdk_dotnet_package
A Simple NuGet package for basic Maths
https://github.com/malinduliyanage/mathssdk_dotnet_package
csharp dotnet nuget-package
Last synced: 3 months ago
JSON representation
A Simple NuGet package for basic Maths
- Host: GitHub
- URL: https://github.com/malinduliyanage/mathssdk_dotnet_package
- Owner: MalinduLiyanage
- License: mit
- Created: 2025-07-02T08:54:17.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-07-02T12:01:20.000Z (3 months ago)
- Last Synced: 2025-07-02T13:22:14.969Z (3 months ago)
- Topics: csharp, dotnet, nuget-package
- Language: C#
- Homepage: https://www.nuget.org/packages/MalinduLiyanage.MathsSdk
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Maths SDK
A simple .NET SDK providing basic mathematical operations.
## NuGet Reference
```csharp
dotnet add package MalinduLiyanage.MathsSdk --version 1.0.0
```## Package Info
| Property | Value |
| ---------------- | ------------------------ |
| Target Framework | .NET 8.0 |
| Package ID | MalinduLiyanage.MathsSdk |
| Version | 1.0.0 |
| Author | Malindu Liyanage |
| Product | Maths SDK |---
## Calculator Class
Provides basic arithmetic and advanced mathematical operations.
### Usage Example
```csharp
var calculator = new Calculator();int sum = calculator.Add(3, 5); // 8
int diff = calculator.Subtract(10, 4); // 6
int product = calculator.Multiply(7, 6); // 42
double quotient = calculator.Divide(10, 2); // 5.0
double power = calculator.Power(2, 3); // 8.0
double root = calculator.SquareRoot(16); // 4.0
long fact = calculator.Factorial(5); // 120
```---
### Methods
#### `int Add(int a, int b)`
Returns the sum of two integers.
* **Parameters:**
* `a`: First integer.
* `b`: Second integer.
* **Returns:** Sum of `a` and `b`.---
#### `int Subtract(int a, int b)`
Returns the difference between two integers (`a - b`).
* **Parameters:**
* `a`: First integer.
* `b`: Second integer.
* **Returns:** Result of `a - b`.---
#### `int Multiply(int a, int b)`
Returns the product of two integers.
* **Parameters:**
* `a`: First integer.
* `b`: Second integer.
* **Returns:** Product of `a` and `b`.---
#### `double Divide(double a, double b)`
Returns the quotient of two doubles (`a / b`).
* **Parameters:**
* `a`: Numerator.
* `b`: Denominator.
* **Returns:** Result of division.
* **Throws:** `DivideByZeroException` if `b` is zero.---
#### `double Power(double a, double b)`
Calculates `a` raised to the power of `b`.
* **Parameters:**
* `a`: Base.
* `b`: Exponent.
* **Returns:** `a` to the power of `b`.---
#### `double SquareRoot(double a)`
Calculates the square root of a number.
* **Parameters:**
* `a`: Number to find the square root of.
* **Returns:** Square root of `a`.
* **Throws:** `ArgumentException` if `a` is negative.---
#### `long Factorial(int n)`
Calculates the factorial of a non-negative integer `n`.
* **Parameters:**
* `n`: Number to calculate factorial for.
* **Returns:** Factorial of `n`.
* **Throws:** `ArgumentException` if `n` is negative.