Loading...
Searching...
No Matches
A babylonian method (BM) is an algorithm that computes the square root. More...
#include <cassert>
#include <cmath>
#include <iostream>
Go to the source code of this file.
double numerical_methods::babylonian_method (double radicand) Babylonian methods is an iterative function which returns square root of radicand.A babylonian method (BM) is an algorithm that computes the square root.
This algorithm has an application in use case scenario where a user wants find accurate square roots of large numbers
Definition in file babylonian_method.cpp.
◆ main()Main function calls automated test function to test the working of fast fourier transform.
Definition at line 94 of file babylonian_method.cpp.
94 {
96
97 return 0;
98}
static void test()
Self-test implementations.
◆ test()Self-test implementations.
Declaring two test cases and checking for the error in predicted and true value is less than 0.0001.
Testcase 1
Testcase 2
Real Output 1
Real Output 2
Test result for testcase 1
Test result for testcase 2
Testing for test Case 1
Testing for test Case 2
Definition at line 62 of file babylonian_method.cpp.
62 {
63
64
65 auto testcase1 = 125348;
66 auto testcase2 = 752080;
67
68 auto real_output1 = 354.045194855;
69 auto real_output2 = 867.225460881;
70
75
76 assert(std::max(test_result1, real_output1) -
77 std::min(test_result1, real_output1) <
78 0.0001);
80 assert(std::max(test_result2, real_output2) -
81 std::min(test_result2, real_output2) <
82 0.0001);
84
85 std::cout << "All tests have successfully passed!\n";
86}
double babylonian_method(double radicand)
Babylonian methods is an iterative function which returns square root of radicand.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4