0

I want to calculate the logarithm of the transmitter.getETXPOW(), what is BigDecimal format.

BigDecimal power =  transmitter.getETXPOW();
BigDecimal eirp = 10 * Math.log(power);

I received an error message, BigDecimal can not be converted to double.

Logarithm base is 10.

user2342549
  • 45
  • 1
  • 2
  • 9

1 Answers1

1

To convert to double value use BigDecimal class doubleValue(). See demo

import java.math.*;

public class BigDecimalDemo {

   public static void main(String[] args) {

      // create a BigDecimal object
      BigDecimal bg;

      // create a Double object
      Double d;

      bg=new BigDecimal("1234");

      // assign the converted value of bg to d
      d=bg.doubleValue();

      String str = "Double value of " + bg + " is " + d;

      // print d value
      System.out.println( str );
   }
}