I defined a lot of variables in my fortran code. All the variables are set to zero or very very close to 0 by default after I define it except one variable. That exceptional variable is set to “NAN”. (when I print out the vale of that variable, it is “NAN”). I thought the variables in FORTRAN code are set to 0 by default. Why is this particular variable exceptional?
I used pgf95 to compile my code “pgf95 -c -g -r8 main.f”
I defined a lot of variables in main.f like
double precision ::
& ph_o31d, ph_o33p, ph_no2, ph_no3o2, ph_no3o,
& ph_hno2, ph_hno3, ph_hno4, ph_h2o2, ph_ch2or,
& ph_ch2om, ph_ch3cho, ph_ch3coch3, ph_ch3coc2h5, ph_hcocho,
& ph_ch3cocho, ph_hcochest, ph_ch3o2h, ph_ch3coo2h, ph_ch3ono2,
& ph_hcochob, ph_macr, ph_n2o5, ph_o2, ph_pan,
& ph_acet, ph_mglo, ph_hno4_2, ph_n2o, ph_pooh,
& ph_mpan, ph_mvk, ph_etooh, ph_prooh, ph_onitr,
& ph_acetol, ph_glyald, ph_hyac, ph_mek, ph_open,
& ph_gly, ph_acetp, ph_xooh, ph_isooh, ph_alkooh,
& ph_mekooh, ph_tolooh, ph_terpooh
ph_acetp is set to NAN while the rest are 0
how to make compiler initialize variables to 0 by default?