From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123171 invoked by alias); 4 Oct 2018 20:26:39 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 123161 invoked by uid 89); 4 Oct 2018 20:26:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*c:alternative, dear X-HELO: mail-ed1-f44.google.com Received: from mail-ed1-f44.google.com (HELO mail-ed1-f44.google.com) (209.85.208.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 04 Oct 2018 20:26:37 +0000 Received: by mail-ed1-f44.google.com with SMTP id c26-v6so2047113edt.3 for ; Thu, 04 Oct 2018 13:26:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=bR2pxGeQxAbyh9AFGNq6cBrqBBYlPe3MCGEgjDsbf4s=; b=drQ6O7oSzJ/bnkNXCjZ7Nd2I9WiAwR65eky+cPZMgX+mS8U5O4guXZCeTfXrIh9AU0 rBXIWAwpXt9uaJ95/N8rSZ1UB4dBUZzRwFUdbbIQBZMJsDJpzDMmPrtpfD5pubF6IzAC I8PixXP5+sdDk//+dBZea4FNuIuRZs2BaCAmzTia87gOqYSF3rsTp1fi9N2XeVxCK8Bx u0gAl5ItbpWIAN2W+D+i+J3xg2kd0gSiHtFdPAf3E8wrNr3AWXf85g+juk1ZtIuQpgcc lIQEFcBlSQWjBedW/kjG0VwVM4dBuKWhbFBjJ9awomtRRfsEbe6UMf7JPHdbaLzbhoYu dgqg== MIME-Version: 1.0 From: Luca Donatini Date: Thu, 04 Oct 2018 20:26:00 -0000 Message-ID: Subject: Unexpected NaN value To: fortran@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2018-10/txt/msg00019.txt.bz2 Dear all, I noticed a strange behaviour of the gfortran compiler. In the source file below, when the real variable b has an "integer-like" value (e.g. "2", "2.", "2.0" ...) the code correctly writes out a numerical result. But when a "real-like" value is assigned to b (e.g. "2.1", "2.0000009", "2.83" ...) , the code writes a NaN value. This does not occurr when the sample code is compiled with an Intel compiler (I tested version 2018a). I have the NaN value problem with both: - gfortran 8.2.1 20180831 (Arch Linux package) - gfortran 6.3.0 20170516 (Debian Stretch package). Is this a bug? A known one? Many thanks in advance for all the clarifications, Luca Donatini *** example source file *** program test implicit none real :: a = -1.57079637 real :: b = 2.1 write(*,*) cos(a) write(*,*) cos(a) **(2*b) end program