Fortran - Length of Integer / Number of positions used -


this basic question can't seem find answer on google or through searching though forum (most due poor phraseology of problem).

i looking intrinsic fortran function give me number of positions used integer. mean is, if integer 12543 number of positions used 5 (it positive). reason want when using write statement formatted output can specify "w" in "iw" , use minimum spacing possible.

more specifically:

write(*,"(/ a,iw,1x,a,iw)") "all particles within radius ",radius, "of particle index number", p_o_i 

where radius , p_o_i specified user earlier on.

i can write achieve enough thought there must intrinsic function can achieve this.

i have been going through functions here without luck. help.

thanks responses! admit question misleading in requested intrinsic fortran function give number of positions used integer when not strictly required in first place. furthermore, general consensus seems not exist.

as advised francescalus , high performance mark, in order ensure minimum spacing possible used integer, "i0" edit description should used. previous example be:

write(*,"(/ 1x, a, i0, a, i0)") "all particles within radius ",radius, " of particle index number ", p_o_i 

should need find number of "characters" in integer (for other reason) best proposed response seems use of log10 function, advised steabert.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -