TypedMath 1.0.8

A different way to do calculations, helpful when dealing with Dyscalculia.

Install-Package TypedMath -Version 1.0.8
dotnet add package TypedMath --version 1.0.8
<PackageReference Include="TypedMath" Version="1.0.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TypedMath --version 1.0.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Typed Math

Sometimes when working with calculations I tend to get a touch of Dyscalculia. That is why I loved Visual Basic in the 90s.
It had descriptive code, and VB.net does still have it. But I prefer to work with C#. Though I do miss some functions from time to time.
To avoid visits from the ghost of Dyscalculia I created this project.
At first it seemed like a pretty meaningless project, but soon I realised this could be useful. So, I made it a NuGet.
It's all extensions to number types.

LinQ is great and it does offer a lot of ways to make the code more readable, if you use LinQ I see no reason why you should need this package.

Instead of writing

var x = 10 * 32 + y;

you can write

var x = 10.MultipliedWith(32).Add(y);

The package contains namespaces for the most common data types in Visual Studio.

To use the extensions, use any of the namespaces

using MarcusMedinaPro.TypedMath.ByteExtension; // Bytes
using MarcusMedinaPro.TypedMath.CharExtension; // Char
using MarcusMedinaPro.TypedMath.DecimalExtension; // Decimal
using MarcusMedinaPro.TypedMath.DoubleExtension; // Double
using MarcusMedinaPro.TypedMath.IntExtension; // Int
using MarcusMedinaPro.TypedMath.LongExtension; // Long
using MarcusMedinaPro.TypedMath.SByteExtension; // SByte
using MarcusMedinaPro.TypedMath.ShortExtension; // Short
using MarcusMedinaPro.TypedMath.UintExtension; // Uint
using MarcusMedinaPro.TypedMath.UlongExtension; //Ulong
using MarcusMedinaPro.TypedMath.UshorttExtension; //Ushort

Most of the functions have automatic casting from one to another, so you can work with mixed doubles and floats and ints if you want.

Disclaimer

This project is nothing magical most of the functions are one-liners. The idea is not to create special functions, but to make the code easier to read. If you're a hardcore coder that love to minimize your code, this is not for you. But if you feel like you want code that will be easy to read, this might help.

Changes

  • 10190603 - Added array handlers
  • 20190524 - Added Percent, Highest, Lowest, Swap
  • 20190526 - Renamed ChoseHighestValue/ChoseLowestValue to ChoseHighestValueOf/ChoseLowestValueOf. Added SetHighestValueOf/SetLowestValueOf. Swap uses reference now
  • 20190529 - Corrected misspelling in Subtract and added Obsolete tag to the misspelled method. Renamed ChoseHighest/Lowest to ChooseIfHigher/ChooseIfLower

Source code

You can find the code at https://github.com/MarcusMedina/TypedMath

NuGet

The NuGet is available at https://www.nuget.org/packages/TypedMath/

Collaboration

Feel free to add, suggest or request a feature. If you want to help develop this NuGet, feel free to send a Pull Request.

Borrowed code

  • LinQ Prime numbers, Zoran Horvat: http://www.codinghelmet.com/articles/linq-all-primes/
  • Increase/Decrease array values, mgp (https://stackoverflow.com/users/55943/mqp ) @ https://stackoverflow.com/a/823537

Borrowed Icons

  • The icon is GPL from http://www.iconarchive.com/show/ios7-icons-by-icons8/Science-Math-icon.html.

Cheers.
Marcus

Typed Math

Sometimes when working with calculations I tend to get a touch of Dyscalculia. That is why I loved Visual Basic in the 90s.
It had descriptive code, and VB.net does still have it. But I prefer to work with C#. Though I do miss some functions from time to time.
To avoid visits from the ghost of Dyscalculia I created this project.
At first it seemed like a pretty meaningless project, but soon I realised this could be useful. So, I made it a NuGet.
It's all extensions to number types.

LinQ is great and it does offer a lot of ways to make the code more readable, if you use LinQ I see no reason why you should need this package.

Instead of writing

var x = 10 * 32 + y;

you can write

var x = 10.MultipliedWith(32).Add(y);

The package contains namespaces for the most common data types in Visual Studio.

To use the extensions, use any of the namespaces

using MarcusMedinaPro.TypedMath.ByteExtension; // Bytes
using MarcusMedinaPro.TypedMath.CharExtension; // Char
using MarcusMedinaPro.TypedMath.DecimalExtension; // Decimal
using MarcusMedinaPro.TypedMath.DoubleExtension; // Double
using MarcusMedinaPro.TypedMath.IntExtension; // Int
using MarcusMedinaPro.TypedMath.LongExtension; // Long
using MarcusMedinaPro.TypedMath.SByteExtension; // SByte
using MarcusMedinaPro.TypedMath.ShortExtension; // Short
using MarcusMedinaPro.TypedMath.UintExtension; // Uint
using MarcusMedinaPro.TypedMath.UlongExtension; //Ulong
using MarcusMedinaPro.TypedMath.UshorttExtension; //Ushort

Most of the functions have automatic casting from one to another, so you can work with mixed doubles and floats and ints if you want.

Disclaimer

This project is nothing magical most of the functions are one-liners. The idea is not to create special functions, but to make the code easier to read. If you're a hardcore coder that love to minimize your code, this is not for you. But if you feel like you want code that will be easy to read, this might help.

Changes

  • 10190603 - Added array handlers
  • 20190524 - Added Percent, Highest, Lowest, Swap
  • 20190526 - Renamed ChoseHighestValue/ChoseLowestValue to ChoseHighestValueOf/ChoseLowestValueOf. Added SetHighestValueOf/SetLowestValueOf. Swap uses reference now
  • 20190529 - Corrected misspelling in Subtract and added Obsolete tag to the misspelled method. Renamed ChoseHighest/Lowest to ChooseIfHigher/ChooseIfLower

Source code

You can find the code at https://github.com/MarcusMedina/TypedMath

NuGet

The NuGet is available at https://www.nuget.org/packages/TypedMath/

Collaboration

Feel free to add, suggest or request a feature. If you want to help develop this NuGet, feel free to send a Pull Request.

Borrowed code

  • LinQ Prime numbers, Zoran Horvat: http://www.codinghelmet.com/articles/linq-all-primes/
  • Increase/Decrease array values, mgp (https://stackoverflow.com/users/55943/mqp ) @ https://stackoverflow.com/a/823537

Borrowed Icons

  • The icon is GPL from http://www.iconarchive.com/show/ios7-icons-by-icons8/Science-Math-icon.html.

Cheers.
Marcus

Release Notes

First release

Dependencies

This package has no dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.8 105 8/8/2019
1.0.6 113 5/29/2019
1.0.3 104 5/23/2019
1.0.2 108 5/14/2019
1.0.1 108 5/14/2019