Télécharger checsqrt.eso

Retour à la liste

Numérotation des lignes :

  1. C CHECSQRT SOURCE AM 12/02/28 21:15:08 7291
  2. Subroutine check_sqrt(x,Name_of_x,Name_of_subr,lerror)
  3.  
  4. c This subroutine checks the value of the variable x
  5. c (because x will be used in a sqrt in the calling subroutine after the return).
  6. c If (x.lt.0) or if (x is a NaN (Not a Number)),
  7. c then a message is printed and lerror = .true. is returned
  8.  
  9. logical lerror
  10. real*8 x
  11. character*20 Name_of_subr,Name_of_x
  12.  
  13. lerror = .false.
  14.  
  15. if (x.lt.0.d0) then
  16. ** write(2,1)Name_of_subr,Name_of_x,x
  17. write(*,1)Name_of_subr,Name_of_x,x
  18. 1 format(/' ERROR in subroutine ',A20/
  19. . ' The variable "',A20,'" is negative.'/
  20. . ' This would create problems because its square
  21. . root will be calculated.'/
  22. . ' The value of this variable is:',g10.3/)
  23. lerror = .true.
  24.  
  25. c elseif (isnan(x)) then
  26. c write(2,2)Name_of_subr,Name_of_x
  27. c write(*,2)Name_of_subr,Name_of_x
  28. c2 format(/' ERROR in subroutine ',A20,'.'/
  29. c . ' The variable "',A20,'" is a NaN (Not a Number).'/
  30. c . ' This would create problems because its square
  31. c . root will be calculated.'/)
  32. c lerror = .true.
  33.  
  34. else
  35. lerror = .false.
  36.  
  37. endif
  38.  
  39.  
  40. return
  41. end
  42.  
  43.  
  44.  
  45.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales