Metode Java Math log10 () aprēķina norādītās vērtības 10 bāzes logaritmu un to atgriež.
Metodes sintakse log10()
ir šāda:
Math.log10(double x)
Šeit log10()
ir statiska metode. Tādējādi mēs tieši izsaucam metodi, izmantojot klases nosaukumu Math
.
log10 () parametri
- x - vērtība, kuras logaritms jāaprēķina
log10 () atgriešanās vērtības
- atgriež x bāzes 10 logaritmu
- atgriež NaN, ja x ir NaN vai mazāks par nulli
- atgriež pozitīvu bezgalību, ja x ir pozitīva bezgalība
- atgriež negatīvu bezgalību, ja x ir nulle
Piezīme . Vērtība , kur n ir vesels skaitlis.log10(10n) = n
Piemērs: Java Math.log10 ()
class Main ( public static void main(String() args) ( // compute log10() for double value System.out.println(Math.log10(9.0)); // 0.9542425094393249 // compute log10() for zero System.out.println(Math.log10(0.0)); // -Infinity // compute log10() for NaN double nanValue = Math.sqrt(-5.0); System.out.println(Math.log10(nanValue)); // NaN // compute log10() for infinity double infinity = Double.POSITIVE_INFINITY; System.out.println(Math.log10(infinity)); // Infinity // compute log10() for negative numbers System.out.println(Math.log(-9.0)); // NaN //compute log10() for 103 System.out.println(Math.log10(Math.pow(10, 3))); // 3.0 ) )
Iepriekš minētajā piemērā ievērojiet izteicienu
Math.log10(Math.pow(10, 3))
Šeit Math.pow(10, 3)
atgriež 10 3 . Lai uzzinātu vairāk, apmeklējiet Java Math.pow ().
Ieteicamā apmācība
- Java Math.log ()
- Java Math.log1p ()