Skip to content

Commit 5054c13

Browse files
authored
Update README.md
1 parent c28094d commit 5054c13

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

README.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,40 @@ These are implementations of the multi-precision `BigInteger`, `BigDecimal` and
2323

2424
`BigInteger` is a multi-precision integer. Its size is only limited by available memory.
2525

26-
`BigInteger` is built for ease of use, speed and reliability. It is written in plain Object Pascal and x86-32/x86-64 assembler, but every assembler function has a so called "pure Pascal" equivalent as well. It is modelled after the `BigInteger` type in .NET, but is far more optimized than that and provides an interface that is more in line with Delphi. It uses higher level algorithms like *Burnikel-Ziegler*, *Karatsuba*, *Toom-Cook*, etc. to make things fast even for very large integers. It offers overloaded operators and all the usual functions. More information can be found on the [BigIntegers unit](https://github.com/TurboPack/RudysBigNumbers/wiki/BigIntegers) wiki page.
26+
`BigInteger` is built for ease of use, speed and reliability. It is written in plain Object Pascal and x86-32/x86-64 assembler, but every assembler function has a so called "pure Pascal" equivalent as well. It is modelled after the `BigInteger` type in .NET, but is far more optimized than that and provides an interface that is more in line with Delphi. It uses higher level algorithms like *Burnikel-Ziegler*, *Karatsuba*, *Toom-Cook*, etc. to make things fast even for very large integers. It offers overloaded operators and all the usual functions. More information can be found on the [BigIntegers unit wiki page](https://github.com/TurboPack/RudysBigNumbers/wiki/BigIntegers).
27+
28+
Simple usage:
29+
30+
```Delphi
31+
var
32+
A, B, C, D: BigInteger;
33+
begin
34+
A := 3141592653589793238462643383279;
35+
B := 1414213562373095 shl 10;
36+
C := 2718281828459045235360287471352;
37+
D := A + B * C;
38+
Writeln(D.ToString);
39+
```
2740

2841
## BigDecimal
2942

3043
<img src="https://github.com/user-attachments/assets/0efa7aff-50c1-4c5b-a7c0-3f45907cbfe0" alt="Rudy Velthuis' BigDecimals Logo" width="250" align="right">
3144

3245
`BigDecimal` is a multi-precision decimal floating point type. It can have an almost unlimited precision.
3346

34-
`BigDecimal` is equally built for ease of use and reliability. It builds on top of BigInteger: the internal representation is a BigInteger for the significant digits, and a scale to indicate the decimals. It also offers overloaded operators and all the usual functions. This is modelled after the `BigDecimal` type in Java, but the interface is more in line with Delphi. More information about this type can be found on the [BigDecimals unit](https://github.com/TurboPack/RudysBigNumbers/wiki/BigDecimals) wiki page.
47+
`BigDecimal` is equally built for ease of use and reliability. It builds on top of BigInteger: the internal representation is a BigInteger for the significant digits, and a scale to indicate the decimals. It also offers overloaded operators and all the usual functions. This is modelled after the `BigDecimal` type in Java, but the interface is more in line with Delphi. More information about this type can be found on the [BigDecimals unit wiki page](https://github.com/TurboPack/RudysBigNumbers/wiki/BigDecimals).
48+
49+
Simple usage:
50+
51+
```Delphi
52+
var
53+
A, B, C: BigDecimal;
54+
begin
55+
A := '1.3456e-17'; // exact
56+
B := 1234.197; // floating point approximation
57+
C := A + B * '3.0';
58+
Writeln(string(C));
59+
```
3560

3661
## BigRational <img src="https://github.com/user-attachments/assets/e320934f-88c6-4f2b-a6fb-2528cf436ab5" alt="Rudy Velthuis' BigRationals Logo" width="175" align="right">
3762

@@ -43,17 +68,18 @@ This type is very good at simple arithmetic (`+`, `-`, `*`, `/`), since it doesn
4368
The newest version of BigIntegers has additional overloaded operators and additional constructors that are compatible
4469
with C++Builder. So now you simply include:
4570

71+
```C++
4672
#include "Velthuis.BigIntegers.hpp"
47-
73+
```
4874
and then you can do things like:
49-
75+
```C++
5076
BigInteger a = 17;
5177
BigInteger b = "123";
5278
BigInteger c = a + b;
53-
79+
```
5480
## Directory structure
5581

56-
```
82+
```text
5783
RudysBigNumbers
5884
Source --- Sources for units and for bases.inc
5985
Tests

0 commit comments

Comments
 (0)