Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

100
Views
Convert rads to degrees and return absolute value for 360

How do I convert rads to degrees and return absolute value for 360 degrees. That is, once it gets past 180 it continues to 359, then to 0.

The following returns positive degrees, but only in the 180 range.

console.log(Math.abs(rads * (180/Math.PI)));

The purpose for this is that I want to return numbers in a compass up to 360 degrees, and not show negative numbers.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Assuming you don't want to use negative values for angles.

const rads = 8;
console.log(Math.abs(360- rads * (180/Math.PI)))

about 4 years ago · Juan Pablo Isaza Report

0

This works for me:

rads * (180 / Math.PI)) + 180
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!