public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/100561] New: Error while computing square of a real number (8 and 16 bytes)
@ 2021-05-12 8:53 h0bb_88 at protonmail dot com
2021-05-12 8:58 ` [Bug fortran/100561] " h0bb_88 at protonmail dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: h0bb_88 at protonmail dot com @ 2021-05-12 8:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100561
Bug ID: 100561
Summary: Error while computing square of a real number (8 and
16 bytes)
Product: gcc
Version: og10 (devel/omp/gcc-10)
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: h0bb_88 at protonmail dot com
Target Milestone: ---
This simple example didn't give the same result than wolfram or any calculator
:
- result from program : 9.869604950...
- result from other calculators : 9.869604401...
The rounding is not the cause, because of error from 10° decimal, in 16-byte
floating point. This error exist too in 8-byte floating-points number.
Simple example :
program main
real(16), parameter :: pi =
3.1415926535897932384626433832795028841971693993751058209749445923
write(*,*) pi**2, pi*pi
end program
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/100561] Error while computing square of a real number (8 and 16 bytes)
2021-05-12 8:53 [Bug fortran/100561] New: Error while computing square of a real number (8 and 16 bytes) h0bb_88 at protonmail dot com
@ 2021-05-12 8:58 ` h0bb_88 at protonmail dot com
2021-05-12 8:59 ` h0bb_88 at protonmail dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: h0bb_88 at protonmail dot com @ 2021-05-12 8:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100561
--- Comment #1 from h0bb_88 at protonmail dot com ---
Created attachment 50797
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50797&action=edit
Source code
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/100561] Error while computing square of a real number (8 and 16 bytes)
2021-05-12 8:53 [Bug fortran/100561] New: Error while computing square of a real number (8 and 16 bytes) h0bb_88 at protonmail dot com
2021-05-12 8:58 ` [Bug fortran/100561] " h0bb_88 at protonmail dot com
@ 2021-05-12 8:59 ` h0bb_88 at protonmail dot com
2021-05-12 9:02 ` h0bb_88 at protonmail dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: h0bb_88 at protonmail dot com @ 2021-05-12 8:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100561
--- Comment #2 from h0bb_88 at protonmail dot com ---
Created attachment 50798
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50798&action=edit
Comparison between f90 result and bc computation
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/100561] Error while computing square of a real number (8 and 16 bytes)
2021-05-12 8:53 [Bug fortran/100561] New: Error while computing square of a real number (8 and 16 bytes) h0bb_88 at protonmail dot com
2021-05-12 8:58 ` [Bug fortran/100561] " h0bb_88 at protonmail dot com
2021-05-12 8:59 ` h0bb_88 at protonmail dot com
@ 2021-05-12 9:02 ` h0bb_88 at protonmail dot com
2021-05-12 9:54 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: h0bb_88 at protonmail dot com @ 2021-05-12 9:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100561
--- Comment #3 from h0bb_88 at protonmail dot com ---
System: Kernel: 5.8.0-53-generic x86_64 bits: 64 compiler: N/A Desktop:
Cinnamon 4.8.6
wm: muffin dm: LightDM Distro: Linux Mint 20.1 Ulyssa base: Ubuntu
20.04 focal
Machine: Type: Desktop Mobo: ASUSTeK model: Z170-K v: Rev X.0x serial:
<filter>
UEFI [Legacy]: American Megatrends v: 3805 date: 05/16/2018
CPU: Topology: Quad Core model: Intel Core i7-6700K bits: 64 type: MT MCP
arch: Skylake-S
rev: 3 L2 cache: 8192 KiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
bogomips: 63999
Speed: 3900 MHz min/max: 800/4200 MHz Core speeds (MHz): 1: 3900 2:
3900 3: 3900
4: 3900 5: 3900 6: 3900 7: 3900 8: 3900
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/100561] Error while computing square of a real number (8 and 16 bytes)
2021-05-12 8:53 [Bug fortran/100561] New: Error while computing square of a real number (8 and 16 bytes) h0bb_88 at protonmail dot com
` (2 preceding siblings ...)
2021-05-12 9:02 ` h0bb_88 at protonmail dot com
@ 2021-05-12 9:54 ` rguenth at gcc dot gnu.org
2021-05-12 9:55 ` rguenth at gcc dot gnu.org
2021-05-12 9:56 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-12 9:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100561
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
It looks like gfortran parses the constant in single-precision, which might be
an issue with your fortran source.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/100561] Error while computing square of a real number (8 and 16 bytes)
2021-05-12 8:53 [Bug fortran/100561] New: Error while computing square of a real number (8 and 16 bytes) h0bb_88 at protonmail dot com
` (3 preceding siblings ...)
2021-05-12 9:54 ` rguenth at gcc dot gnu.org
@ 2021-05-12 9:55 ` rguenth at gcc dot gnu.org
2021-05-12 9:56 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-12 9:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100561
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
it is.
real(8), parameter :: pi = 3.1415926535d0
works for example.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug fortran/100561] Error while computing square of a real number (8 and 16 bytes)
2021-05-12 8:53 [Bug fortran/100561] New: Error while computing square of a real number (8 and 16 bytes) h0bb_88 at protonmail dot com
` (4 preceding siblings ...)
2021-05-12 9:55 ` rguenth at gcc dot gnu.org
@ 2021-05-12 9:56 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-05-12 9:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100561
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is invalid because you wrote:
3.1415926535897932384626433832795028841971693993751058209749445923
And not:
3.1415926535897932384626433832795028841971693993751058209749445923_16
The first is a real type which is already rounded to 64bit.
When I used the _16, I get the correct answer.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-05-12 9:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 8:53 [Bug fortran/100561] New: Error while computing square of a real number (8 and 16 bytes) h0bb_88 at protonmail dot com
2021-05-12 8:58 ` [Bug fortran/100561] " h0bb_88 at protonmail dot com
2021-05-12 8:59 ` h0bb_88 at protonmail dot com
2021-05-12 9:02 ` h0bb_88 at protonmail dot com
2021-05-12 9:54 ` rguenth at gcc dot gnu.org
2021-05-12 9:55 ` rguenth at gcc dot gnu.org
2021-05-12 9:56 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).