Skip to content

Instantly share code, notes, and snippets.

@komasaru
Created April 14, 2017 05:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komasaru/90ffd4f915744e9c520619342a0d2011 to your computer and use it in GitHub Desktop.
Save komasaru/90ffd4f915744e9c520619342a0d2011 to your computer and use it in GitHub Desktop.
Fortran code to specify floating-point numbers.
!****************************************************
! 単精度・倍精度浮動小数点数の確認
!
! date name version
! 2017.04.10 mk-mode.com 1.00 新規作成
!
! Copyright(C) 2017 mk-mode.com All Rights Reserved.
!****************************************************
!
program double_precision_real
implicit none
integer, parameter :: SP = kind(1.0)
integer, parameter :: DP = selected_real_kind(2*precision(1.0_SP))
real(SP) :: a
real(DP) :: b
a = 3.1415926535897323846264338327950288_SP
b = 3.1415926535897323846264338327950288_DP
print *,' a, b = ', a, b
end program double_precision_real
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment