What is the Implementation of a Low, Mid or High Tone Dodge or Burn in GIMP?
It basically using what Photographers calls "Shadow Mask" / "Highlight Mask".

If the image is in the range [0, 1] "Highlight Mask" is actually the value of the pixel.
"Shadow Mask" is the inverse, namely 1 - Highlight Mask.

Use this mask as linear interpolator of the result with the originals.