wrap angle

Compact view

Benchmark publishedon

Description

Normalize an angle, accounting for negative inputs

Setup

const PI2 = Math.PI*2;
var angle = 23;

Test Runner

Initializing...

Testing in
Test CaseOps/sec
wrap angle one line
angle = ((angle % PI2) + PI2) % PI2;
ready
wrap angle with case selection
if (angle < 0){
	angle = (angle % PI2) + PI2;
}
angle = angle % PI2;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

Revision 1
publishedon