p5.js round() function Last Updated : 23 Aug, 2023 Comments Improve Suggest changes Like Article Like Report The round() function in p5.js is used to calculate the round value of a number. It calculates the integer closest to the number. Syntax round(number) Parameters: The function accepts only one parameter as mentioned above and described below: number : This parameter stores the number to compute. Below program illustrates the round() function in p5.js: Example: javascript function setup() { //create Canvas of size 270*80 createCanvas(270, 80); } function draw() { background(220); //initialize the parameter let x = 67.54; //call to round() function let y = round(x); textSize(16); fill(color('red')); text("Given Number is : " + x, 50, 30); text("Computed Number is : " + y, 50, 50); } Output: Reference: https://p5js.org/reference/#/p5/round Comment More infoAdvertise with us Next Article p5.js round() function S sarthak_ishu11 Follow Improve Article Tags : JavaScript Web Technologies JavaScript-p5.js Similar Reads p5.js pow() function The pow() function in p5.js is used to calculate the power of a number to the given number. It is an efficient way of multiplying numbers by themselves (or their reciprocals) in large quantities. Syntax pow( n, e ) Parameters: The function accepts two parameters as mentioned above and described belo 1 min read p5.js str() function The str() function in p5.js is used to convert the given boolean, string and number value into its string representation. Syntax: str(value) Parameters: This function accepts single parameter value which is to be converted into its string representation. This value might be integer, float, string, b 2 min read p5.js sqrt() function The sqrt() function in p5.js is used to get the square root of any input number. Syntax: sqrt(n) Parameters: This function accepts single parameter n which is an input non-negative number whose square root is being calculated. Return Value: It returns the square root of any input number. Below progr 1 min read p5.js sq() function The sq() function in p5.js is used to calculate the square value of a number. The square of a number is always positive. Syntax sq(number) Parameters: The function accepts only one parameter as mentioned above and described below: number: This parameter stores the number to compute. Below program il 1 min read p5.js radians() Function The radians() function in p5.js is used to convert a given degree measurement value to its corresponding value in radians. Syntax: radians( degrees ) Parameters: This function accepts single parameter degrees which is to be converted into radians. Return Value: It returns the converted radians value 2 min read Like