# Range node confusion

**URL:** <https://discourse.nodered.org/t/range-node-confusion/16164>\
**Category:** General\
**Created:** [1 October 2019 16:53 UTC](https://discourse.nodered.org/t/range-node-confusion/16164 "2019-10-01T16:53:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [1 October 2019 16:53 UTC](https://discourse.nodered.org/t/range-node-confusion/16164/1 "2019-10-01T16:53:44Z")

</div>

I am trying to get my head around the difference between "limit to" and "wrap within".  
They sound very similar. What is the difference ?

And a request; the pulldown menu talks about "target range", while the fields talk about "result range", could these be aligned ?

 ![27](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/2/2dacc4f55805c4f2e3136f04065c23761c684a0c.jpeg)

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [1 October 2019 18:07 UTC](https://discourse.nodered.org/t/range-node-confusion/16164/2 "2019-10-01T18:07:17Z")

</div>

"Limit" means that scaled values above the max will always return the max value -- scaled values below the min return the min value.

"Wrap" is similar to a modulo operation -- a value of 14 and a range of 0-10 should result in the output being 4. So when the output exceeds the max, it wraps around to the min value.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 October 2019 19:41 UTC](https://discourse.nodered.org/t/range-node-confusion/16164/3 "2019-10-01T19:41:35Z")

</div>

we can look to improve the info also.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [1 October 2019 19:59 UTC](https://discourse.nodered.org/t/range-node-confusion/16164/4 "2019-10-01T19:59:44Z")

</div>

> "Wrap" is similar to a modulo operation -- a value of 14 and a range of 0-10 should result in the output being 4. So when the output exceeds the max, it wraps around to the min value.

Ok i have to "wrap" my head around this one 😉

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [1 October 2019 21:18 UTC](https://discourse.nodered.org/t/range-node-confusion/16164/5 "2019-10-01T21:18:52Z")

</div>

For example an input 0 - 10 mapped to 0 - 100.

| mode | input | output |
| --- | --- | --- |
| scale | 12 | 120 |
| limit | 12 | 100 |
| wrap | 12 | 20 |

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [2 October 2019 13:55 UTC](https://discourse.nodered.org/t/range-node-confusion/16164/6 "2019-10-02T13:55:27Z")

</div>

TBH, I'm struggling a bit trying to think of a good use for the "wrap" mode...  
so if there's a simple use case, that would also be a nice addition to the info tab.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 October 2019 16:05 UTC](https://discourse.nodered.org/t/range-node-confusion/16164/7 "2019-10-02T16:05:16Z")

</div>

I need to wrap a 24 hour clock into a 12 hour clock.
