Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,943 questions

51,884 answers

573 users

How to get the base 10 logarithm of a double value in Java

1 Answer

0 votes
class Program {
    public static void main(String[] args) {
        System.out.println("Math.log10(0) = " + Math.log10(0));
        System.out.println("Math.log10(1) = " + Math.log10(1));
        System.out.println("Math.log10(-1) = " + Math.log10(-1));
        System.out.println("Math.log10(2) = " + Math.log10(2));
        System.out.println("Math.log10(-2) = " + Math.log10(-2));
        System.out.println("Math.log10(5) = " + Math.log10(5));
        System.out.println("Math.log10(10) = " + Math.log10(10));
        System.out.println("Math.log10(100) = " + Math.log10(100));
        System.out.println("Math.log10(100000) = " + Math.log10(100000));
        System.out.println("Math.log10(125) = " + Math.log10(125));
        System.out.println("Math.log10(125)/Math.log10(5) = " + Math.log10(125)/Math.log10(5));
    }
}




/*
run:

Math.log10(0) = -Infinity
Math.log10(1) = 0.0
Math.log10(-1) = NaN
Math.log10(2) = 0.3010299956639812
Math.log10(-2) = NaN
Math.log10(5) = 0.6989700043360189
Math.log10(10) = 1.0
Math.log10(100) = 2.0
Math.log10(100000) = 5.0
Math.log10(125) = 2.0969100130080562
Math.log10(125)/Math.log10(5) = 2.9999999999999996

*/

 



answered Sep 10, 2016 by avibootz
edited Mar 5, 2024 by avibootz

Related questions

1 answer 152 views
1 answer 134 views
1 answer 166 views
166 views asked Feb 8, 2020 by avibootz
1 answer 154 views
...