Skip to content
Snippets Groups Projects
Select Git revision
  • 9986b1b04fb8aedffbf2bd11a32436219cfaf92f
  • master default protected
  • enxhi_issue460_remove_TOAR-I_access
  • michael_issue459_preprocess_german_stations
  • sh_pollutants
  • develop protected
  • release_v2.4.0
  • michael_issue450_feat_load-ifs-data
  • lukas_issue457_feat_set-config-paths-as-parameter
  • lukas_issue454_feat_use-toar-statistics-api-v2
  • lukas_issue453_refac_advanced-retry-strategy
  • lukas_issue452_bug_update-proj-version
  • lukas_issue449_refac_load-era5-data-from-toar-db
  • lukas_issue451_feat_robust-apriori-estimate-for-short-timeseries
  • lukas_issue448_feat_load-model-from-path
  • lukas_issue447_feat_store-and-load-local-clim-apriori-data
  • lukas_issue445_feat_data-insight-plot-monthly-distribution
  • lukas_issue442_feat_bias-free-evaluation
  • lukas_issue444_feat_choose-interp-method-cams
  • 414-include-crps-analysis-and-other-ens-verif-methods-or-plots
  • lukas_issue384_feat_aqw-data-handler
  • v2.4.0 protected
  • v2.3.0 protected
  • v2.2.0 protected
  • v2.1.0 protected
  • Kleinert_etal_2022_initial_submission
  • v2.0.0 protected
  • v1.5.0 protected
  • v1.4.0 protected
  • v1.3.0 protected
  • v1.2.1 protected
  • v1.2.0 protected
  • v1.1.0 protected
  • IntelliO3-ts-v1.0_R1-submit
  • v1.0.0 protected
  • v0.12.2 protected
  • v0.12.1 protected
  • v0.12.0 protected
  • v0.11.0 protected
  • v0.10.0 protected
  • IntelliO3-ts-v1.0_initial-submit
41 results

conftest.py

Blame
  • mysqrt.cc 782 B
    #include <iostream>
    #include <cmath>
    
    auto mysqrt(double x) -> double
    {
        const auto eps = 1.0e-12;
        const auto eps2 = eps * eps;
        auto r0 = 0.5 * (1. + x);
        auto r1 = x / r0;
        while ((r0 - r1) * (r0 - r1) > eps2) {
            r0 = 0.5 * (r0 + r1);
            r1 = x / r0;
        }
        return r1;
    }
    
    auto main() -> int
    {
        double x{};
        std::cout << "Enter a positive real number: ";
        std::cin >> x;
        if (x > 0.) {
            auto rm = mysqrt(x);
            auto rs = std::sqrt(x);
            std::cout << "Square root with own function = " << rm << "\n";
            std::cout << "Square root with standard function = " << rs << "\n";
            std::cout << "Difference = " << rm - rs << "\n";
        } else {
            std::cout << "The input number needs to be positive.\n";
        }
    }