This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Name

log()

Examples
void setup() {
  int i = 12;
  println(log(i));
  println(log10(i));
}

// Calculates the base-10 logarithm of a number
float log10 (int x) {
  return (log(x) / log(10));
}
Description Calculates the natural logarithm (the base-e logarithm) of a number. This function expects the n parameter to be a value greater than 0.0.
Syntax
log(n)
Parameters
n float: number greater than 0.0
Returnsfloat
Updated on October 2, 2018 05:02:06pm EDT

Creative Commons License