Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.