Fortran: Integer too big for its kind

前端 未结 1 1793
被撕碎了的回忆
被撕碎了的回忆 2021-01-24 03:29

I am setting an integer to a value less than its maximum, but receiving an error that it is too big for it\'s kind. Why is this? Here is a sample program.

progr         


        
1条回答
  •  清歌不尽
    2021-01-24 04:00

    You need to append the i32 to 1000000000000 like this: 1000000000000_i32. gfortran complains that the number is too big for it's kind. 1000000000000 is a short integer, not a super long integer. 1000000000000_i32 is a super long integer. It is not complaining about the variable, it's complaining about the constant.

    0 讨论(0)
提交回复
热议问题