Further research into this shows the problem is with division. For example, this equation

$T/1.0

works okay, every pixel is the same as before,

but this equation

$T / $T

changes every pixel to 65535 (unsigned 16 bit integer formatting)

it should have been 1 for each pixel (e.g., 100 / 100 = 1)

There's no problem there. PixInsight natively works with floating point numbers in the range 0.0-1.0

But if you choose to display the pixel values as 16 bit integers then they will be displayed in the range 0-65535

You could equally choose to display them as 8 bit integers in the range 0-255

The answer to your original question:

y = 0.99 *x + 140/x + 318.0

depends on the range of values that your version of x is allowed to take.

I'm guessing your x is in the range 0-65535 and your constants are compatible with the same range, then the PixelMath formula you want is:

(0.99*($T*65535)+140/($T*65535) + 318)/65535

This is because PixelMath values of x are natively in the range 0.0-1.0 and the result of the expression needs to be in the same range.

Mark