This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Fortran, Patch] PR 34192 - Fix compile-time evaluation of NEAREST
- From: FX Coudert <fxcoudert at gmail dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 24 Nov 2007 11:41:42 +0100
- Subject: Re: [Fortran, Patch] PR 34192 - Fix compile-time evaluation of NEAREST
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; bh=USZlBtf6Vv8UmpWjO/8hJ+DbdiJjMNKZRS3yz0KQnPo=; b=P5hO7zBfwSqGbt83CHffFwWvgN+3/FLyUPA7RPY41dn/WMotAJQpApHzpsc/9b4hF2rucUb84NFj8rQraGDUbCyelqhjNgkify++m+CRiKZvqXmfXP1GP0evytNUQNrj5NUrPJ6QwuCupb0BCqsYa9EIrfzSlYXyvYdrwU+ns4M=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=lk3WF4eIzllZ2F/sduuk5d4QdW+hTxogrCRQwlkbbsyKE4N+PQQ5dbIWZWp+UvZbF8OFiKZRyIwXAQFaf1NdynSa1zB5ZH0wwr0mTBCrFbeALmzi30ytBzk/24JBNjcIfOICRIER5gdP2juWi2UtccJVpq8hOYKZ15Iv5KyILBU=
- References: <4747316F.6060708@net-b.de>
PS: Any idea how to test for INF and NAN? If I do "0.0/0.0" I get a
compile-time error and -fno-range-check does not help. I cannot assign
to a variable first as otherwise NEAREST is not evaluated at
compile time.
You should be able to get an NaN by 0. / 0. with -fno-range-check,
and same for Inf:
real, parameter :: x = 0. / 0.
real, parameter :: y = exp(log(huge(y))+20)
print *, x, y
end
PS: can someone confirm that the following is wrong?
$ cat a.f90
real, parameter :: y = exp(log(huge(y))+20)
real, parameter :: x = log(y)
print *, x, y
end
$ gfortran a.f90 -fno-range-check && ./a.out
108.72284 +Infinity