Package java.math

Examples of java.math.BigInteger.doubleValue()


     
      BigInteger asBigInt = convertLongToUlong(valueAsLong);
     
      // TODO: Check for overflow
     
      return asBigInt.doubleValue();
    case MysqlDefs.FIELD_TYPE_FLOAT:
      return getNativeFloat(columnIndex + 1);
    case MysqlDefs.FIELD_TYPE_BIT:
      return getNumericRepresentationOfSQLBitType(columnIndex + 1);
    default:
View Full Code Here


      BigInteger bi = squarD.unscaledValue();     // bi and scale are a tandem
      int biLen = bi.bitLength();
      int shift = Math.max(0, biLen - BITS + (biLen%2 == 0 ? 0 : 1));   // even shift..
      bi = bi.shiftRight(shift);                  // ..floors to 62 or 63 bit BigInteger

      double root = Math.sqrt(bi.doubleValue());
      BigDecimal halfBack = new BigDecimal(BigInteger.ONE.shiftLeft(shift/2));

      int scale = squarD.scale();
      if (scale % 2 == 1) {
          root *= SQRT_10;                        // 5 -> 2, -5 -> -3 need half a scale more..
View Full Code Here

     
      BigInteger asBigInt = convertLongToUlong(valueAsLong);
     
      // TODO: Check for overflow
     
      return asBigInt.doubleValue();
    case MysqlDefs.FIELD_TYPE_FLOAT:
      return (double) getNativeFloat(columnIndex + 1);
    case MysqlDefs.FIELD_TYPE_BIT:
      return getNumericRepresentationOfSQLBitType(columnIndex + 1);
    default:
View Full Code Here

    BigInteger bi = squarD.unscaledValue();     // bi and scale are a tandem
    int biLen = bi.bitLength();
    int shift = Math.max( 0, biLen - BITS + (biLen % 2 == 0 ? 0 : 1) );   // even shift..
    bi = bi.shiftRight( shift );                  // ..floors to 62 or 63 bit BigInteger

    double root = Math.sqrt( bi.doubleValue() );
    BigDecimal halfBack = new BigDecimal( BigInteger.ONE.shiftLeft( shift / 2 ) );

    int scale = squarD.scale();
    if ( scale % 2 == 1 ) // add half scales of the root to odds..
    {
View Full Code Here

            final Long abs = Long.valueOf(unsignedHexString, 16);
            return isNegative ? -abs : abs;
        }

        final BigInteger bi = new BigInteger(unsignedHexString, 16);
        return isNegative ? -bi.doubleValue() : bi.doubleValue();
    }
   
    /**
     * Constructor.
     *
 
View Full Code Here

            final Long abs = Long.valueOf(unsignedHexString, 16);
            return isNegative ? -abs : abs;
        }

        final BigInteger bi = new BigInteger(unsignedHexString, 16);
        return isNegative ? -bi.doubleValue() : bi.doubleValue();
    }
   
    /**
     * Constructor.
     *
 
View Full Code Here

            if (errMsg != null) {
                return errMsg;
            }

            BigInteger longValue = new BigInteger(hexValue, 16);
            if (longValue.doubleValue() > maxValue) {
                return "'" + longValue + "' exceeds maximum value ["  + new BigDecimal(maxValue).toString() + "].";
            }

            return null;
        }
View Full Code Here

         }
      }
      else if(typeCode == XS_UNSIGNEDLONG)
      {
         BigInteger d = new BigInteger(value);
         if(d.doubleValue() < 0 || d.doubleValue() > 18446744073709551615D)
         {
            throw new JBossXBValueFormatException("Invalid unsignedLong value: " + value);
         }
         result = d;
      }
View Full Code Here

         }
      }
      else if(typeCode == XS_UNSIGNEDLONG)
      {
         BigInteger d = new BigInteger(value);
         if(d.doubleValue() < 0 || d.doubleValue() > 18446744073709551615D)
         {
            throw new JBossXBValueFormatException("Invalid unsignedLong value: " + value);
         }
         result = d;
      }
View Full Code Here

         result = u.toString();
      }
      else if(typeCode == XS_UNSIGNEDLONG)
      {
         BigInteger d = (BigInteger)value;
         if (d.doubleValue() < 0 || d.doubleValue() > 18446744073709551615D)
         {
            throw new JBossXBValueFormatException("Invalid unsignedLong value: " + value);
         }
         result = d.toString();
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.