Example usage for java.lang Float MAX_EXPONENT

List of usage examples for java.lang Float MAX_EXPONENT

Introduction

In this page you can find the example usage for java.lang Float MAX_EXPONENT.

Prototype

int MAX_EXPONENT

To view the source code for java.lang Float MAX_EXPONENT.

Click Source Link

Document

Maximum exponent a finite float variable may have.

Usage

From source file:Main.java

public static void main(String[] args) {
    System.out.println("MAX_EXPONENT:" + Float.MAX_EXPONENT);
}

From source file:net.starschema.clouddb.jdbc.BQResultsetMetaData.java

/** {@inheritDoc} */
@Override//from w w  w .j a  v a  2  s .com
public int getPrecision(int column) throws SQLException {
    if (this.getColumnCount() == 0) {
        return 0;
    }
    String Columntype = "";
    try {
        Columntype = this.result.getSchema().getFields().get(column - 1).getType();
    } catch (IndexOutOfBoundsException e) {
        throw new BQSQLException("getPrecision(int)", e);
    }

    if (Columntype.equals("FLOAT")) {
        return Float.MAX_EXPONENT;
    }
    if (Columntype.equals("BOOLEAN")) {
        return 1; // A boolean is 1 bit length, but it asks for byte, so
        // 1
    }
    if (Columntype.equals("INTEGER")) {
        return 64; // BigQuery's Integer have 64 bits
    }
    if (Columntype.equals("STRING")) {
        return 64 * 1024;
    }
    if (Columntype.equals("TIMESTAMP")) {
        return 50; // TODO: better computation of the maximum length of a string representation of the date 
    }
    return 0;
}