sqrt Domain Fehler



  • Hallo
    Bei mir kommt der fehler: "sqrt Domain Fehler".

    Was ist Falsch?

    #include "BinomischeGleichung3.h"
    #include <math.h>
    //---------------------------------------------------------------------------
    #pragma resource "*.dfm"
    TForm1 *Form1;
    int a,b,c, p, q, x, x13, x15, x14, x12, x16, x1, x2;
    //---------------------------------------------------------------------------
    __fastcall TForm1::TForm1(TComponent* Owner)
    	: TForm(Owner)
    {
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
    float a = StrToInt (Edit1->Text);
    float b = StrToInt (Edit2->Text);
    float c = StrToInt (Edit3->Text);
    float x  =  1;
    float p =  b/ a;
    float q  = c / a;
    
     x13 = - p / 2;
     x15 = x13 * x13;
     x14 = x12 - q;
     x12 = sqrt(x14);
    float x16 = sqrt (x12);
    x1 = x16;
    x2 = -x16;
    //(x + p/2)² = (p/2)² -q
    
     Label5->Caption = "Ergf" +IntToStr (x1);
    Label4->Caption = "Ergebnis bis jetzt" +IntToStr (x2);
    }
    


  • Einfach mal einen Blick in die Hilfe zu sqrt werfen!?



  • x14 = x12 - q

    wie soll das funktionieren, wenn x12 noch nicht initialisiert wurde?


Anmelden zum Antworten