Set a MAX_DIGITS const at the top of your script like so (however big you like, alternatively use a variable that depends on screen size if you are masochistic and want more work for yourself):
const MAX_DIGITS: int = 10
To only check the whole number section of your value (which is typically how I see scientific notation used in calculators), cast your display value to a string, and call
.split(".", allow_empty = false, maxsplit = 1) on it. Assign the returned PoolStringArray value to a variable, and then check the 0th index's length.
split() splits your display value (which I assume is a float) into 2 elements: the whole value and the decimal [citation]. Calling
.length() on the 0th element will tell you how many digits are in your whole number (If you wanted to apply scientific notation to very small numbers, understanding this should make it clear how to do so, except you'd be checking the length of the 1st indexed element as well). Compare that int value representing the length of your whole number to your MAX_DIGITS const in a conditional statement, and if it is greater, use string formatting to get a new display value string like so:
"%sx10^%s" % [formatted_value, exponent] (or
%se%s, however you like to see it)
formatted_value is your whole number with a
"." inserted after the 0th element, and
exponent is just
whole_number.length() - 1
Just keep in mind that Godot does not have unlimited size for floats/ints. For ints the docs state
[-2^63, 2^63 - 1]. I'm not sure what it is for floats, though.
I was a little surprised to find how half-baked support for scientific notation seems, though. You can pass it to the int or float constructor, but as far as I can tell, that's the only reference the docs make to it.