Skip to content

rahji.com

ancient stuff

  • About your browser
  • About your server
  • Scientific Notation
  • Perl Programming Course Materials
    • Instructor Roadmap
    • Outline with Timeline
    • My Original Notes
    • Students’ Outline
    • Student Handouts
    • Exercises
    • Extra Exercises
    • Links

Mapping a value to a new range

A handy formula that I usually have to look for when I need it – make a value fall into a specific min-max range. This is the math that gives you a new, scaled up or down, value.

(x - original_min) * (new_max - new_min) /
(original_max - original_min) + new_min


Author rob duartePosted on October 11, 2010February 7, 2017Categories Electronics and Creative CodingTags programming math map processing arduino range

Post navigation

Previous Previous post: 20 Challenges
Next Next post: rdqcutils Quartz Composer plugin
  • About your browser
  • About your server
  • Scientific Notation
  • Perl Programming Course Materials
    • Instructor Roadmap
    • Outline with Timeline
    • My Original Notes
    • Students’ Outline
    • Student Handouts
    • Exercises
    • Extra Exercises
    • Links
rahji.com Proudly powered by WordPress