Java Float Number Truncate trunc(float x)

Here you can find the source of trunc(float x)

Description

trunc

License

Open Source License

Declaration

public static float trunc(float x) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static float trunc(float x) {
        if (x < 0) {
            return (float) Math.ceil(x);
        } else {/*from   w  w  w. j a  v a 2 s. c  om*/
            return (float) Math.floor(x);
        }
    }
}

Related

  1. trunc(Float f)