NTC Thermistor circuit, ADC conversion, compute temperature
I ran your code in Python and got 285 for adc_val = 1 and -84 for adc_val = 1023.  With an adc_val of 318, I get 25.9.  RT at that point is 4504.  So it looks like your equations should be right.  Are you sure it is being implemented correctly in terms of types?  It has to be all floating point.  If something is being cast to an integer or something, you could get some strange results.  

&gt;&gt;&gt; BETA = 3950
&gt;&gt;&gt; R25 = 4700
&gt;&gt;&gt; Vin = 5
&gt;&gt;&gt; Vref = 5
&gt;&gt;&gt; adc_val = 1
&gt;&gt;&gt; Vout = adc_val * (Vref / 1024.0)
&gt;&gt;&gt; RT   = 10000 / (Vin / Vout - 1.0)
&gt;&gt;&gt; T = (1 / (1/298.16 + 1/BETA * log(RT/R25 ))) - 273.15
&gt;&gt;&gt; T
285.3553121325664
&gt;&gt;&gt; adc_val = 1023
&gt;&gt;&gt; Vout = adc_val * (Vref / 1024.0)
&gt;&gt;&gt; RT   = 10000 / (Vin / Vout - 1.0)
&gt;&gt;&gt; T = (1 / (1/298.16 + 1/BETA * log(RT/R25 ))) - 273.15
&gt;&gt;&gt; T
-84.45667531777428
&gt;&gt;&gt; adc_val = 318
&gt;&gt;&gt; Vout = adc_val * (Vref / 1024.0)
&gt;&gt;&gt; RT   = 10000 / (Vin / Vout - 1.0)
&gt;&gt;&gt; RT
4504.249291784702
&gt;&gt;&gt; T = (1 / (1/298.16 + 1/BETA * log(RT/R25 ))) - 273.15
&gt;&gt;&gt; T
25.970525623383708