Background
I am making a function that receives a positive number and then rounds the number to the closest integer bellow it.
I have been using Math.floor
, but recently I discovered Math.trunc
.
I am aware that both will return the same value, given a positive number, and that they work in completely different ways. I am interested in exploring this behavior.
Questions
- Which one is faster ?
- Which one should I use?