java.lang.Double.max()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(249)

本文整理了Java中java.lang.Double.max()方法的一些代码示例,展示了Double.max()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Double.max()方法的具体详情如下:
包路径:java.lang.Double
类名称:Double
方法名:max

Double.max介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

private static double computedStdDev(double sumSquared, double sum, long n)
{
  double average = sum / n;
  double variance = (sumSquared - 2 * sum * average + average * average * n) / n;
  // variance might be negative because of numeric inaccuracy, therefore we need to use max
  return sqrt(max(variance, 0d));
}

代码示例来源:origin: prestodb/presto

private static double computedWeightedStdDev(double sumSquared, double sum, double totalWeight)
{
  double average = sum / totalWeight;
  double variance = (sumSquared - 2 * sum * average) / totalWeight + average * average;
  // variance might be negative because of numeric inaccuracy, therefore we need to use max
  return sqrt(max(variance, 0d));
}

代码示例来源:origin: prestodb/presto

public static PlanNodeStatsEstimate computeAntiJoin(PlanNodeStatsEstimate sourceStats, PlanNodeStatsEstimate filteringSourceStats, Symbol sourceJoinSymbol, Symbol filteringSourceJoinSymbol)
{
  return compute(sourceStats, filteringSourceStats, sourceJoinSymbol, filteringSourceJoinSymbol,
      (sourceJoinSymbolStats, filteringSourceJoinSymbolStats) ->
          max(sourceJoinSymbolStats.getDistinctValuesCount() * MIN_ANTI_JOIN_FILTER_COEFFICIENT,
              sourceJoinSymbolStats.getDistinctValuesCount() - filteringSourceJoinSymbolStats.getDistinctValuesCount()));
}

代码示例来源:origin: apache/hive

factor = Double.max(factor, HiveConf.getFloatVar(aspCtx.getConf(), HiveConf.ConfVars.HIVE_STATS_IN_MIN_RATIO));

代码示例来源:origin: prestodb/presto

double outputRowCount = max(supersetRowCount - subsetRowCount, 0);
  double newNullsCount = max(supersetNullsCount - subsetNullsCount, 0);
  newSymbolStats.setNullsFraction(min(newNullsCount, outputRowCount) / outputRowCount);
    double subsetValuesPerDistinctValue = subsetNonNullsCount / subsetDistinctValues;
    if (supersetValuesPerDistinctValue <= subsetValuesPerDistinctValue) {
      newDistinctValuesCount = max(supersetDistinctValues - subsetDistinctValues, 0);

代码示例来源:origin: GlowstoneMC/Glowstone

/**
 * Creates a new region bounded by the two opposing locations.
 * @param from The first bounding corner.
 * @param to The second bounding corner.
 */
public RectangularRegion(Location from, Location to) {
  Preconditions.checkArgument(
      from.getWorld() == to.getWorld(),
      "The given locations do not have matching worlds."
  );
  this.lowCorner = new Location(
      from.getWorld(),
      Double.min(from.getX(), to.getX()),
      Double.min(from.getY(), to.getY()),
      Double.min(from.getZ(), to.getZ())
  );
  this.highCorner = new Location(
      from.getWorld(),
      Double.max(from.getX(), to.getX()),
      Double.max(from.getY(), to.getY()),
      Double.max(from.getZ(), to.getZ())
  );
  this.widthX = highCorner.getBlockX() - lowCorner.getBlockX();
  this.widthY = highCorner.getBlockY() - lowCorner.getBlockY();
  this.widthZ = highCorner.getBlockZ() - lowCorner.getBlockZ();
}

代码示例来源:origin: prestodb/presto

public static PlanNodeStatsEstimate capStats(PlanNodeStatsEstimate stats, PlanNodeStatsEstimate cap)
{
  if (stats.isOutputRowCountUnknown() || cap.isOutputRowCountUnknown()) {
    return PlanNodeStatsEstimate.unknown();
  }
  PlanNodeStatsEstimate.Builder result = PlanNodeStatsEstimate.builder();
  double cappedRowCount = min(stats.getOutputRowCount(), cap.getOutputRowCount());
  result.setOutputRowCount(cappedRowCount);
  stats.getSymbolsWithKnownStatistics().forEach(symbol -> {
    SymbolStatsEstimate symbolStats = stats.getSymbolStatistics(symbol);
    SymbolStatsEstimate capSymbolStats = cap.getSymbolStatistics(symbol);
    SymbolStatsEstimate.Builder newSymbolStats = SymbolStatsEstimate.builder();
    // for simplicity keep the average row size the same as in the input
    // in most cases the average row size doesn't change after applying filters
    newSymbolStats.setAverageRowSize(symbolStats.getAverageRowSize());
    newSymbolStats.setDistinctValuesCount(min(symbolStats.getDistinctValuesCount(), capSymbolStats.getDistinctValuesCount()));
    newSymbolStats.setLowValue(max(symbolStats.getLowValue(), capSymbolStats.getLowValue()));
    newSymbolStats.setHighValue(min(symbolStats.getHighValue(), capSymbolStats.getHighValue()));
    double numberOfNulls = stats.getOutputRowCount() * symbolStats.getNullsFraction();
    double capNumberOfNulls = cap.getOutputRowCount() * capSymbolStats.getNullsFraction();
    double cappedNumberOfNulls = min(numberOfNulls, capNumberOfNulls);
    double cappedNullsFraction = cappedRowCount == 0 ? 1 : cappedNumberOfNulls / cappedRowCount;
    newSymbolStats.setNullsFraction(cappedNullsFraction);
    result.addSymbolStatistics(symbol, newSymbolStats.build());
  });
  return result.build();
}

代码示例来源:origin: io.virtdata/virtdata-lib-basics

@Override
  public double applyAsDouble(double operand) {
    return Double.max(max,operand);
  }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

@Override
  public double applyAsDouble(double operand) {
    return Double.max(max,operand);
  }
}

