How does gain impact traceability/useability of TSL2591/AS7262/As7263 readings?

I've been playing around with measuring lux (TSL2591and μW/cm² (As7262 and AS7263). I've gotten teh example serial read codes from the respecivve Adafruit and sparkfun libraries working:

After working trough the basic introductions provided by the website I was suprised when I noticed both sensors had configurable gain settings.

The TSL2591 by defult is first set to 25x gain and then lateri n the library set to 1x.The AS726x library sets the gain to 64x by default. Both gain settings can be changed by calling the corresponding gain funtion with the sensor object.

I'll try to explain my toughts: when measuring a surface which corresponds to exactly 100 μW/cm² at the 500 nm range an ideal sensor with a gain of 64x will not be displaying 100 μW/cm², rather displaying 6400 μW/cm². Making it incredibly inaccurate.

As far as i know gain it is a flat multiplier thus making a gain of 64x the dafult makes the sendsor values wrong by a factor of 64x. The same goes for the lux sensor when the default value is not 1.

Now my question is, why do these sensors have gain settings and why does the AS726x library have a default gain which isnt 1x? Are my readings corresponding with the output parameters (lux for tsl259, μW/cm² for as726x) and of the sensor when using any gain other than 1x?

why does the AS726x library

Ask the author of the library.

The device data sheets are your best source of advice. For the AS7263, gain = 16x is used in the specifications summarized in Figure 12 of the data sheet, and results in the given typical output sensitivity.

If you want to use this device quantitatively, you will have to calibrate each one using known intensity/wavelength standards, using any of the several possible gain settings.