Business Format

Business Format

Some fortran compilers provide a non-standard business format, where numbers can be formatted to identify ,000 and for $1,230.00.
This is especially convenient when writing large numbers.
This is an output format only and does not conflict with , used as an input delimiter.
.
Does ifort provide for this formatting capability for both real and integer values ?
.
An example format is:
write (lu,9001) ' Testing array size =',m_i4, mb, iostat
9001 format (a, b'zz,zzz,zzz,zz#', 3x, b'zzz,zz#.##', ' mb : error code ', i0)
.
John

3 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

The problem with non-standard formats like that is, that they are, well, non-standard. The specific format code would probably different from compiler to compiler and possibly even vary between compiler versions.

The simplest and most robust solution is to create a formatting function yourself that does this:

character(len=20) :: business_number

integer :: number

business_number = business_format( number )

This should not be too hard to do - just write the number to a string, using an internal write and then insert commas in the right place

(Note that there is standard support for decimal points versus commas)

Regards,

Arjen

Just to close on this - no, Intel Fortran does not support a "business" format edit descriptor. Arjen makes a good suggestion. In general I recommend avoiding non-standard features whenever possible,

Steve - Intel Developer Support

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!