English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Tutoriel de base Java

Contrôle de flux Java

Java Tableau

Java Programmation orientée objet (I)

Java Programmation orientée objet (II)

Java Programmation orientée objet (III)

Gestion des exceptions Java

Java List

Java Queue (File d'attente)

Java Map Collection

Java Set Collection

Java Entrée/Sortie (I/O)

Java Reader/Writer

Autres sujets Java

Java Math log10Méthode d'utilisation et exemple ()

Java Math mathematical methods

Java Math log10La méthode () calcule le logarithme en base d'une valeur spécifiée.10calculer le logarithme en base et le retourner ensuite.

log10La syntaxe de la méthode () est :

Math.log10(double x)

Attention: ce log10La méthode () est une méthode statique. Par conséquent, nous pouvons appeler cette méthode Math directement par le nom de la classe.

log10paramètres de ()

  • x - valeur dont on veut calculer le logarithme

log10valeur de retour de ()

  • retournela valeur de xde10logarithme en base

  • sixest NaN ou inférieur à zéro, alors retourne NaN

  • sixest l'infini positif, alors retourne l'infini positif

  • sixsi n est égal à zéro, alors retourne l'infini négatif

Attention:quand nlorsque n est un entier, la valeur est log10(10n) = n

Exemple : Java Math.log10()

class Main {
  public static void main(String[] args) {
    //calculation of the log of a double-precision value10()
    System.out.println(Math.log10(9.0))       // 0.9542425094393249
    //calculation of the log of 010()
    System.out.println(Math.log10(0.0))       // -Infinity
    //calculation of the log of NaN10()
    double nanValue = Math.sqrt(-5.0);
    System.out.println(Math.log10(nanValue))  // NaN
    //calculation of the log of infinity10()
    double infinity = Double.POSITIVE_INFINITY;
    System.out.println(Math.log10(infinity))  // Infinity
    //calculation of the log of a negative number10()
    System.out.println(Math.log(-9.0))      // NaN
    //calculation10of3log of the power10()
    System.out.println(Math.log10(Math.pow(10, 3))  // 3.0
  }
}

In the above example, please note the following expression:

Math.log10(Math.pow(10, 3)

Here, Math.pow(10, 3) return103. For more information, please visit Java Math.pow().

Java Math mathematical methods