Java Math log10 () yöntemi, belirtilen değerin 10 tabanlı logaritmasını hesaplar ve döndürür.
log10()
Yöntemin sözdizimi şöyledir:
Math.log10(double x)
İşte log10()
statik bir yöntem. Bu nedenle, yöntemi doğrudan sınıf adını kullanarak çağırıyoruz Math
.
log10 () Parametreler
- x - logaritması hesaplanacak değer
log10 () Dönen Değerler
- x'in 10 tabanlı logaritmasını döndürür
- x NaN veya sıfırdan küçükse NaN döndürür
- eğer pozitif sonsuz döner x pozitif sonsuzluk olduğunu
- x sıfırsa negatif sonsuz döndürür
Not : Değeri , burada n bir tam sayıdır.log10(10n) = n
Örnek: 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 ) )
Yukarıdaki örnekte, ifadeye dikkat edin,
Math.log10(Math.pow(10, 3))
Burada Math.pow(10, 3)
10 3 döndürür . Daha fazla bilgi edinmek için Java Math.pow () adresini ziyaret edin.
Önerilen Eğitim
- Java Math.log ()
- Java Math.log1p ()