- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
do k=1,10
ibip=0
do j=0,15
if(btest(k,j))ibip=ibip+1
enddo
write(6,*)k,ibip
enddo
stop
end
Version 12.0.X give wrong results...version 11 is ok.
ibip=0
do j=0,15
if(btest(k,j))ibip=ibip+1
enddo
write(6,*)k,ibip
enddo
stop
end
Version 12.0.X give wrong results...version 11 is ok.
- Etiquetas:
- Intel® Fortran Compiler
Enlace copiado
5 Respuestas
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
The maximum bit positions for maximum integer, k=10, will be 4 that is j=0,3. This is the possible reason because of which you are getting wrong answer. I checked your code by ifort 12.0.3.167and it is giving wrong result because of wrong declaration. But, the gfortran compiler behaves differently and gives right answer with the present form of the code.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
> it is giving wrong result because of wrong declaration
What "wrong declaration"? The second argument to the intrinsic function btest(i, pos) is required to satisfy 0 pos < bit_size(i). Do you think there is a violation of this requirement in the test program?
What "wrong declaration"? The second argument to the intrinsic function btest(i, pos) is required to satisfy 0 pos < bit_size(i). Do you think there is a violation of this requirement in the test program?
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
This may be bug as I see some older posts. But this can be circumvented if we declare j = 0, 3. Moreover, I also noticed that the results are coming right up to j=0, 10. If we give j=0, 11 results go wrong.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
I don't see anything wrong with the source as posted. This is pretty much the exact same program as in the other thread. Clearly both of you read this somewhere - where?
Responder
Opciones de temas
- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla