I think, if the user enters in Here the code is: Output is: Your output is broken. You are actually writing the value of If you have written it: Then you will have output: now Obviously you have a round error. In this situation, you remove all decimal places by specifying 0.5 to t = 2.5 , then i will get 2 and 0.5 Separate 2 different variables but I am unable to do this.
$ export LT_LEAK_START = 1.5 $ echo $ LT_LEAK_START 1.5 #include & lt; Stdio.h & gt; # Include & lt; Stdlib.h & gt; # Include & lt; Time.h> Int main () {Double D; Time_t; Long NSE; D = Stroke (getenv ("LT_LEAK_START"), NULL); T = (Time_T) d; Nsec = D (double) ((time_t) d); Remove partial part as // time_t is not always complete Printf ("d =% lf \ n", d); Printf ("t =% u, nsec =% f \ n", d, nsec); }
# ./a.out d = 1.500000 t = 0, nsec = 0.000000 < / Div>
d in the following code twice:
nsec = d- (double) ((time_t) d); Remove partial part as // time_t is not always complete Printf ("d =% lf \ n", d); Printf ("t =% u, nsec =% f \ n", d, nsec);
nsec = d- (double) ((time_t) d); Remove partial part as // time_t is not always complete Printf ("d =% lf \ n", d); Printf ("t =% u, nsec =% f \ n", t, nsec);
d = 1.500000 t = 1, nsec = 0.000000
nsec , a
long . Instead
nsec a
float .
Comments
Post a Comment