Arduino serial shows Nan

So I am trying to run this code to show this sum of angle of conductance and incremental conductance. Conductance is current over voltage. I have sensors connected to the Arduino to detect current and voltage. However when I run the code, it displays Nan. I think the value of the angle could be zero or undefined hence it is not a number. I have included the main part of the code that is not working as I planned. PLease let me know what I can do.

   deltaV = Vin_new - Vin_old;
   deltaC = Cin_new - Cin_old;
   theta = (atan(Cin_new/Vin_new) + atan(deltaC/deltaV)) * 180/3.14159265;

Vin could be values from 10-25V.
Cin from 0.5-2A.
Theta should be from -90 to 90.

But theta sometimes shows as Nan. I need to fix this.

This will give NaN when deltaV is zero - when the voltage hasn't changed since last time you read it.

You are right! When there is no change in voltage it gives a Nan. I have attached the Arduino serial output.

I am thinking of adding a code that when deltaV is 0, it will assign it a very small value instead. Do you guys know how to implement this?

What you really need is to think about how frequently you are sampling. If deltaV is often 0, then your samples are quicker than your voltage changes. You need to take a rolling average of some sort.