Skip to content

Commit 540a18a

Browse files
author
alexeev-prog
committed
fix/docs: fix examples and improve docs
1 parent d246eba commit 540a18a

File tree

6 files changed

+34
-38
lines changed

6 files changed

+34
-38
lines changed

README.md

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ auto main() -> int {
133133
double const b = 5;
134134
double const c = 5;
135135

136-
double const d = mathematics::quadratic::calculateDiscriminant(a, b, c);
137-
std::vector<double> const roots = mathematics::quadratic::calculateRootsByDiscriminant(d, a, b);
136+
double const d = mathematics::quadratic::calculate_discriminant(a, b, c);
137+
std::vector<double> const roots = mathematics::quadratic::calculate_roots_by_discriminant(d, a, b);
138138

139139
std::cout << "Quadratic Equation: a=" << a << "; b=" << b << "; c=" << c << '\n';
140140
std::cout << "D=" << d << '\n';
@@ -156,11 +156,11 @@ auto main() -> int {
156156
// POWER / Algorithms for fast exponentiation //
157157

158158
double const best_pow_val = 100;
159-
double const pow_results[5] = { mathematics::oldApproximatePower(10.0, 2.0),
160-
mathematics::anotherApproximatePower(10.0, 2.0),
161-
mathematics::binaryPower(10.0, 2),
162-
mathematics::fastPowerDividing(10.0, 2.0),
163-
mathematics::fastPowerFractional(10.0, 2.0) };
159+
double const pow_results[5] = { mathematics::old_approximate_power(10.0, 2.0),
160+
mathematics::another_approximate_power(10.0, 2.0),
161+
mathematics::binary_power(10.0, 2),
162+
mathematics::fast_power_dividing(10.0, 2.0),
163+
mathematics::fast_power_fractional(10.0, 2.0) };
164164

165165
std::cout << "0 oldApproximatePower : base 10 exponent 2: " << pow_results[0] << '\n';
166166
std::cout << "1 anotherApproximatePower: base 10 exponent 2: " << pow_results[1] << '\n';
@@ -201,7 +201,7 @@ void test_eq_sa(double (*f_eq)(double), double x0, const std::string &eq) {
201201

202202
std::cout << "Equation solution " << eq << ":\t";
203203

204-
z = mathematics::equations::successiveApproximationsFindingRoot(f_eq, x0, iterations);
204+
z = mathematics::equations::successive_approximations_finding_root(f_eq, x0, iterations);
205205

206206
std::cout << z << '\n';
207207

@@ -234,6 +234,7 @@ auto main() -> int {
234234
<summary>Physics</summary>
235235
236236
```cpp
237+
237238
#include <iostream>
238239
239240
#include "libnumerixpp/core/common.hpp"
@@ -283,14 +284,15 @@ auto main() -> int {
283284
println("LIBNUMERIXPP");
284285

285286
int const decimal_number = 777;
286-
std::string binary_number = computerscience::convertDecimalToBinary(decimal_number);
287-
int const decimal_number2 = computerscience::convertBinaryToDecimal(binary_number);
288-
std::string hexadecimal_number = computerscience::convertDecimalToHexadecimal(decimal_number);
289-
int const decimal_number3 = computerscience::convertHexadecimalToDecimal(hexadecimal_number);
287+
std::string binary_number = computerscience::convert_decimal_to_binary(decimal_number);
288+
int const decimal_number2 = computerscience::convert_binary_to_decimal(binary_number);
289+
std::string hexadecimal_number =
290+
computerscience::convert_decimal_to_hexadecimal(decimal_number);
291+
int const decimal_number3 = computerscience::convert_hexadecimal_to_decimal(hexadecimal_number);
290292
std::string const hexadecimal_number2 =
291-
computerscience::convertBinaryToHexadecimal(binary_number);
293+
computerscience::convert_binary_to_hexadecimal(binary_number);
292294
std::string const binary_number2 =
293-
computerscience::convertHexadecimalToBinary(hexadecimal_number);
295+
computerscience::convert_hexadecimal_to_binary(hexadecimal_number);
294296
long long const bytes = 1024 * 1024;
295297

296298
std::cout << "Convert decimal " << decimal_number << " to binary: " << binary_number << '\n';
@@ -303,7 +305,7 @@ auto main() -> int {
303305
<< '\n';
304306
std::cout << "Convert hexadecimal " << hexadecimal_number << " to binary: " << binary_number2
305307
<< '\n';
306-
std::cout << "Convert " << bytes << ": " << computerscience::humanizeBytesSize(bytes) << '\n';
308+
std::cout << "Convert " << bytes << ": " << computerscience::humanize_bytes_size(bytes) << '\n';
307309

308310
return 0;
309311
}
@@ -439,7 +441,6 @@ libnumerixpp is an Open Source project, and it only survives due to your feedbac
439441
Project releases are available at [this link](https://github.com/alexeev-prog/libnumerixpp/releases).
440442

441443
## Requirements 📋
442-
443444
To use libnumerixpp, you will need the following:
444445

445446
- A C++17 compatible compiler (e.g., GCC 8+, Clang 8+, or MSVC 2019+)
@@ -458,14 +459,12 @@ Check other our projects:
458459
We welcome contributions from the community! If you would like to contribute to the libnumerixpp project, please read our [contribution guidelines](CONTRIBUTING.md) and submit a pull request.
459460

460461
## Get Help 🆘
461-
462462
If you encounter any issues or have questions about using libnumerixpp, you can:
463463

464464
- 🐞 Open an issue on the [GitHub repository](https://github.com/alexeev-prog/libnumerixpp/issues)
465465
- 📧 Contact the project maintainers at [email protected]
466466

467467
## Future Plans 🔮
468-
469468
The libnumerixpp team is continuously working on expanding the library's capabilities and improving its overall performance and usability. Some of our future plans include:
470469

471470
- 🧠 Implementing more advanced mathematical and physical computations, such as differential equations, linear algebra, and fluid dynamics
@@ -475,7 +474,6 @@ The libnumerixpp team is continuously working on expanding the library's capabil
475474
Stay tuned for more updates! 🚀
476475

477476
## Testing 🧪
478-
479477
libnumerixpp uses the Catch2 testing framework to ensure the quality and reliability of the provided functionalities. The unit tests are located in the tests directory of the repository.
480478

481479
To run the tests, you can execute the following command from the project's root directory:

examples/example-1.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
#include <iostream>
23

34
#include "libnumerixpp/core/common.hpp"

examples/example-2.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ auto main() -> int {
2626
double const b = 5;
2727
double const c = 5;
2828

29-
double const d = mathematics::quadratic::calculateDiscriminant(a, b, c);
30-
std::vector<double> const roots = mathematics::quadratic::calculateRootsByDiscriminant(d, a, b);
29+
double const d = mathematics::quadratic::calculate_discriminant(a, b, c);
30+
std::vector<double> const roots =
31+
mathematics::quadratic::calculate_roots_by_discriminant(d, a, b);
3132

3233
std::cout << "Quadratic Equation: a=" << a << "; b=" << b << "; c=" << c << '\n';
3334
std::cout << "D=" << d << '\n';
@@ -49,11 +50,11 @@ auto main() -> int {
4950
// POWER / Algorithms for fast exponentiation //
5051

5152
double const best_pow_val = 100;
52-
double const pow_results[5] = { mathematics::oldApproximatePower(10.0, 2.0),
53-
mathematics::anotherApproximatePower(10.0, 2.0),
54-
mathematics::binaryPower(10.0, 2),
55-
mathematics::fastPowerDividing(10.0, 2.0),
56-
mathematics::fastPowerFractional(10.0, 2.0) };
53+
double const pow_results[5] = { mathematics::old_approximate_power(10.0, 2.0),
54+
mathematics::another_approximate_power(10.0, 2.0),
55+
mathematics::binary_power(10.0, 2),
56+
mathematics::fast_power_dividing(10.0, 2.0),
57+
mathematics::fast_power_fractional(10.0, 2.0) };
5758

5859
std::cout << "0 oldApproximatePower : base 10 exponent 2: " << pow_results[0] << '\n';
5960
std::cout << "1 anotherApproximatePower: base 10 exponent 2: " << pow_results[1] << '\n';

examples/example-3.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ auto main() -> int {
1010
println("LIBNUMERIXPP");
1111

1212
int const decimal_number = 777;
13-
std::string binary_number = computerscience::convertDecimalToBinary(decimal_number);
14-
int const decimal_number2 = computerscience::convertBinaryToDecimal(binary_number);
15-
std::string hexadecimal_number = computerscience::convertDecimalToHexadecimal(decimal_number);
16-
int const decimal_number3 = computerscience::convertHexadecimalToDecimal(hexadecimal_number);
13+
std::string binary_number = computerscience::convert_decimal_to_binary(decimal_number);
14+
int const decimal_number2 = computerscience::convert_binary_to_decimal(binary_number);
15+
std::string hexadecimal_number =
16+
computerscience::convert_decimal_to_hexadecimal(decimal_number);
17+
int const decimal_number3 = computerscience::convert_hexadecimal_to_decimal(hexadecimal_number);
1718
std::string const hexadecimal_number2 =
18-
computerscience::convertBinaryToHexadecimal(binary_number);
19+
computerscience::convert_binary_to_hexadecimal(binary_number);
1920
std::string const binary_number2 =
20-
computerscience::convertHexadecimalToBinary(hexadecimal_number);
21+
computerscience::convert_hexadecimal_to_binary(hexadecimal_number);
2122
long long const bytes = 1024 * 1024;
2223

2324
std::cout << "Convert decimal " << decimal_number << " to binary: " << binary_number << '\n';
@@ -30,7 +31,7 @@ auto main() -> int {
3031
<< '\n';
3132
std::cout << "Convert hexadecimal " << hexadecimal_number << " to binary: " << binary_number2
3233
<< '\n';
33-
std::cout << "Convert " << bytes << ": " << computerscience::humanizeBytesSize(bytes) << '\n';
34+
std::cout << "Convert " << bytes << ": " << computerscience::humanize_bytes_size(bytes) << '\n';
3435

3536
return 0;
3637
}

src/libnumerixpp.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,3 @@
66
* @authors alxvdev
77
* @copyright Apache 2.0 License
88
*/
9-
#include <iostream>
10-
#include <string>
11-
12-
void println(const std::string &string) { std::cout << string << '\n'; }

test/source/libnumerixpp_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#include <catch2/catch_test_macros.hpp>
32
#include <vector>
43

0 commit comments

Comments
 (0)