com.sap.sql

Class ApproximateNumericHelper

java.lang.Object
  extended by com.sap.sql.ApproximateNumericHelper

public class ApproximateNumericHelper
extends Object


Constructor Summary
ApproximateNumericHelper()
           
 
Method Summary
static double adjustDOUBLEValue(double value)
          Open SQL does not guarantee that a double value that has been stored in a column with JDBC type DOUBLE and read again compares with equal to the original value.
static float adjustREALValue(float value)
           
static double getMaximumPositiveDOUBLEValue()
          Determines greatest positive double value, which can be stored in a DOUBLE (or FLOAT) column.
static float getMaximumPositiveREALValue()
          Determines greatest positive float value, which can be stored in a REAL column.
static double getMinimumPositiveDOUBLEValue()
          Determines smallest positive double value, which can be stored in a DOUBLE (or FLOAT) column.
static float getMinimumPositiveREALValue()
          Determines smallest positive float value, which can be stored in a REAL column.
static boolean isValidDOUBLEValue(double value)
          Determines if a given double value can be stored in a DOUBLE (or FLOAT) column.
static boolean isValidREALValue(float value)
          Determines if a given float value can be stored in a REAL column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApproximateNumericHelper

public ApproximateNumericHelper()
Method Detail

isValidDOUBLEValue

public static boolean isValidDOUBLEValue(double value)
Determines if a given double value can be stored in a DOUBLE (or FLOAT) column.

Parameters:
value - the value
Returns:
true, if the given value can be stored ; false, if the value will be rejected by Open SQL

isValidREALValue

public static boolean isValidREALValue(float value)
Determines if a given float value can be stored in a REAL column.

Parameters:
value - the value
Returns:
true, if the given value can be stored with Open SQL; false, if the value will be rejected by Open SQL

getMaximumPositiveDOUBLEValue

public static double getMaximumPositiveDOUBLEValue()
Determines greatest positive double value, which can be stored in a DOUBLE (or FLOAT) column.

Returns:
the greatest positive double value, which can be stored in a DOUBLE (or FLOAT) column

getMaximumPositiveREALValue

public static float getMaximumPositiveREALValue()
Determines greatest positive float value, which can be stored in a REAL column.

Returns:
the greatest positive float value, which can be stored in a REAL column

getMinimumPositiveDOUBLEValue

public static double getMinimumPositiveDOUBLEValue()
Determines smallest positive double value, which can be stored in a DOUBLE (or FLOAT) column.

Returns:
the smallest positive double value, which can be stored in a DOUBLE (or FLOAT) column

getMinimumPositiveREALValue

public static float getMinimumPositiveREALValue()
Determines smallest positive float value, which can be stored in a REAL column.

Returns:
the smallest positive float value, which can be stored in a REAL column

adjustDOUBLEValue

public static double adjustDOUBLEValue(double value)
Open SQL does not guarantee that a double value that has been stored in a column with JDBC type DOUBLE and read again compares with equal to the original value. Therefore, a value that can inserted into the database might not be valid after it has been read again from the database.

This method addresses this issue. It checks, if a given double value is within the range of portable values extended by the fault tolerance.

Parameters:
value -
Returns:
If the given value is within the portable range, the given value; if the given value exceed the portable range but is still within fault tolerance, the nearest border of the portable range; a NumberFormatException, otherwise
Throws:
NumberFormatException - if the given value exceeds the portable range and is not within the fault tolerance

adjustREALValue

public static float adjustREALValue(float value)
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] ENGFACADE [sap.com] tc/je/opensql/api api BC-JAS
[sap.com] CORE-TOOLS [sap.com] com.sap.engine.client.libdeprecated default BC-JAS
[sap.com] ENGINEAPI [sap.com] opensqldeprecated default BC-JAS-PER-SQL


Copyright 2012 SAP AG Complete Copyright Notice