Your formula for increasing contrast in an image throws away data, since everything below middle gray in the original image would become black, since negative values aren’t allowed.
The formula that most matches STLR, though, is to take the brightest pixel in the image, and make it white (255), brightening all other pixels by the same amount (through simple multiplication). It doesn’t throw away data, aside from rounding of floating point values to integers. If the darkest pixel in the image is a dark gray, it will become a lighter gray.
The formula that most matches the normalization in my implementation of Cardinal Baldwin is to take the brightest pixel in the image and make it white (255), taking the darkest pixel and making it black (0), and adjusting all other pixels accordingly, making some darker and some lighter. It subtracts, then multiplies. It doesn’t throw away data either.
(I’m assuming this is a grayscale image, i.e. black and white)