All this is very interesting but what's the real question? You have a 40V signal that you want to stuff into an Arduino?
If so, Chapter 4 of "Op Amps For Everyone" does a terrific job of describing how to offset and scale a signal in the context of a single rail op amp. The idea, of course, is to sell rail-to-rail input/output op amps. "Rail-to-rail" is a marketing term, not an engineering fact. But some op amps come pretty darn close. The LM358 isn't one of them!
http://web.mit.edu/6.101/www/reference/op_amps_everyone.pdf
There are many opamps with true rail to rail input voltage common mode ranges. In fact, there are quite a few opamps with inputs that go beyond each rail, typically by 100mV and 200mV (TSX711 for example).
It is quite right that rail to rail output is not exactly to the rails- how could it be- but it is not far off, certainly close enough to be effective in designs: turn off a MOSFET or BJT for example. And RRO opamps are generally far superior to opamps that run out of steam at some indeterminate voltage roughly a couple of volts from the supply rails, not only because of dynamic range, but also because RRIO opamps ease power supply requirements and simplify design. RRIO opamp outputs also limit in a more controlled and predictable way and tend not to suffer oscillations and phase reversal. RRIO opamps have also transformed low voltage nanopower circuits which would be virtually impossible without RRIO opamps, and RRIO parts have also played a big part in the development of handheld equipment: mobile phones, etc. RRO video amps have also simplified video designs.
RRIO opamps have transformed analogue design, and would also avoid the many errors that newbees make, because they are not experienced enough to read the data sheet and often get into a pickle with input and output ranges, especially with the old 709 and 741 opamps.
I find it difficult to understand why anybody bothers with non RRIO amps for general work, or opamps that have relatively large input voltage offsets and high input bias currents. It is a different mater for specialist applications like audio, or where extreme low cost is needed, and them the LM358 (input includes the negative supply rail and output approaches the negative supply rail) saves the day. When the LM358 type opamps came out, they opened up many avenues in design, and RRO opamps have continued that move, but to a greater extent.
RRIO opamps tend to be more expensive than jellybean opamps, but when you weigh up the costs of other components in a circuit, the opamp cost often is not that significant.
The TSX711, OPA191, OPA192 are good examples of RRIO opamps. Not only are they RRIO, but they have very low input offset voltages and negligible input bias currents, which gives you great freedom in design. Also, for newbees, they are 'perfect' opamps.
https://www.st.com/en/amplifiers-and-comparators/tsx711.htmlhttp://www.ti.com/lit/ds/sbos701a/sbos701a.pdfhttp://www.ti.com/lit/ds/symlink/opa192.pdfhttp://www.ti.com/lit/ds/symlink/lm158.pdfhttp://www.ti.com/lit/ds/symlink/ua741.pdf