Script Preparation code:
Tests:
  • myFloat.toFixed(2)

  • myFloat.toPrecision(2)

  • Math.round(myFloat*100.0)/100.0

  • Bitwise: signed round ± to 2 places

  • Bitwise: UNsigned round ± to 2 places

  • myFloat.toFixed(0)

  • Math.round()

  • Bitwise: signed round ± to int

  • Bitwise: UNsigned round ± to int

  • Math.floor() round down

  • Math.trunc() round toward zero

  • Bitwise: round toward zero

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    myFloat.toFixed(2)
    myFloat.toPrecision(2)
    Math.round(myFloat*100.0)/100.0
    Bitwise: signed round ± to 2 places
    Bitwise: UNsigned round ± to 2 places
    myFloat.toFixed(0)
    Math.round()
    Bitwise: signed round ± to int
    Bitwise: UNsigned round ± to int
    Math.floor() round down
    Math.trunc() round toward zero
    Bitwise: round toward zero

    Fastest: N/A

    Slowest: N/A

Latest run results:

No previous run results

This benchmark does not have any results yet. Be the first one to run it!