What is round function and trunc function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is round function and trunc function

explain them in simple English

26th Feb 2017, 8:33 PM
Rupam Das
Rupam Das - avatar
2 Answers
+ 6
Round rounds down up to half and up above half, while trunc just truncates the number to the base. round(6.2) = 6 round(6.8) = 7 trunc(6.2) = 6 trunc(6.8) = 6
26th Feb 2017, 8:35 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
round function will run it to the nearest integer. trunc will chop it off. kind of like the floor function
26th Feb 2017, 8:35 PM
Michael Szczepanski
Michael Szczepanski - avatar