Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi 3. Wurzel (https://www.delphipraxis.net/115004-3-wurzel.html)

sqrt 9 4. Jun 2008 10:31


3. Wurzel
 
Hi

kann mir vielleicht mal jemand verraten, wie man z.b. die 3. Wurzel einer Zahl berechnen kann?

mit sqrt geht nix!?!

thx :thumb:

Kedariodakon 4. Jun 2008 10:34

Re: 3. Wurzel
 
die 3.Wurzel ist auch gleichzusetzen mit: x^(1/3)


http://upload.wikimedia.org/math/4/3...5ac06fa113.png
Wikipedia

Delphi-Quellcode:
{ Power: Raise base to any power.
  For fractional exponents, or |exponents| > MaxInt, base must be > 0. }
function Power(const Base, Exponent: Extended): Extended;
Bye Christian

WIng2005 4. Jun 2008 10:35

Re: 3. Wurzel
 
function Sqrt(X: Extended): Extended; und wichtig: uses math

MFG
Steffen

sqrt 9 4. Jun 2008 10:35

Re: 3. Wurzel
 
oh so weit hab ich nicht gedacht

danke für die schnelle Antwort!!! :thumb:

Poelser 4. Jun 2008 10:36

Re: 3. Wurzel
 
Die Potenz-Funktion sollte helfen: x^(1/3)

CU, Eddi

himitsu 4. Jun 2008 20:24

Re: 3. Wurzel
 
Zitat:

Zitat von WIng2005
function Sqrt(X: Extended): Extended;

sqrt = square root = Quadratwurzel = zweite Wurzel


wenn es nur um ganze Zahlen geht, dann:
Delphi-Quellcode:
Var i: TBigInt;

i := {zahl};
i.Radic(3);
S := IntToStr(i);
und solange ich die Fließkommazahlen nicht fertig hab ... für 2 Nachkommastellen:
Delphi-Quellcode:
i := {zahl} * 100*100*100;
i.Radic(3);
S := FloatToStr(i / 100);
Hier im Forum suchenTBigInt

ösichemiker 12. Jun 2008 17:46

Re: 3. Wurzel
 
von JEDI gibts ne Funktion "Power" aber sind sonst auch gute sachen dabei

mfg
Flo 8)

inherited 12. Jun 2008 18:29

Re: 3. Wurzel
 
Wieso von Jedi? Soweit ich weiß ist die in der math-unit

WIng2005 13. Jun 2008 06:45

Re: 3. Wurzel
 
@himitsu: mein Fehler....Sorry

MFG
Steffen


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:09 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz