- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I am biting the bullet and building my own output for all variables in my code so that I can easily track down differences in variables in order to ensure that changes made to the code do not impact the results. In order to do this, I need all reals output as hexadecimal. Does anyone know an easy way to do this?
- Marcas:
- Intel® Fortran Compiler
Link copiado
3 Respostas
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Did you look at the Z format descriptor?
The Z data edit descriptor transfers hexadecimal (base 16) values. It takes the following form:
Zw[.m]
The value of m (the minimum number of digits in the constant) must not exceed the value of w (the field width). The m has no effect on input, only output.
The specified I/O list item can be of type integer, real, or logical.
The Z data edit descriptor transfers hexadecimal (base 16) values. It takes the following form:
Zw[.m]
The value of m (the minimum number of digits in the constant) must not exceed the value of w (the field width). The m has no effect on input, only output.
The specified I/O list item can be of type integer, real, or logical.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Well, moderately easy :-).
real:: f = 2.71828
write(*,"(Z8.8)") TRANSFER(f,1)
Maybe it would work even without TRANSFER (which performs bit-by-bit conversion from 1st argument to type of second argument), but I'm not sure.
Jugoslav
real:: f = 2.71828
write(*,"(Z8.8)") TRANSFER(f,1)
Maybe it would work even without TRANSFER (which performs bit-by-bit conversion from 1st argument to type of second argument), but I'm not sure.
Jugoslav
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Thanks Jugoslav. Your intuition is correct. I can use the internal write without the TRANSFER function to convert. I was originally hoping to do this but, As usual, the manual is as clear as mud regarding how to do this. Your are a scholar and a gentleman!

Responder
Opções do tópico
- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora