All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dakusui.lisj.forms.funcs.math.Mul Maven / Gradle / Ivy

package com.github.dakusui.lisj.forms.funcs.math;

import java.math.BigDecimal;

public class Mul extends NumericFunc {
  /**
   * Serial version UID.
   */
  private static final long serialVersionUID = 8059283467791114034L;
  /**
   * The value used when only 1 parameter is given to this function.
   */
  private static final Number FIRST_VALUE      = 1;

  @Override protected Number firstValue() {
    return FIRST_VALUE;
  }

  @Override
  protected double calcDouble(double v, double w) {
    return v * w;
  }

  @Override
  protected float calcFloat(float v, float w) {
    return v * w;
  }

  @Override
  protected int calcInt(int v, int w) {
    return v * w;
  }

  @Override
  protected long calcLong(long v, long w) {
    return v * w;
  }

  @Override
  protected int calcShort(int v, short w) {
    return v * w;
  }

  @Override
  protected int calcByte(int v, byte w) {
    return v * w;
  }

  @Override
  protected BigDecimal calcBigDecimal(BigDecimal v, BigDecimal w) {
    return v.multiply(w);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy