hallo, ich habe mal wieder ein noob problem:
ich wollte eigentlich bloß eine Wurzelfunktion erstellen:
Code:
#include <iostream>

using namespace std;

int Global=0;

const double PI=3.141592653;

#define BR cout<<'\n';

double Wurzel(int a, double b=0);

int main(void)
{
   cin>>Global;
   Wurzel(Global);
   BR
   
   cin>>Global;
   return 0;
}
double Wurzel(int a, double b)
{
   while(b*b<a)
   {
      cout<<"b*b ist: "<<b*b;
      BR
      cout<<"a ist : "<<a;
      BR
      if(!(b*b<a))cout<<"b*b ist nicht kleiner als a\n";
      b+=0.001;
      cout<<b;
      BR
   }
   return b;
}
Jedoch wenn ich ich im Prog dann 4 eingebe kommt am Ende 2.001 raus, könnte das tzwar umgehen, aber wo liegt der Fehler?