Why does the "Map Range" node fail for values above 10,000? I have a "Map Range" node with the following inputs:



Because 10,000 is right in the middle between 9,995 and 10,005, I expect the output to be 0.5, and indeed it is.

If I now increase the value by one:



I expect the value to be 0.6, but instead the node outputs 1.0. Even if I put the value ever so slightly above 10,000 (say, 10,000.001), I still get 1.0 as the result.

If I decrease the value to 9,999 instead, I get a result of 0.4 as I expect.

So clearly the behavior changes precisely at the 10,000 mark. What limitation am I running into? Is this documented somewhere? Are there other places where I need to be aware of similar issues when doing calculations in the compositor?

If it matters, this is 2.79b 64bit on Windows 10, but I'm getting the same behavior in 2.72b on Linux Mint.
By viewing the source of this node in:

source/blender/compositor/operations/COM_MapRangeOperation.cpp


We see in line 46 this comment:

/* The code below assumes all data is inside range +- this, and that input buffer is single channel */
#define BLENDER_ZMAX 10000.0f


So it is not a bug, this range is defined by the developers for some reason. If the input value is larger than BLENDER_ZMAX then the To Max input is returned, if the input value is less than negative BLENDER_ZMAX then To Min is returned.