http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54159
Bug #: 54159 Summary: Fortran quad precision rounding seemingly nonsensical Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: jonathan.h...@stfc.ac.uk program quad_test implicit none integer, parameter :: dp = kind(0d0) integer, parameter :: qp = selected_real_kind(32) real(qp) :: qpreal1, qpreal2 ! Two quad prec numbers that differ by last 3 digits qpreal1 = 42246.397327831658913055434823036200_qp qpreal2 = 42246.397327831658913055434823036194_qp print *, "qpreal1 = ", qpreal1 print *, "qpreal2 = ", qpreal2 print * print *, "trunc qpreal1 = ", real(qpreal1, kind=dp) print *, "trunc qpreal2 = ", real(qpreal2, kind=dp) end program quad_test produces output qpreal1 = 42246.397327831658913055434823036200 qpreal2 = 42246.397327831658913055434823036194 trunc qpreal1 = 42246.397327831663 trunc qpreal2 = 42246.397327831655 the truncated output is incorrect in two ways: 1) Neither truncation is correct. 2) Both truncations are different but should be the same. Being unable to rely on quad->double conversions makes quad precision considerably less useful to us.