代码示例来源:origin: io.virtdata/metagen-lib-basics

@Override
  public double applyAsDouble(double operand) {
    return Double.max(max,operand);
  }
}

代码示例来源:origin: io.prestosql/presto-main

private static double computedWeightedStdDev(double sumSquared, double sum, double totalWeight)
{
  double average = sum / totalWeight;
  double variance = (sumSquared - 2 * sum * average) / totalWeight + average * average;
  // variance might be negative because of numeric inaccuracy, therefore we need to use max
  return sqrt(max(variance, 0d));
}

代码示例来源:origin: prestosql/presto

private static double computedWeightedStdDev(double sumSquared, double sum, double totalWeight)
{
  double average = sum / totalWeight;
  double variance = (sumSquared - 2 * sum * average) / totalWeight + average * average;
  // variance might be negative because of numeric inaccuracy, therefore we need to use max
  return sqrt(max(variance, 0d));
}

代码示例来源:origin: io.prestosql/presto-main

private static double computedStdDev(double sumSquared, double sum, long n)
{
  double average = sum / n;
  double variance = (sumSquared - 2 * sum * average + average * average * n) / n;
  // variance might be negative because of numeric inaccuracy, therefore we need to use max
  return sqrt(max(variance, 0d));
}

代码示例来源:origin: prestosql/presto

private static double computedStdDev(double sumSquared, double sum, long n)
{
  double average = sum / n;
  double variance = (sumSquared - 2 * sum * average + average * average * n) / n;
  // variance might be negative because of numeric inaccuracy, therefore we need to use max
  return sqrt(max(variance, 0d));
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

@Override
  public double applyAsDouble(double operand) {
    return Double.min(max,Double.max(min,operand));
  }
}

代码示例来源:origin: io.virtdata/virtdata-lib-basics

@Override
  public double applyAsDouble(double operand) {
    return Double.min(max,Double.max(min,operand));
  }
}

代码示例来源:origin: vmware/xenon

void max(double newValue) {
  while (true) {
    long oldBits = this.number.get();
    double oldValue = Double.longBitsToDouble(oldBits);
    long newBits = Double.doubleToLongBits(Double.max(oldValue, newValue));
    if (this.number.compareAndSet(oldBits, newBits)) {
      return;
    }
  }
}

代码示例来源:origin: com.vmware.xenon/xenon-common

void max(double newValue) {
  while (true) {
    long oldBits = this.number.get();
    double oldValue = Double.longBitsToDouble(oldBits);
    long newBits = Double.doubleToLongBits(Double.max(oldValue, newValue));
    if (this.number.compareAndSet(oldBits, newBits)) {
      return;
    }
  }
}

代码示例来源:origin: io.prestosql/presto-main

public static PlanNodeStatsEstimate computeAntiJoin(PlanNodeStatsEstimate sourceStats, PlanNodeStatsEstimate filteringSourceStats, Symbol sourceJoinSymbol, Symbol filteringSourceJoinSymbol)
{
  return compute(sourceStats, filteringSourceStats, sourceJoinSymbol, filteringSourceJoinSymbol,
      (sourceJoinSymbolStats, filteringSourceJoinSymbolStats) ->
          max(sourceJoinSymbolStats.getDistinctValuesCount() * MIN_ANTI_JOIN_FILTER_COEFFICIENT,
              sourceJoinSymbolStats.getDistinctValuesCount() - filteringSourceJoinSymbolStats.getDistinctValuesCount()));
}

代码示例来源:origin: prestosql/presto

public static PlanNodeStatsEstimate computeAntiJoin(PlanNodeStatsEstimate sourceStats, PlanNodeStatsEstimate filteringSourceStats, Symbol sourceJoinSymbol, Symbol filteringSourceJoinSymbol)
{
  return compute(sourceStats, filteringSourceStats, sourceJoinSymbol, filteringSourceJoinSymbol,
      (sourceJoinSymbolStats, filteringSourceJoinSymbolStats) ->
          max(sourceJoinSymbolStats.getDistinctValuesCount() * MIN_ANTI_JOIN_FILTER_COEFFICIENT,
              sourceJoinSymbolStats.getDistinctValuesCount() - filteringSourceJoinSymbolStats.getDistinctValuesCount()));
}

相关文章