⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_sqrt_2.cpp~

📁 浮点数基本运算 浮点数的基本运算主要有四则运算、符号处理、大小比较
💻 CPP~
字号:
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

double msqrt(double a)
{
  double x = 1.0;
  double x1;
  printf (" -- -- -- %1.15lf -- -- --\n", a);
  do
    {
      x1 = (a / x + x) / 2;

      if (abs(x / x1 - 1) < 1E-16)
	break;
      printf ("%1.17f\n", x1);
      x = x1;
    }
  while (true);
  return x1;
}

int main()
{
  double a = 0.0;
  for (int i = 0; i < 10; ++i)
    {
      a = msqrt(a+2.0);
    }
  system ("pause");
  return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -