class DigitalOptionFunction {

  public static double driftlessTheta(final double forward, final double strike, final double timeToExpiry, final double lognormalVol, final boolean isCall) {
    ArgumentChecker.isTrue(forward > 0.0, "negative/NaN forward; have {}", forward);
    ArgumentChecker.isTrue(strike > 0.0, "negative/NaN strike; have {}", strike);
    ArgumentChecker.isTrue(timeToExpiry > 0.0, "negative/NaN timeToExpiry; have {}", timeToExpiry);
    ArgumentChecker.isTrue(lognormalVol > 0.0, "negative/NaN lognormalVol; have {}", lognormalVol);

    final double sigmaRootT = lognormalVol * Math.sqrt(timeToExpiry);
    final double d = Math.log(forward / strike) / sigmaRootT - 0.5 * sigmaRootT;
    final double sign = isCall ? 1. : -1.;
    final double div = 0.5 * (-Math.log(forward / strike) / Math.pow(timeToExpiry, 1.5) / lognormalVol - 0.5 * lognormalVol / Math.pow(timeToExpiry, 0.5));
    return -sign * NORMAL.getPDF(d) * div;
  }

}