float variables

Hello everyone…I have an arduino nano and a dht11 and I have a problem with float variables.I want to see in serial monitor for example 30.1 C degrees ,but I only get 30.00.
Code:

#include <dht.h>
dht DHT;
#define DHT11_PIN 3   

float hum;  
float temp; 

void setup()
{
    Serial.begin(9600);
}

void loop()
{
    double chk = DHT.read11(DHT11_PIN);
    hum = DHT.humidity;
    temp= DHT.temperature;
    Serial.print("Humidity: ");
    Serial.print(hum);
    Serial.print(" %, Temp: ");
    Serial.print(temp);
    Serial.println(" Celsius");
    delay(2000); 
}

An example for what I get:

Humidity: 42.00 %, Temp: 30.00 Celsius
Humidity: 42.00 %, Temp: 30.00 Celsius
Humidity: 42.00 %, Temp: 30.00 Celsius
Humidity: 42.00 %, Temp: 30.00 Celsius
Humidity: 43.00 %, Temp: 30.00 Celsius

Have you checked to see whether the DHT11 library returns fractional degrees?

I think your code should be fine. I have encountered a similar situation before, and I suppose that the sensor is incapable of detecting temperature like 30.1 ℃, so I went to check the data table. I found that its temperature resolution is 0.1 ℃, but most often, it can only detect a 2 ℃ change, so it is difficult to get a number like 30.1. Later I found another sensor DHT22, which can detect a smaller range of changes (0.5 ℃), just to meet my needs! I think it may be helpful to solve your problem too.

If all you need is temperature, I would recommend the DS18b20. It is more accurate than the DHT sensors. From the specs:

• Measures Temperatures from -55°C to +125°C
(-67°F to +257°F)
• ±0.5°C Accuracy from -10°C to +85°C
• Programmable Resolution from 9 Bits to 12 Bits
• No External Components Required

I suspect the DHT library you installed is returning an integer value. Where did you get that library? If you don't remember, it might be shown in DHT.h.