This method currently uses the naive approach of returning
<code>-log(uniform)</code>.
961942
@Override
  public double nextRandom() {
    double val = random.nextDouble();
    if(val < .5) {
      return FastMath.log(2 * val) / rate + location;
    }
    else {
      return -FastMath.log(2. - 2. * val) / rate + location;
    }
  }
810737
public synchronized static Log getLog(Class< ? > clazz)
    {
        if (slf4jLoggingAvailable == null)
        {
            try
            {
                classLoader.loadClass("org.slf4j.Logger");
                slf4jLoggingAvailable = Boolean.TRUE;
            }
            catch (Exception e)
            {
                slf4jLoggingAvailable = Boolean.FALSE;
            }
        }

        if (slf4jLoggingAvailable)
        {
            try
            {
                return new Slf4JLogger(clazz);
            }
            catch (Throwable e)
            {
                slf4jLoggingAvailable = Boolean.FALSE;
            }
        }

        if (log4jLoggingAvailable == null)
        {
            try
            {
                classLoader.loadClass("org.apache.log4j.Logger");
                log4jLoggingAvailable = Boolean.TRUE;
            }
            catch (Exception e)
            {
                log4jLoggingAvailable = Boolean.FALSE;
            }
        }

        if (log4jLoggingAvailable)
        {
            return new Log4JLogger(clazz);
        }

        if (javaLoggingAvailable == null)
        {
            try
            {
                classLoader.loadClass("java.util.logging.Logger");
                javaLoggingAvailable = Boolean.TRUE;
            }
            catch (Exception e)
            {
                javaLoggingAvailable = Boolean.FALSE;
            }
        }
        if (javaLoggingAvailable)
        {
            return new JavaLoggingLog(clazz);
        }
        return new NullLog();
    }
1199841
private Logger log()
    {

        if (log == null)
        {
            log = Logger.getLogger(_PackageInfo.class.getName());
        }
        return log;

    }
1107618
def log(self, x, base=2):
        """"""
        return self._format_result(log(float(x), base))
347823
def initLogging(self):
        """"""
        verbose_levels = {
            0: logging.WARNING,
            1: logging.INFO,
            2: logging.DEBUG,
        }
        logging.basicConfig(
            level=verbose_levels[self.verbose],
            format="[%(asctime)-15s] %(module)-9s %(levelname)-7s %(message)s"
        )
        return logging.getLogger(self.__class__.__name__)
371732
def rerunExperimentFromLogfile(logFilename):
    
    callLog = LoggingDecorator.load(logFilename)

    # Assume first one is call to constructor
    exp = L246aNetwork(*callLog[0][1]["args"], **callLog[0][1]["kwargs"])

    # Call subsequent methods, using stored parameters
    for call in callLog[1:]:
      method = getattr(exp, call[0])
      method(*call[1]["args"], **call[1]["kwargs"])

    return exp
1151217
@SuppressWarnings("unchecked")
    private void checkForProblemsWithLoggerMethods() throws ClassNotFoundException {
        String callingClsName = getClassConstantOperand();
        if (!(callingClsName.endsWith("Log") || (callingClsName.endsWith("Logger"))) || (stack.getStackDepth() == 0)) {
            return;
        }
        String sig = getSigConstantOperand();
        if (SIG_STRING_AND_THROWABLE_TO_VOID.equals(sig) || SIG_OBJECT_AND_THROWABLE_TO_VOID.equals(sig)) {
            checkForProblemsWithLoggerThrowableMethods();
        } else if (SignatureBuilder.SIG_OBJECT_TO_VOID.equals(sig)) {
            checkForProblemsWithLoggerSingleArgumentMethod();
        } else if ((SLF4J_LOGGER.equals(callingClsName) || LOG4J2_LOGGER.equals(callingClsName))
                && (SignatureBuilder.SIG_STRING_TO_VOID.equals(sig) || SignatureBuilder.SIG_STRING_AND_OBJECT_TO_VOID.equals(sig)
                        || SIG_STRING_AND_TWO_OBJECTS_TO_VOID.equals(sig) || SIG_STRING_AND_OBJECT_ARRAY_TO_VOID.equals(sig))) {
            checkForProblemsWithLoggerParameterisedMethods(sig);
        }
    }
1329962
public void configLogger()
    {
        Map<String, Level> logLevels = new HashMap<String, Level>();
        logLevels.put("trace", Level.TRACE);
        logLevels.put("debug", Level.DEBUG);
        logLevels.put("info", Level.INFO);
        logLevels.put("warning", Level.WARNING);
        logLevels.put("error", Level.ERROR);

        if( this.get("logging_log_type", "file").equals("file") ){

            DateFormat dateFormat = new SimpleDateFormat(this.get("logging_current_date_format","yyyy-MM-dd"));
            Date date = new Date();
            String logFileName = (this.get("logging_file_format", "current_date").equals("current_date")) ? dateFormat.format(date) + ".log" : this.get("logging_file_format", "current_date") + ".log";
            Configurator.defaultConfig()
                .writer(new FileWriter(this.get("logging_file_path", "src/main/java/resources/") + logFileName, (this.get("logging_buffered", "false").equals("true")) ? true : false, (this.get("logging_append", "true").equals("true")) ? true : false))
                .level((logLevels.containsKey(this.get("logging_level","debug"))) ? logLevels.get(this.get("logging_level","debug")) : Level.INFO)
                .activate();

        }else if( this.get("logging_log_type", "file").equals("both") ){

            DateFormat dateFormat = new SimpleDateFormat(this.get("logging_current_date_format","yyyy-MM-dd"));
            Date date = new Date();
            String logFileName = (this.get("logging_file_format", "current_date").equals("current_date")) ? dateFormat.format(date) + ".log" : this.get("logging_file_format", "current_date") + ".log";
            Configurator.defaultConfig()
                .writer(new ConsoleWriter())
                .addWriter(new FileWriter(this.get("logging_file_path", "src/main/java/resources/") + logFileName))
                .level((logLevels.containsKey(this.get("logging_level","debug"))) ? logLevels.get(this.get("logging_level","debug")) : Level.INFO)
                .activate();

        }else{

            Configurator.defaultConfig()
                .writer(new ConsoleWriter())
                .level((logLevels.containsKey(this.get("logging_level","debug"))) ? logLevels.get(this.get("logging_level","debug")) : Level.INFO)
                .activate();

        }
    }
685246
function Log(namespace) {
  // If it's called without new, still return a new instance.
  if (!(this instanceof Log)) { return new Log(namespace); }

  // Configure Log if it hasn't already
  if (!logger) { Log.configure(); }

  // This gets all of the log levels and applies them to this
  Object.keys(logger.levels).forEach(function (level) {
    if (!namespace) {
      this[level] = logger[level].bind(logger);
      return;
    }

    this[level] = function () {
      var args = Array.prototype.slice.call(arguments);
      args.unshift('[' + namespace + ']');
      logger[level].apply(logger, args);
    };

  }, this);
}
459888
function Logger() {
  /**
   * Write a simple log
   * @param {String|Object} message Message of body
   * @param {...*} [params] format the message body
   */
  this.log = function (message, params) {
    if (this.level() > 1) return;
    if (arguments.length > 1) message = String.prototype.format.apply(message, Array.prototype.slice.call(arguments, 1));
    message = this._prepareMessage('LOG', message);
    console.log(message);
    this._logToFile(message);
  };

  /**
   * Write a warning log
   * @param {String|Object} message Message of body
   * @param {...*} [params] format the message body
   */
  this.warn = function (message, params) {
    if (this.level() > 2) return;
    if (arguments.length > 1) message = String.prototype.format.apply(message, Array.prototype.slice.call(arguments, 1));
    message = this._prepareMessage('WARNING', message);
    console.warn(message);
    this._logToFile(message);
  };

  /**
   * Write a debug log
   * @param {String|Object} message Message of body
   * @param {...*} [params] format the message body
   */
  this.debug = function (message, params) {
    if (this.level() > 0) return;
    if (arguments.length > 1) message = String.prototype.format.apply(message, Array.prototype.slice.call(arguments, 1));
    message = this._prepareMessage('DEBUG', message);
    console.log(message);
    this._logToFile(message);
  };


  /**
   * Write an error message
   * @param {String|Object} message Message of body
   * @param {...*} [params] format the message body
   */
  this.error = function (message, params) {
    if (this.level() > 3) return;
    if (arguments.length > 1) message = String.prototype.format.apply(message, Array.prototype.slice.call(arguments, 1));
    message = this._prepareMessage('ERROR', message);
    console.error(message);
    this._logToFile(message);
  };


  /**
   * Prepares message
   * @param type What kind of message will be prepared
   * @param message What is the message
   * @returns {String}
   * @private
   */
  this._prepareMessage = function (type, message) {
    var simple = {
      type: this.colorType(type),
      message: typeof message == 'string' ? message : os.EOL + "{0 j 4}".format(message),
      var: defaults
    };
    switch (this.get('type')) {
      case 'simple':
        return this.get('simple').format(simple);
      case 'withFile':
        return this.get('withFile').format(Object.assign(simple, this._getActiveFunction()));
      default:
        var now = new Date();
        var date = this.get('dateFormat').format({
          year: now.getFullYear(),
          month: now.getMonth() + 1,
          day: now.getDate()
        });
        var time = this.get('timeFormat').format({
          hour: now.getHours(),
          minute: now.getMinutes(),
          second: now.getSeconds()
        });
        return (this.get(this.get('type')) || "").format(Object.assign(simple, {
          date: date,
          time: time
        }, this._getActiveFunction()));
    }
  };

  /**
   * Logs to file
   * @param message
   * @private
   */
  this._logToFile = function (message) {
    var now = new Date();
    var date = this.get('fileDateFormat').format({
      year: now.getFullYear(),
      month: now.getMonth() + 1,
      day: now.getDate()
    });
    var location = path.resolve(process.cwd(), this.get('dir'), this.get('fileFormat').format({date: date}));
    fs.appendFile(location, (message + os.EOL).replace(/\x1B\[\d+m/g, ''), function() {});
  };


  /**
   * Detect recording level
   * @returns {number}
   */
  this.level = function () {
    switch (this.get('level')) {
      case 'DEBUG':
        return 0;
      case 'LOG':
        return 1;
      case 'WARN':
        return 2;
      case 'ERROR':
        return 3;
      default:
        return 0;
    }
  };

  /**
   * Colored type
   * @returns {String}
   */
  this.colorType = function (type) {
    switch (type) {
      case 'DEBUG':
        return type.yellow;
      case 'LOG':
        return type.magenta;
      case 'WARN':
        return type.cyan;
      case 'ERROR':
        return type.red;
      default:
        return type;
    }
  };


  /**
   * Changes a default setting
   * @param {String} setting
   * @param {*} value
   * @return {String}
   */
  this.set = function (setting, value) {
    return defaults[setting] = value
  };


  /**
   * Gets a default setting
   * @param {String} setting
   * @return {String}
   */
  this.get = function (setting) {
    return defaults[setting]
  };


  /**
   * Finds file name that executing
   * @param {Number} [at] Stack position
   * @returns {{file: String, line: String}}
   * @private
   */
  this._getActiveFunction = function (at) {
    var temp = {};
    var stackTraceLimit = Error.stackTraceLimit;
    var prepareStackTrace = Error.prepareStackTrace;
    Error.stackTraceLimit = Infinity;

    Error.prepareStackTrace = function (dummyObject, v8StackTrace) {
      return v8StackTrace
    };
    Error.captureStackTrace(temp);

    var stack = temp.stack[at || 3];
    Error.prepareStackTrace = prepareStackTrace;
    Error.stackTraceLimit = stackTraceLimit;

    var file = stack["getEvalOrigin"]().split(/\\|\//).pop().blue;
    var line = stack["getLineNumber"]().toString().magenta;
    return {file: file, line: line};
  };

  /**
   * Check's logging directory's existence, if not then creates
   */
  this.checkDirectory = function () {
    var location = (path.resolve(process.cwd(), this.get('dir')));
    var dirs = location.split(path.sep), root = "";

    while (dirs.length > 0) {
      var dir = dirs.shift();
      if (dir === "") root = path.sep;
      if (!fs.existsSync(root + dir)) fs.mkdirSync(root + dir);
      root += dir + path.sep;
    }
  };

  this.checkDirectory();
}
40035
public static double normalizeLogProps(double[] logProps) {
        double logPropSum = DoubleArrays.logSum(logProps);
        if (logPropSum == Double.NEGATIVE_INFINITY) {
            double uniform = FastMath.log(1.0 / (double)logProps.length);
            for (int d = 0; d < logProps.length; d++) {
                logProps[d] = uniform;
            }
        } else if (logPropSum == Double.POSITIVE_INFINITY) {
            int count = DoubleArrays.count(logProps, Double.POSITIVE_INFINITY);
            if (count == 0) {
                throw new RuntimeException("Unable to normalize since sum is infinite but contains no infinities: " + Arrays.toString(logProps));
            }
            double constant = FastMath.log(1.0 / (double) count);
            for (int d=0; d<logProps.length; d++) {
                if (logProps[d] == Double.POSITIVE_INFINITY) {
                    logProps[d] = constant;
                } else {
                    logProps[d] = Double.NEGATIVE_INFINITY;
                }
            }
        } else {
            for (int d = 0; d < logProps.length; d++) {
                logProps[d] -= logPropSum;
                assert(!Double.isNaN(logProps[d]));
            }            
        }
        return logPropSum;
    }
872773
public Object apply(Object pValue,
                        Object pContext,
                        Logger pLogger)
            throws ELException {
        if (pValue == null) {
            /*
            if (pLogger.isLoggingWarning ()) {
          pLogger.logWarning
            (Constants.ARITH_OP_NULL,
             getOperatorSymbol ());
            }
            */
            return PrimitiveObjects.getInteger(0);
        } else if (pValue instanceof String) {
            if (Coercions.isFloatingPointString(pValue)) {
                double dval =
                        ((Number)
                                (Coercions.coerceToPrimitiveNumber
                                        (pValue, Double.class, pLogger))).
                                doubleValue();
                return PrimitiveObjects.getDouble(-dval);
            } else {
                long lval =
                        ((Number)
                                (Coercions.coerceToPrimitiveNumber
                                        (pValue, Long.class, pLogger))).
                                longValue();
                return PrimitiveObjects.getLong(-lval);
            }
        } else if (pValue instanceof Byte) {
            return PrimitiveObjects.getByte
                    ((byte) -(((Byte) pValue).byteValue()));
        } else if (pValue instanceof Short) {
            return PrimitiveObjects.getShort
                    ((short) -(((Short) pValue).shortValue()));
        } else if (pValue instanceof Integer) {
            return PrimitiveObjects.getInteger
                    ((int) -(((Integer) pValue).intValue()));
        } else if (pValue instanceof Long) {
            return PrimitiveObjects.getLong
                    ((long) -(((Long) pValue).longValue()));
        } else if (pValue instanceof Float) {
            return PrimitiveObjects.getFloat
                    ((float) -(((Float) pValue).floatValue()));
        } else if (pValue instanceof Double) {
            return PrimitiveObjects.getDouble
                    ((double) -(((Double) pValue).doubleValue()));
        } else {
            if (pLogger.isLoggingError()) {
                pLogger.logError
                        (Constants.UNARY_OP_BAD_TYPE,
                                getOperatorSymbol(),
                                pValue.getClass().getName());
            }
            return PrimitiveObjects.getInteger(0);
        }
    }
918023
public static void tryLogForMessage(long now,
            final long maxLogInterval,
            final TimeUnit maxLogIntervalUnit,
            final VoltLogger logger,
            final Level level, String format, Object... parameters) {
        Callable<RateLimitedLogger> builder = new Callable<RateLimitedLogger>() {
            @Override
            public RateLimitedLogger call() throws Exception {
                return new RateLimitedLogger(maxLogIntervalUnit.toMillis(maxLogInterval), logger, level);
            }
        };

        final RateLimitedLogger rll;
        try {
            rll = m_loggersCached.get(format, builder);
            rll.log(now, level, null, format, parameters);
        } catch (ExecutionException ex) {
            Throwables.propagate(Throwables.getRootCause(ex));
        }
    }
242390
function logWrap(level) {
    return function log() {
      let context, message, args, trace, err;

      if (arguments[0] instanceof Error) {
        // log.<level>(err, ...)
        context = API.getContext();
        args = Array.prototype.slice.call(arguments, 1);
        if (!args.length) {
          // log.<level>(err)
          err = arguments[0];
          message = err.name + ': ' + err.message;
        } else {
          // log.<level>(err, "More %s", "things")
          // Use the err as context information
          err = arguments[0];
          message = arguments[1];
          args = Array.prototype.slice.call(args, 1);
        }
      } else if (arguments[0] == null || (typeof (arguments[0]) !== 'object' && arguments[0] !== null) ||
          Array.isArray(arguments[0])) {
        // log.<level>(msg, ...)
        context = API.getContext();
        message = arguments[0];
        args = Array.prototype.slice.call(arguments, 1);
      } else {
        // log.<level>(fields, msg, ...)
        context = merge(API.getContext(), arguments[0]);
        message = arguments[1];
        args = Array.prototype.slice.call(arguments, 2);
      }

      trace = API.format(level, context || {}, message, args, err);
      API.stream.write(trace + '\n');
    };
  }
1164559
def log1p(x, context=None):
    
    return _apply_function_in_current_context(
        BigFloat,
        mpfr.mpfr_log1p,
        (BigFloat._implicit_convert(x),),
        context,
    )
1266447
@Override
    public LogProperties logProperties()
    {
        if (tc.isDebugEnabled())
            Tr.debug(tc, "logProperties", _fileLogProperties);
        return _fileLogProperties;
    }
1233564
public static double logSubtract(double x, double y) {
        if (FastMath.useLogAddTable) {
            return SmoothedLogAddTable.logSubtract(x,y);
        } else {
            return FastMath.logSubtractExact(x,y);
        }
    }