TLDR:
It looks like you are using 1 AU = 1.496 bkm when calculating distance from parent at Aphelion/Perihelion, but 1 AU = 1.5 bkm when calculating current distance.
This results in very slight discrepancies between the Ap/Peri temperatures shown for a body, vs the actual temperatures experienced.
-----------------
Am I correct that DistanceToParent represents the distance to the surface of the parent body, and therefore is the appropriate value to use to calculate temperature?
(Moons use the value of their parent, of course.)
It seems that asteroids are using instead OrbitalDistance (distance to center of parent body).
This gives them very slightly lower temperatures in-game than would be expected by calculation.
It also seems that the aphelion/perihelion temperature calculation is using orbital distance (i.e. not subtracting out the radius of the star) for all bodies (not just asteroids), with the exception of non-asteroids with zero eccentricity.
This leads to a common situation for planets with low (but non-zero) eccentricity (and their moons) where the current surface temp in game is above the displayed min/max temp range.
EDIT: Maybe something even simpler is going on.
For all zero-eccentricity non-moon system bodies (excluding Sol) in my database, the value (as calculated by SQLite) of OrbitalDistance / DistanceToParent
is between
1.00267379679165
and
1.00267379679124
For 8330 of the 8665 such bodies, the value is exactly
1.00267379679144
For a body with zero eccentricity, we would expect this ratio to either be exactly 1 for all bodies (if both values convey the distance from center of body to center of parent), or we would expect that ratio to vary significantly from body to body (if one value conveys the center-to-center distance, while the other conveys surface-to-surface or center-to-surface).
Since these ratios vary only a tiny amount, perhaps both values convey center-to-center distance, but some kind of rounding or unit conversion is happening differently in their calculations?
EDIT 2:
I bet it's conversion of km to AU.
1 AU = 1.496e+8 km
If you use 1.5 in one place, and 1.496 in the other, you'd have differences by a factor of 1.5/1.496 = 1.00267379679144
.
SJW: Great spot! For some reason, I have two constants. AUKM and KMAU, with them set to 1.496 and 1.5. I'll fix it for v2.6. Thanks.