Skip to content

This library provides Math for string variables and can do arithmetic operations for very long numbers

License

Notifications You must be signed in to change notification settings

aalitor/StringMath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StringMath

This library provides Math for string variables and can do arithmetic operations for very long numbers Supports negative numbers, decimal operations and you can set how many decimal points you want in division operations Examples:

"7239472981274798.87239459279872".Multiply("17723857239874.1482375987239") = "128311385612040627990484885784.177537750009676796001553408"

"7239472981274798.87239459279872".Sum("17723857239874.1482375987239") = "7257196838514673.02063219152262"

"17723857239874.87239459279872".Minus("7239472981274798.1482375987239" = "-7221749124034923.27584300592518"

"17723857239874.87239459279872".Divide("7239472981274798.1482375987239", 100) = "0.0024482247928431221193959077254621363728526057698349342478908952045545664010797198416962326310985737"

Factorial can be calculated for any number:

public static string Factorial(this string num) { if (num.Sign() == 0 || num.FixNumber() == "1") return "1";

return num.Multiply(num.Minus("1", true).Factorial());

}

100! = "257182031095525112107857249934597388918419224714455526533820998388496472644482792132224051962512451185663850090463028434334174412800000000000000000000000"

About

This library provides Math for string variables and can do arithmetic operations for very long numbers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages