This will probably be considered very simple, but I am just a beginner:

I'm developing a software application where temperatures need to be added and subtracted. Some temperatures are in Celsius, some in Kelvin. I know how to convert to/from Kelvin (273.15), but how should one go about adding and subtracting these? Should everything be converted to Celsius first?

For example:

0°C + 0°C = 0°C
0°C + 500°C = 500°C


But:

0°C + 273.15K = ?


If we put everything in Kelvin, we get:

273.15K + 273.15K = 546.3K


If we put everything in Celsius, we get:

0°C + 0°C = 0°C


But obviously, 546.3K isn't equals to 0°C.

Now, you might say I can't add temperature to temperatures (but should be adding energy or something? not sure). But the reason I'm doing this is because we need to interpolate. I have a collection of key-value-pairs, like this:

973K  -> 0.0025
1073K -> 0.0042
1173K -> 0.03
1273K -> 0.03


Now I need to get the value for 828°C. So I need to interpolate, which means adding/subtracting values.

I hope I'm making sense.

You may always add the numbers in front of the units, and if the units are the same, one could argue that the addition satisfies the rules of dimensional analysis.

However, it still doesn't imply that it's meaningful to sum the temperatures. In other words, it doesn't mean that these sums of numbers have natural physical interpretations. If one adds them, he should add the absolute temperatures (in kelvins) because in that case, one is basically adding "energies per degree of freedom", and it makes sense to add energies.

Adding numbers in front of "Celsius degrees", i.e. non-absolute temperatures, is physically meaningless, unless one is computing an average of a sort. This is a point that famously drove Richard Feynman up the wall. Read Judging books by their covers and search for "temperature". He was really mad about a textbook that wanted to force children to add numbers by asking them to calculate the "total temperature", a physically meaningless concept.

It only makes sense to add figures with the units of "Celsius degrees" if these quantities are inteprreted as temperature differences, not temperatures. As a unit of temperature different, one Celsius degree is exactly the same thing as one kelvin.

If you interpolate or extrapolate a function of the temperature, $f(T)$, you do it as you would do it for any other function, ignoring the information that the independent variable is the temperature. Results of simplest extrapolation/interpolation techniques won't depend on the units of temperatures you used.
