Number to format statement

I remember seeing some code somewhere on the internet that would take a number (or maybe a string representation of that number) and convert it into the corresponding Fortran format statement (e.g., '0.1e+4''(E6.1E1)'). I can’t seem to locate it. Does anybody have that?

I found a perl thing that seems to do this: Fortran::Format - Read and write data according to a standard Fortran 77 FORMAT - metacpan.org

I know nothing about perl, so I can’t tell at a glance if this can be used as a standalone tool or if it’s only meant for consumption by perl scripts.

Edit: never mind, it seems this is only for formatting strings using Fortran edit descriptor syntax. It does not solve the inverse problem

I think the codes from Fortran Coder may match your description.

1 Like