public interface Maths
Modifier and Type | Method and Description |
---|---|
double |
abs(double nb)
Retourne la valeur absolue de l'entier nb.
|
float |
abs(float nb)
Retourne la valeur absolue de l'entier nb.
|
int |
abs(int nb)
Retourne la valeur absolue de l'entier nb.
|
long |
abs(long nb)
Retourne la valeur absolue de l'entier nb.
|
double |
acos(double a)
Returns the arc cosine of a value; the returned angle is in the range 0.0
through pi.
|
double |
asin(double a)
Returns the arc sine of a value; the returned angle is in the range -pi/2
through pi/2.
|
double |
atan(double a)
Returns the arc tangent of a value; the returned angle is in the range
-pi/2 through pi/2.
|
double |
atan2(double y,
double x)
Returns the angle theta from the conversion of rectangular coordinates
(x, y) to polar coordinates (r, theta).
|
double |
cbrt(double a)
Returns the cube root of a double value.
|
double |
ceil(double a)
Returns the smallest (closest to negative infinity) double value that is
greater than or equal to the argument and is equal to a mathematical
integer.
|
int |
charToInt(char c)
Convertit un chiffre (caractère décimal donc de 0 à 9 inclus) vers sa
valeur numérique (entière!).
|
double |
copySign(double magnitude,
double sign)
Returns the first floating-point argument with the sign of the second
floating-point argument.
|
float |
copySign(float magnitude,
float sign)
Returns the first floating-point argument with the sign of the second
floating-point argument.
|
double |
cos(double a)
Returns the trigonometric cosine of an angle.
|
double |
cosh(double x)
Returns the hyperbolic cosine of a double value.
|
double |
exp(double a)
Returns Euler's number e raised to the power of a double value.
|
double |
expm1(double x)
Returns ex -1.
|
double |
floor(double a)
Returns the largest (closest to positive infinity) double value that is
less than or equal to the argument and is equal to a mathematical
integer.
|
int |
getExponent(double d)
Returns the unbiased exponent used in the representation of a double.
|
int |
getExponent(float f)
Returns the unbiased exponent used in the representation of a float.
|
double |
hypot(double x,
double y)
Returns sqrt(x2 +y2) without intermediate overflow or underflow.
|
double |
IEEEremainder(double f1,
double f2)
Computes the remainder operation on two arguments as prescribed by the
IEEE 754 standard.
|
double |
log(double a)
Returns the natural logarithm (base e) of a double value.
|
double |
log10(double a)
Returns the base 10 logarithm of a double value.
|
double |
log1p(double x)
Returns the natural logarithm of the sum of the argument and 1.
|
double |
max(double a,
double b)
Returns the greater of two double values.
|
float |
max(float a,
float b)
Returns the greater of two float values.
|
int |
max(int a,
int b)
Returns the greater of two int values.
|
long |
max(long a,
long b)
Returns the greater of two long values.
|
double |
min(double a,
double b)
Returns the smaller of two double values.
|
float |
min(float a,
float b)
Returns the smaller of two float values.
|
int |
min(int a,
int b)
Returns the smaller of two int values.
|
long |
min(long a,
long b)
Returns the smaller of two long values.
|
double |
nextAfter(double start,
double direction)
Returns the floating-point number adjacent to the first argument in the
direction of the second argument.
|
float |
nextAfter(float start,
double direction)
Returns the floating-point number adjacent to the first argument in the
direction of the second argument.
|
double |
nextUp(double d)
Returns the floating-point value adjacent to d in the direction of
positive infinity.
|
float |
nextUp(float f)
Returns the floating-point value adjacent to f in the direction of
positive infinity.
|
double |
pow(double base,
double exponent)
Retourne la puissance réelle (
double ) d'un réel (double ). |
double |
random()
Retourne un réel tiré aléatoirement dans l'intervalle [0.0, 1.0[.
|
double |
rint(double a)
Returns the double value that is closest in value to the argument and is
equal to a mathematical integer.
|
long |
round(double a)
Returns the closest long to the argument.
|
int |
round(float a)
Returns the closest int to the argument.
|
double |
scalb(double d,
int scaleFactor)
Return d × 2scaleFactor rounded as if performed by a single correctly
rounded floating-point multiply to a member of the double value set.
|
float |
scalb(float f,
int scaleFactor)
Return f × 2scaleFactor rounded as if performed by a single correctly
rounded floating-point multiply to a member of the float value set.
|
double |
signum(double d)
Returns the signum function of the argument; zero if the argument is
zero, 1.0 if the argument is greater than zero, -1.0 if the argument is
less than zero.
|
float |
signum(float f)
Returns the signum function of the argument; zero if the argument is
zero, 1.0f if the argument is greater than zero, -1.0f if the argument is
less than zero.
|
double |
sin(double a)
Returns the trigonometric sine of an angle.
|
double |
sinh(double x)
Returns the hyperbolic sine of a double value.
|
double |
sqrt(double number)
Retourne la racine carrée (positive) d'un nombre réel.
|
double |
stringToDouble( String s)
Convertit une chaîne de caractère supposée représenter un réel vers sa
valeur numérique.
|
int |
stringToInt( String s)
Convertit une chaîne de caractère supposée représenter un entier vers sa
valeur numérique.
|
double |
tan(double a)
Returns the trigonometric tangent of an angle.
|
double |
tanh(double x)
Returns the hyperbolic tangent of a double value.
|
double random()
Retourne un réel tiré aléatoirement dans l'intervalle [0.0, 1.0[. La séquence des tirages est regénérée à chaque exécution du programme et donc non reproductible. La distribution des tirages suit une loi uniforme entre 0 et 1.
Il est possible de translater ce nombre réel dans un intervalle entier en
multipliant le nombre obtenu et en forçant le type à {code int}.
Exemple: pour tirer un nombre entre 1 et 6 (un dé à 6 faces), il suffit
d'écrire
int de = (int) (random()*6) + 1;La fonction
random()
retourne un nombre dans [0.0, 1.0[
qui multiplié par 6 se trouve projeté dans l'intervalle [0.0, 6.0[. Le
forçage vers le type entier (via l'opérateur de cast (int)
transforme le réel en un entier compris entre 0 et 5 (inclus), et le
décalage de 1 donne un nombre compris entre 1 et 6.
int abs(int nb)
nb
- le nombre dont on souhaite la valeur absolue.long abs(long nb)
nb
- le nombre dont on souhaite la valeur absolue.float abs(float nb)
nb
- le nombre dont on souhaite la valeur absolue.double abs(double nb)
nb
- le nombre dont on souhaite la valeur absolue.double pow(double base, double exponent)
double
) d'un réel (double
).
La méthode de calcule utilise, soit les fonctions mathématiques
logarithme
et exponentielle
, soit La formule de
l'exponentiation entière (en fonction du type des arguments).base
- La valeur qui est portée à la puissance.exponent
- La valeur de l'exposant.base
exponent
).double sqrt(double number)
NaN
est retournée (Dans ce
cas le programme se poursuit car ce n'est pas une erreur fatale).number
- int stringToInt( String s)
-
. Si la chaîne ne suit pas cette règle une erreur
NumberFormatException
est générée et le programme s'interrompt.s
- La représentation du nombre entier (chaîne de caractères).double stringToDouble( String s)
NumberFormatException
est générée et le programme
s'interrompt.NullPointerException
est générée et le programme s'interrompt.s
- La représentation du nombre entier (chaîne de caractères).int charToInt(char c)
Convertit un chiffre (caractère décimal donc de 0 à 9 inclus) vers sa
valeur numérique (entière!).
Si le caractère n'est pas un chiffre, une erreur RuntimeException
est générée et le programme s'interrompt.
Exemple: charToInt('3')
retournera la valeur 3.
c
- Le caractère dont on cherche la valeur.double acos(double a)
a
- double asin(double a)
a
- double atan(double a)
a
- double atan2(double y, double x)
y
- x
- double cbrt(double a)
a
- double ceil(double a)
a
- double copySign(double magnitude, double sign)
magnitude
- sign
- float copySign(float magnitude, float sign)
magnitude
- sign
- double cos(double a)
a
- double cosh(double x)
x
- double exp(double a)
a
- double expm1(double x)
x
- double floor(double a)
a
- int getExponent(double d)
d
- int getExponent(float f)
f
- double hypot(double x, double y)
x
- y
- double IEEEremainder(double f1, double f2)
f1
- f2
- double log(double a)
a
- double log10(double a)
a
- double log1p(double x)
x
- double max(double a, double b)
a
- b
- float max(float a, float b)
a
- b
- int max(int a, int b)
a
- b
- long max(long a, long b)
a
- b
- double min(double a, double b)
a
- b
- float min(float a, float b)
a
- b
- int min(int a, int b)
a
- b
- long min(long a, long b)
a
- b
- double nextAfter(double start, double direction)
start
- direction
- float nextAfter(float start, double direction)
start
- direction
- double nextUp(double d)
d
- float nextUp(float f)
f
- double rint(double a)
a
- long round(double a)
a
- int round(float a)
a
- double scalb(double d, int scaleFactor)
d
- scaleFactor
- float scalb(float f, int scaleFactor)
f
- scaleFactor
- double signum(double d)
d
- float signum(float f)
f
- double sin(double a)
a
- double sinh(double x)
x
- double tan(double a)
a
- double tanh(double x)
x
-