comp.lang.ada
 help / color / mirror / Atom feed
* Float_text_io.put (10.0) -> 0.0 !
@ 2000-03-27  0:00 J�r�me Haguet
  2000-03-27  0:00 ` Robert Dewar
  2000-03-27  0:00 ` Florian Weimer
  0 siblings, 2 replies; 4+ messages in thread
From: J�r�me Haguet @ 2000-03-27  0:00 UTC (permalink / raw)


Hello
Does anybody know why the following code give on SOME PCs (not all) the
following outpout :

Wrong result with gnat 3.12p for Windows NT on some PCs
Next output should be "10.00" : 10.00
Next output should be "10.00" :  0.00

If you also have ideas to avoid this problem, you are welcome.



with Ada.Text_Io;
with Ada.Float_Text_Io;
with Win32.Windef;
with Win32.Wingdi;
with Win32.Winuser;

procedure Gnat_032 is
   pragma Linker_Options("-lopengl32");
begin
   Ada.Text_Io.Put_Line ("Wrong result with gnat 3.12p for Windows NT on
some PCs");
   ---
   Ada.Text_Io.Put ("Next output should be ""10.00"" : ");
   Ada.Float_Text_Io.Put (10.0, Aft => 2, Exp => 0);
   Ada.Text_Io.New_Line;
   ---
   declare
      Maindc : Win32.Windef.Hdc
        := Win32.Winuser.Getdc (Win32.Winuser.Hwnd_Top);
      Pfd : aliased Win32.Wingdi.Pixelformatdescriptor
        := (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0);
      Ipixelformat : Win32.Int
        := Win32.Wingdi.Choosepixelformat (mainDc, Pfd'Unchecked_Access);
      B : Win32.Bool
        := Win32.Wingdi.Setpixelformat (mainDc, Ipixelformat,
Pfd'Unchecked_Access);
      Glrc : Win32.Windef.Hglrc
        := Win32.Wingdi.Wglcreatecontext (mainDc);
   begin
      null;
   end;
   ---
   Ada.Text_Io.Put ("Next output should be ""10.00"" : ");
   Ada.Float_Text_Io.Put (10.0, Aft => 2, Exp => 0);
   Ada.Text_Io.New_Line;
end;







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

* Re: Float_text_io.put (10.0) -> 0.0 !
  2000-03-27  0:00 Float_text_io.put (10.0) -> 0.0 ! J�r�me Haguet
@ 2000-03-27  0:00 ` Robert Dewar
  2000-03-28  0:00   ` Nicolas Brunot
  2000-03-27  0:00 ` Florian Weimer
  1 sibling, 1 reply; 4+ messages in thread
From: Robert Dewar @ 2000-03-27  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 471 bytes --]

In article <mrGD4.2899$MJ7.9884763@nnrp4.proxad.net>,
  "J�r�me Haguet" <j.haguet@cadwin.com> wrote:
> Hello
> Does anybody know why the following code give on SOME PCs (not
all) the
> following outpout :

Yes, this is a known problem, it has to do with third party
software leaving the floating-point chip in incorrect state.
The new 3.13 version of GNAT provides library routines for
resetting the state.


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: Float_text_io.put (10.0) -> 0.0 !
  2000-03-27  0:00 Float_text_io.put (10.0) -> 0.0 ! J�r�me Haguet
  2000-03-27  0:00 ` Robert Dewar
@ 2000-03-27  0:00 ` Florian Weimer
  1 sibling, 0 replies; 4+ messages in thread
From: Florian Weimer @ 2000-03-27  0:00 UTC (permalink / raw)


"J�r�me Haguet" <j.haguet@cadwin.com> writes:

> Does anybody know why the following code give on SOME PCs (not all) the
> following outpout :
> 
> Wrong result with gnat 3.12p for Windows NT on some PCs
> Next output should be "10.00" : 10.00
> Next output should be "10.00" :  0.00

Does it depend on the OpenGL drivers which are installed on the machine?
I think I've seen some reports that some of them use MMX...




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

* Re: Float_text_io.put (10.0) -> 0.0 !
  2000-03-27  0:00 ` Robert Dewar
@ 2000-03-28  0:00   ` Nicolas Brunot
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Brunot @ 2000-03-28  0:00 UTC (permalink / raw)


Does it mean that in gnat 3.13 , ADA code will have to include a
resetting call before each float_text_io.put,
or will this be done automatically by the compiler ?
What about other function or procedure using floating point chip ?
(simple "*" or "/"  for example)
After test the problem occurs with gnat 3.12p, but not with Aonix
ObjectAda 7.1 for example, so not every
program using floating point chip is affected by this problem.

Nicolas BRUNOT

Robert Dewar a �crit:

> In article <mrGD4.2899$MJ7.9884763@nnrp4.proxad.net>,
>   "J�r�me Haguet" <j.haguet@cadwin.com> wrote:
> > Hello
> > Does anybody know why the following code give on SOME PCs (not
> all) the
> > following outpout :
>
> Yes, this is a known problem, it has to do with third party
> software leaving the floating-point chip in incorrect state.
> The new 3.13 version of GNAT provides library routines for
> resetting the state.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.





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

end of thread, other threads:[~2000-03-28  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-27  0:00 Float_text_io.put (10.0) -> 0.0 ! J�r�me Haguet
2000-03-27  0:00 ` Robert Dewar
2000-03-28  0:00   ` Nicolas Brunot
2000-03-27  0:00 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox