public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/38325]  New: Long_Long_Float'Image returns a wrong value in some cases
@ 2008-11-30 10:04 bechir dot zalila at gmail dot com
  2008-11-30 10:12 ` [Bug ada/38325] " schwab at suse dot de
  2008-11-30 10:28 ` bechir dot zalila at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: bechir dot zalila at gmail dot com @ 2008-11-30 10:04 UTC (permalink / raw)
  To: gcc-bugs

The test case below shows a bug in the Long_Long_Float'Image function on
FreeBSD 7:

File test_float.adb;
============

with Ada.Text_IO;              use Ada.Text_IO;

procedure Test_Float is
   L  : Long_Long_Float := 1.000;
   LL : Long_Long_Float := 10.000;
begin
   Put_Line (Long_Long_Float'Image (L/LL));
end Test_Float;

Expected execution result:
=================

10:25 ~/dev% ./test_float 
 1.00000000000000000E-01

Actual behavior with GNAT-GCC 4.3.2:
========================

10:26 ~/dev% ./test_float           
 1.00000000000000006E-01

(Note the trailing "6" after the zero's)

GNAT version:
=========

10:20 ~/dev% gnatls -v

GNATLS 4.3.2
Copyright (C) 1997-2007, Free Software Foundation, Inc.

Source Search Path:
   <Current_Directory>
   /opt/packages/gnat-4.3.2/lib/gcc/i686-portbld-freebsd7/4.3.2/adainclude/


Object Search Path:
   <Current_Directory>
   /opt/packages/gnat-4.3.2/lib/gcc/i686-portbld-freebsd7/4.3.2/adalib/


Project Search Path:
   <Current_Directory>
   /opt/packages/gnat-4.3.2/lib/gnat/

GCC version:
========

10:20 ~/dev% gcc -v
Using built-in specs.
Target: i686-portbld-freebsd7
Configured with: ../gcc-4.3.2/configure --prefix=/[snip]/gcc_4.3.2_install
--enable-languages=c,c++,ada --with-gmp=/[snip]/gmp_inst
--with-mpfr=/[snip]/mpfr_inst --disable-nls --host=i686-portbld-freebsd7
--target=i686-portbld-freebsd7 --build=i686-portbld-freebsd7
--enable-checking=release --enable-threads=posix
Thread model: posix
gcc version 4.3.2 (GCC)


-- 
           Summary: Long_Long_Float'Image returns a wrong value in some
                    cases
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bechir dot zalila at gmail dot com
 GCC build triplet: i686-portbld-freebsd7
  GCC host triplet: i686-portbld-freebsd7
GCC target triplet: i686-portbld-freebsd7


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38325


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug ada/38325] Long_Long_Float'Image returns a wrong value in some cases
  2008-11-30 10:04 [Bug ada/38325] New: Long_Long_Float'Image returns a wrong value in some cases bechir dot zalila at gmail dot com
@ 2008-11-30 10:12 ` schwab at suse dot de
  2008-11-30 10:28 ` bechir dot zalila at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: schwab at suse dot de @ 2008-11-30 10:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from schwab at suse dot de  2008-11-30 10:10 -------
0.1 is not exactly representable in a binary float format.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38325


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug ada/38325] Long_Long_Float'Image returns a wrong value in some cases
  2008-11-30 10:04 [Bug ada/38325] New: Long_Long_Float'Image returns a wrong value in some cases bechir dot zalila at gmail dot com
  2008-11-30 10:12 ` [Bug ada/38325] " schwab at suse dot de
@ 2008-11-30 10:28 ` bechir dot zalila at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: bechir dot zalila at gmail dot com @ 2008-11-30 10:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bechir dot zalila at gmail dot com  2008-11-30 10:27 -------
(In reply to comment #1)
> 0.1 is not exactly representable in a binary float format.
> 

Sure, but in former versions of GNAT-GCC (4.2.X), the expected value
(1.00000000000000000E-01) was displayed.


-- 

bechir dot zalila at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bechir dot zalila at gmail
                   |                            |dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38325


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-30 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-30 10:04 [Bug ada/38325] New: Long_Long_Float'Image returns a wrong value in some cases bechir dot zalila at gmail dot com
2008-11-30 10:12 ` [Bug ada/38325] " schwab at suse dot de
2008-11-30 10:28 ` bechir dot zalila at gmail dot com

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).