Commit a195b9e
authored
### `BigDecimal` Enhancements:
* Introduced unsafe methods for constructing `BigDecimal` from raw
components (`from_raw_components`), with detailed documentation
explaining their usage and risks.
* Added new mathematical operations to `BigDecimal`, including `arctan`,
`power`, and constants like `pi` and `e`. These additions expand the
library's capabilities for advanced calculations.
[[1]](diffhunk://#diff-be2f9b2702fd15952546e17fe94a64c22902a0e4678bfd9cb925269647923db4R682-R711)
[[2]](diffhunk://#diff-be2f9b2702fd15952546e17fe94a64c22902a0e4678bfd9cb925269647923db4R748-R762)
* Improved methods for printing `BigDecimal` representations, including
`print_representation_as_components`, which provides a detailed
breakdown of the number's components.
[[1]](diffhunk://#diff-be2f9b2702fd15952546e17fe94a64c22902a0e4678bfd9cb925269647923db4L870-R921)
[[2]](diffhunk://#diff-be2f9b2702fd15952546e17fe94a64c22902a0e4678bfd9cb925269647923db4L900-R985)
### Mathematical Constants and Functions:
* Added a precomputed constant `PI_1024` for π to 1024 digits of
precision and implemented a function `pi(precision)` to calculate π
using Machin's formula for higher precision.
* Updated the `exp_taylor_series` function in `exponential.mojo` to
clarify the precision handling for natural exponential calculations.
### Documentation Enhancements:
* Added a detailed quick-start guide in `README.md` to showcase the
`decimojo.prelude` module, including examples of basic arithmetic,
mathematical functions, and internal representation of numbers.
[[1]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R56-R131)
[[2]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R175-R176)
* Created a new example file `docs/examples_on_bdec.mojo` to demonstrate
the usage of `BigDecimal` for arithmetic, mathematical, and internal
representation operations.
1 parent 48a9395 commit a195b9e
9 files changed
Lines changed: 742 additions & 37 deletions
File tree
- docs
- src/decimojo
- bigdecimal
- biguint
- tests/bigdecimal
- test_data
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
56 | 73 | | |
57 | 74 | | |
58 | 75 | | |
59 | | - | |
| 76 | + | |
60 | 77 | | |
61 | 78 | | |
62 | 79 | | |
63 | | - | |
64 | 80 | | |
65 | 81 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
72 | 128 | | |
73 | 129 | | |
| 130 | + | |
| 131 | + | |
74 | 132 | | |
75 | 133 | | |
76 | 134 | | |
| |||
114 | 172 | | |
115 | 173 | | |
116 | 174 | | |
| 175 | + | |
| 176 | + | |
117 | 177 | | |
118 | 178 | | |
119 | 179 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
158 | 158 | | |
159 | | - | |
160 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
161 | 178 | | |
162 | 179 | | |
163 | 180 | | |
164 | | - | |
| 181 | + | |
165 | 182 | | |
166 | | - | |
167 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
168 | 187 | | |
169 | 188 | | |
170 | 189 | | |
| |||
644 | 663 | | |
645 | 664 | | |
646 | 665 | | |
| 666 | + | |
| 667 | + | |
647 | 668 | | |
648 | 669 | | |
649 | 670 | | |
| |||
658 | 679 | | |
659 | 680 | | |
660 | 681 | | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
661 | 712 | | |
662 | 713 | | |
663 | 714 | | |
| |||
679 | 730 | | |
680 | 731 | | |
681 | 732 | | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | 733 | | |
693 | 734 | | |
694 | 735 | | |
| |||
704 | 745 | | |
705 | 746 | | |
706 | 747 | | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
707 | 763 | | |
708 | 764 | | |
709 | 765 | | |
| |||
731 | 787 | | |
732 | 788 | | |
733 | 789 | | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
| 790 | + | |
740 | 791 | | |
741 | 792 | | |
742 | 793 | | |
| |||
867 | 918 | | |
868 | 919 | | |
869 | 920 | | |
870 | | - | |
| 921 | + | |
871 | 922 | | |
872 | 923 | | |
873 | 924 | | |
| |||
897 | 948 | | |
898 | 949 | | |
899 | 950 | | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
905 | 958 | | |
906 | 959 | | |
907 | 960 | | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
908 | 986 | | |
909 | 987 | | |
910 | 988 | | |
| |||
0 commit comments