p5.js | log() function
The log() function in p5.js is used to get the natural logarithm (of base “e”) of any number taken as input for the parameter of log() function.
Parameters: This function accepts a single parameter x which is any number greater than zero (0) taken as the input whose natural log is going to be calculated.
Return Value: It returns the natural log of any input number greater than zero (0).
Below program illustrates the log() function in p5.js:
Example: This example uses log() function to get the natural log value of any input number.
Note: If we take input as a negative value and zero then it returns the output as “NaN” and -Infinity respectively.
My Personal Notes arrow_drop_up
Please Login to comment...