NTC Thermistor in Pull-up Config

The code below is what i have made pretty much solely based off the thermistor 2 example that is on aurdinos library. I added a lcd display and made it control the relay to my car fan using a npn transistor. The display all works, using a 2x16 LCD and a sainsmart nano V3.0 but the program wont display the temp in degrees only the millivolts. I cant seem to figure it out, look over my code and see what rookie mistake i made?

const int fanMOSFET = 9;//fan transistor not a mosfet anymore
#include <math.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);

double thermistor (int RawADC){ //this function is suppose to calculate into kelvin
 long res; //for the pull up resistor
 double temp;
 res = 3950.0 / (1024/RawADC- 1);//br bl or (x 4 series)
 temp = log(res); //temp --temporary value
 temp = 1 / (0.001465721734 + (0.0002322546976 * temp)+ (0.0000009030452298 * (temp * temp * temp))); // uses steinhart-hart formula used a calculator for my thermistor
 temp = temp - 273.15; //converts kelvin to celcius
}
 
#define ThermistorPIN 0 // is this supposed to go here??

void setup(){
 //Serial.begin(9600);// i never tried using this
 delay(1000);
 digitalWrite (fanMOSFET, LOW); //fan off for vehicle start
 lcd.begin (16, 2);
 lcd.print ("Fan Off"); //use as a check
 delay(1000);
 lcd.clear();
}

double temp; // what is this for?
void loop(){
 lcd.clear();
 lcd.setCursor(8,0);// these are to print multiple values before clearing the screen
 int tempValue = analogRead (ThermistorPIN);
 float tempMVolt = (tempValue/1023.0)*5.0;//calibrate
 lcd.print("mV");
 lcd.setCursor(12,0);
 lcd.print(tempMVolt, 3); // this section works and displays correctly
 //delay(100);
 //float tempC = (tempMVolt - .5) * 100; // using TMP36
 temp = thermistor (analogRead (ThermistorPIN));
 lcd.setCursor(0,0);
 lcd.print("Deg C");
 lcd.setCursor(0,1);
 lcd.print(temp, 3);// always displays temp as 0.00...???????
 //delay(100);
 if (temp > 83.0){ //switches fan on or off as per calculated temp
   digitalWrite (fanMOSFET, HIGH);
   lcd.setCursor (7,1);
   lcd.print ("Fan ON");
 }
 else if (temp < 73.0){
   digitalWrite (fanMOSFET, LOW);
   lcd.setCursor (7,1);
   lcd.print ("Fan OFF");
 }
 delay(200);//so i can read the display before it changes
 
}

Welcome to the forum.

Mistake #1--Posting your code without using code tags. Please click on the </> icon at the left end of the tool bar, and post your code between the tags so it looks like this
Many rookies make this mistake on their first post. You can actually fix this by going back to your original post, highlighting the code, and then selecting the </>. Your code will then post correctly.

Mistake #2--There is no return statement in the thermistor function. If a function returns a value, it must have a return statement that specifies the value to return.

double thermistor (int RawADC){ //this function is suppose to calculate into kelvin
  long res; //for the pull up resistor
  double temp;
  res = 3950.0 / (1024/RawADC- 1);//br bl or (x 4 series)
  temp = log(res); //temp --temporary value
  temp = 1 / (0.001465721734 + (0.0002322546976 * temp)+ (0.0000009030452298 * (temp * temp * temp))); // uses steinhart-hart formula used a calculator for my thermistor
  temp = temp - 273.15; //converts kelvin to celcius
  return temp; //<< add return statement to function
}

Maybe Mistake #3--I'm not sure the thermistor function has correct math, and I'm not sure how you have the thermistor wired when you use the term "pullup resisitor" with reference to a voltage divider, but if the function doesn't return a correct temperature once it is returning one we can work on #3.

So, I have added the return line I'll check that it works tomorrow. The math should be right using the equation for pull up ( layed out as below).

Vref --- 4k resistor bank--|--NTC Thermistor (3k at 20C)---GND
|
A0

I also have a capacitor in there to filter out the noise from the spark plugs and an old rectifier off the engine. When i plugged it in the first time the LCD just displayed random characters when the engine was running have a couple filters to control the noise.