For now i found this solution: I changed a pressureAvg and pressureSamples to unsigned int. Next changed int forecast = sample(pressure) to int forecast = sample(pressure * 10) to avoid big precision lost. Sample function still may need correction but probably it is a good and easy way to fix this problem. Result: Sketch uses 18,636 bytes (60%) of program storage space. Maximum is 30,720 bytes. Global variables use 1,268 bytes (61%) of dynamic memory, leaving 780 bytes for local variables. Maximum is 2,048 bytes.