c - Get decimal value after dividing by a large number -


i have code:

#include <stdio.h>  int main(void) {     double infre = 11e10;     double c = 2.99795e8;     double wavelength = c/infre;     double delx = 0.600000000e-04;      double nperdt = 2*((int)(wavelength/delx));     double dt = 1.0/infre/(double)nperdt;     printf("%.11f", dt);     return 0; } 

now dt supposed small. there can value upon division i'm getting 0.0

well can try example increase digits showed after ".". seems value rests somewhere in range of 10^-13 , showing first 11 digits after decimal point. example "%.19f" display non-zero result. additionally can print them in exponential format using %e, preferred solution in situation.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -