From 4a65e2d4149a61632f9b31fff8aaddd0187681dd Mon Sep 17 00:00:00 2001 From: Mark Guerra Date: Thu, 25 May 2017 11:17:23 -0400 Subject: [PATCH] Fix README formatting --- README.md | 93 ++++++++++++++++++++++++------------------------------- 1 file changed, 40 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index e494949..dbdd2e9 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Then, simply include the header file in whichever file you need a BigNumber and `#include "bignumber.h"` ## Usage -###`BigNumber(string)` +### `BigNumber(string)` You can also use the `=` operator to set a BigNumber equal to an existing BigNumber, a number, or @@ -34,203 +34,190 @@ Examples: BigNumber h(22); //BigNumber h is created with value 22. -##Methods -###`add(BigNumber other)` +## Methods +### `add(BigNumber other)` Adds another BigNumber to the current instance `BigNumber("4").add(BigNumber("20")) => BigNumber("24")` -###`subtract(BigNumber other)` +### `subtract(BigNumber other)` Subtracts another BigNumber from the current instance `BigNumber("30").subtract(BigNumber("45")) => BigNumber("-15")` -###`multiply(BigNumber other)` +### `multiply(BigNumber other)` Multiplies the BigNumber by another BigNumber `BigNumber("12").multiply(BigNumber("4")) => BigNumber("48")` -###`divide(BigNumber other)` +### `divide(BigNumber other)` Divides the BigNumber by another BigNumber `BigNumber("30").divide(BigNumber("5")) => BigNumber("6")` -###`pow(int exponent)` +### `pow(int exponent)` Raises the BigNumber to the power of the exponent `BigNumber("2").pow(3) => BigNumber("8")` -###`getString()` +### `getString()` Returns the BigNumber as an std::string `BigNumber("3824").getString() => "3824"` -###`setString(std::string newStr)` +### `setString(std::string newStr)` Sets the BigNumber's internal number string to a new string `BigNumber("2847").setString("38") => BigNumber("38")` -###`negate()` +### `negate()` Changes the sign of the BigNumber BigNumber("3").negate() => BigNumber("-3") BigNumber("-27").negate() => BigNumber("27") -###`equals(BigNumber other)` +### `equals(BigNumber other)` Checks if the other BigNumber is equal to this one `BigNumber("24").equals(BigNumber("28")) => false` -###`digits()` +### `digits()` Returns the number of digits in the BigNumber `BigNumber("28374").digits() => 5` -###`isNegative()` +### `isNegative()` Determines whether a BigNumber is negative `BigNumber("-278").isNegative() => true` -###`isPositive()` +### `isPositive()` Determines whether a BigNumber is positive `BigNumber("-3").isPositive() => false` -###`isEven()` +### `isEven()` Determines whether a BigNumber is even `BigNumber("28472310").isEven() => true` -###`isOdd()` +### `isOdd()` Determines whether a BigNumber is odd `BigNumber("283427").isOdd() => true` -###`abs()` +### `abs()` Gets the absolute value of the BigNumber `BigNumber("-26").abs() => BigNumber("26")` -##Operator overloads +## Operator overloads The following operators have been overloaded to work with BigNumbers: -###`<<` +### `<<` Output stream operator `std::cout << BigNumber("26") << std::endl => 26` -###`+` +### `+` Addition operator `BigNumber("2") + BigNumber("4") => BigNumber("6")` -###`-` +### `-` Subtraction operator `BigNumber("0") - BigNumber("2000") => BigNumber("-2000")` -###`*` +### `*` Multiplication operator `BigNumber("-20") * BigNumber("-5") => BigNumber("100")` -###`/` +### `/` Division operator `BigNumber("10") / BigNumber("-2") => BigNumber("-5")` -###`==` +### `==` Equal to operator `BigNumber("24") == BigNumber("24") => true` -###`>` +### `>` Greater than operator `BigNumber("2") > BigNumber("6") => false` -###`<` +### `<` Less than operator `BigNumber("2") < BigNumber("6") => true` -###`>=` +### `>=` Greater than or equal to operator `BigNumber("34") >= BigNumber("22") => true` -###`<=` +### `<=` Less than or equal to operator `BigNumber("383") <= BigNumber("383") => true` -###`=` +### `=` Assignment operator `BigNumber c("3") = BigNumber("8") => BigNumber("8")` -###`+=` +### `+=` Adds and assigns to the BigNumber `BigNumber c("4") += BigNumber("3") => BigNumber("7")` -###`-=` +### `-=` Subtracts and assigns to the BigNumber `BigNumber c("28") -= BigNumber("3") => BigNumber("25")` -###`*=` +### `*=` Multiplies and assigns to the BigNumber `BigNumber c("3") *= BigNumber("4") => BigNumber("12")` -###`/=` +### `/=` Divides and assigns to the BigNumber `BigNumber c("30") /= BigNumber("30") => BigNumer("1")` -###`++ (Prefix)` +### `++ (Prefix)` Increments the BigNumber and returns the newly incremented number `++BigNumber("10") => BigNumber("11")` -###`-- (Prefix)` +### `-- (Prefix)` Decrements the BigNumber and returns the newly decremented number `--BigNumber("34") => BigNumber("33")` -###`++ (Postfix)` +### `++ (Postfix)` Increments the BigNumber but returns the original value `BigNumber("20")++ => BigNumber("20")` -###`-- (Postfix)` +### `-- (Postfix)` Decrements the BigNumber but returns the original value `BigNumber("14")-- => BigNumber("14")` -###`[]` +### `[]` Indexing operator `BigNumber d("26")[1] => 6` -##License +## License This project is under the [Apache License](https://github.com/Limeoats/BigNumber/blob/master/LICENSE.md). -##Credit +## Credit The BigNumber class was created by [Mark Guerra](http://www.twitter.com/Limeoats). Visit [Limeoats.com](http://www.limeoats.com) for more information. - - - - - - - - - - - - -