wurzel ziehen
-
hi,
wie lautet der befehl zum wurzel ziehen?
-
Hallo Spasti!
Nomen est Omen?
-
Nimm die Wurzel als Potenz an, wenn es ein Bruch ist.
Also:x = pow(1024,1.0 / n);
Für n=2 ist es dann die Quadratwurzel.
-
hat sich erledigt, der richtige code ist
... ergebnis= pow(zahl, 1.0/wurzel); ...
-
wenn eine naeherungsloesung hinreichend ist, kann man sich auch die interne darstellung von floating-point zahlen zunutze machen und einfach den exponenten entsprechend teilen.
-
Der Befehl zum Wurzelziehen?
Ganz einfach:
"Ziehe die Wurzel!"
-
Haloo Wie heißt die Datei die ich einbinden muss um Wurzeln zu ziehen?
-
#include <math.h>
-
Und in C++:
include <cmath>, zusammen mit ggf. einem using namespace std;
-
Gibts da kein sqrt()?
-
Der Computer spukt mir immer nur ganze Zahlen aus ich will aber Näherungswerte. Ist nämlich dum wenn der Computer statt 1,33333333 nur 1 schreibt. Gibts da ne möglichkeit?
-
float?
-
sqrt() ist aber nur quadratwurzel...
-
Und in C++:
include <cmath>, zusammen mit ggf. einem using namespace std;
wobei c++ mit c - includes zurechtkommt...
-
Tuxinator schrieb:
Und in C++:
include <cmath>, zusammen mit ggf. einem using namespace std;
wobei c++ mit c - includes zurechtkommt...
Das ist dann aber afaik kein Standard-C++.
-
Das ist dann aber afaik kein Standard-C++.
was für die funktionstüchtigkeit meines programmes welche auswirkung hat?
-
Na, daß es nicht funktioniert. Es könnte standardkonforme Compiler geben, auf denen Dein Programm sich dann nicht übersetzen läßt.
Natürlich ist das nicht sehr wahrscheinlich. Da es aber so einfach ist, es richtig zu machen, sollte man das auch tun.
-
Dass es u.U. nicht jeder Compiler kompiliert.
//e: Oh, Jester war schneller
.
-
Jester schrieb:
Na, daß es nicht funktioniert. Es könnte standardkonforme Compiler geben, auf denen Dein Programm sich dann nicht übersetzen läßt.
Auch wenn der C++-Nitpick-Bereich nebenan ist: Magst Du diese Aussage im Lichte des unten zitierten Absatzes näher ausführen?
These are deprecated features, where deprecated is defined as: Normative for the current edition of the Standard, but not guaranteed to be part of the Standard in future revisions. [...] D.5 Standard C library headers [depr.c.headers] 1 For compatibility with the Standard C library, the C++ Standard library provides the 18 C headers, as shown in Table 100: Table 100--C Headers __________________________________________________________________________ <assert.h> <wchar.h> <iso646.h> <setjmp.h> <stdio.h> <ctype.h> <wctype.h> <limits.h> <signal.h> <stdlib.h> <errno.h> <locale.h> <stdarg.h> <string.h> <float.h> <math.h> <stddef.h> <time.h> __________________________________________________________________________ 2 Each C header, whose name has the form name.h, behaves as if each name placed in the Standard library namespace by the corresponding cname header is also placed within the namespace scope of the name- space std and is followed by an explicit using-declaration (7.3.3)
-
Dann hat "Es koennte _irgendwann_ mal..." (naemlich dann, wenn die naechste standard-version raus kommt)