Skip to content

Commit f01981d

Browse files
authored
Merge pull request #383 from theintel - Added Notes & Warnings for map()
Added Notes & Warnings for map() function
2 parents dab95c4 + 4ef1d7a commit f01981d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Language/Functions/Math/map.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,10 @@ long map(long x, long in_min, long in_max, long out_min, long out_max)
9898
}
9999
----
100100

101+
[float]
102+
=== Notes & Warnings
103+
104+
As previously mentioned, the map() function uses integer math. So fractions might get suppressed due to this. For example, fractions like 3/2, 4/3, 5/4 will all be returned as 1 from the map() function, despite their different actual values. So if your project requires precise calculations (e.g. voltage accurate to 3 decimal places), please consider avoiding map() and implementing the calculations manually in your code yourself.
105+
101106
--
102107
// HOW TO USE SECTION ENDS

0 commit comments

Comments
 (0)