Why are val and val1 global? There are not used outside of loop(), are they? Why are they not called something meaningful like volt1 and volt2? In other words, why is only one numbered?
If you are looking for the type of a variable, by the time you get to the end of the line where finalval is defined, the type has scrolled off the screen. It is far better to declare one variable per line. Then the type is right there next to the variable.