For osx I can recommend Numi: https://numi.app/ It’s the beautiful love child of a text editor and a calculator, that makes it supremely easy to go back and edit your calculations.

For Android I can recommend microMathematic Plus ("μMath+" for short).[0]

[0] https://github.com/mkulesh/microMathematics