float division returns zero

Sorry for this dumb question, i have this code which is part of a very large code i have remove the unnecessary (imho) parts of the large code block and pasted relevant part.

 float t= 10.0 / 15890000 ; 
            Serial.print("pct:");
            Serial.println(t,5);

and the output of this code is strange

pct:0.00000

any ideas what i am doing wrong.

It looks like it's working correctly.

10/15890000 = 0.00000062932662

TrySerial.println(t,10);

sansknowledge:

 float t= 10.0 / 15890000 ;

any ideas what i am doing wrong.

One thing I think you're doing wrong, (unless you're using a Due), is that a literal that size, (15890000) should be suffixed with L or UL to indicate a 'long' or 'unsigned long' literal constant. In this case, L is sufficient.
ie 15890000L

If you don't do that, it's interpreted as a 16-bit int, and can only have a max value of 32767.
If using an Arduino Due, an int is 32-bit, but for UNO, Mega etc it's 16-bit.

By the way, did you document what 15890000 represents, in the code?

@DrAzzy ,@UKHeliBob , yes I went up to seven and missed the 10 :slight_smile: ,Thanks @OldSteve well this calculation is part of a slightly big code which contains the declaration portion as unsigned long and @aarg yes i have documented it properly.

Thanks for all the time and efforts guys.