Example usage for java.lang StrictMath signum

List of usage examples for java.lang StrictMath signum

Introduction

In this page you can find the example usage for java.lang StrictMath signum.

Prototype

public static float signum(float f) 

Source Link

Document

Returns the signum function of the argument; zero if the argument is zero, 1.0f if the argument is greater than zero, -1.0f if the argument is less than zero.

Usage

From source file:Main.java

public static void main(String[] args) {

    float f1 = 123.45f, f2 = 0.0f, f3 = -0.0f;

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

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

    System.out.println(StrictMath.signum(f3));
}

From source file:Main.java

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));
}