Java Data Type Tutorial - Java StrictMath.signum(double d)








Syntax

StrictMath.signum(double d) has the following syntax.

public static double signum(double d)

Example

In the following code shows how to use StrictMath.signum(double d) method.

//from w w  w .  ja  va  2 s.c o m

public class Main {

  public static void main(String[] args) {
  
    double d1 = 123.45d, d2 = 0.0d, d3 = -0.0d;

    System.out.println(StrictMath.signum(d1));

    System.out.println(StrictMath.signum(d2));
    
    System.out.println(StrictMath.signum(d3));
  }
}

The code above generates the following result.