comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: Float to String
Date: Thu, 11 Nov 2004 03:33:18 GMT
Date: 2004-11-11T03:33:18+00:00	[thread overview]
Message-ID: <24Bkd.74362$HA.12207@attbi_s01> (raw)
In-Reply-To: u654dlnq8.fsf@obry.net

I see two obvious choices, both of which are reasonably simple, neither of
which is exact:

1) Write the value as a string representing a floating point value with as
many significant digits as possible.  Use an Ada.Text_Io to convert the
value to a string, trim the string and add it to the XML text.

2) Write the value as an integer value.  Since you are dealing with cosines,
the range of values are between -1.0 and 1.0.  These could be mapped between
the integer values of 0 to 2^32-1, (or -2^31 to 2^31-1, take your pick).
This would give you a precision of 1/(2^32), which may be sufficient for
your application.  You may be able to handle this directly by defining a
fixed point type in Ada.

I hope this helps,
Steve
(The Duck)


"Pascal Obry" <pascal@obry.net> wrote in message
news:u654dlnq8.fsf@obry.net...
>
> "Steve" <nospam_steved94@comcast.net> writes:
>
> > Cross platform?  Or just getting from point A to point B on the same
> > architecture?
>
> I basically need to output an XML file with float values. These values are
> cosine proximities between documents. I want to be able to read this XML
file
> in any computers.
>
> Pascal.
>
> -- 
>
> --|------------------------------------------------------
> --| Pascal Obry                           Team-Ada Member
> --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
> --|------------------------------------------------------
> --|              http://www.obry.org
> --| "The best way to travel is by means of imagination"
> --|
> --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595





  parent reply	other threads:[~2004-11-11  3:33 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-08 17:06 Float to String Pascal Obry
2004-11-08 18:29 ` Jean-Pierre Rosen
2004-11-08 19:03 ` Jeffrey Carter
2004-11-08 20:13 ` David C. Hoos
2004-11-08 20:18 ` David C. Hoos
2004-11-09  0:40   ` John B. Matthews
2004-11-09  5:24     ` David C. Hoos, Sr.
2004-11-08 21:29 ` Nick Roberts
2004-11-09 17:58   ` Peter Hermann
2004-11-10  9:38     ` Peter Hermann
2004-11-10 12:12       ` Larry Kilgallen
2004-11-09  8:39 ` Dmitry A. Kazakov
2004-11-09 18:17   ` Pascal Obry
2004-11-10  8:53     ` Dmitry A. Kazakov
2004-11-10 11:15       ` Samuel Tardieu
2004-11-10 14:35         ` Dmitry A. Kazakov
2004-11-10 15:00         ` Peter Hermann
2004-11-10 15:35         ` Marius Amado Alves
2004-11-10 16:35           ` Dmitry A. Kazakov
2004-11-10 17:28             ` Marius Amado Alves
2004-11-11 15:25               ` Dmitry A. Kazakov
2004-11-11 16:40                 ` Marius Amado Alves
2004-11-11 18:31                   ` Dmitry A. Kazakov
2004-11-11 22:27                     ` Marius Amado Alves
2004-11-12 12:19                       ` Dmitry A. Kazakov
2004-11-12 14:55                         ` Marius Amado Alves
2004-11-10  5:05 ` Steve
2004-11-10 15:37   ` Pascal Obry
2004-11-10 16:29     ` Alex R. Mosteo
2004-11-10 16:48       ` Pascal Obry
2004-11-10 18:02         ` Marius Amado Alves
2004-11-10 19:40           ` Jeffrey Carter
2004-11-10 21:04             ` Marius Amado Alves
2004-11-11  3:33     ` Steve [this message]
2004-11-11  7:51       ` tmoran
2004-11-11 12:32         ` Pascal Obry
2004-11-11 15:53           ` David C. Hoos, Sr.
2004-11-11 16:17             ` Pascal Obry
2004-11-11 17:36             ` Jeffrey Carter
2004-11-12  0:01               ` David C. Hoos, Sr.
2004-11-12  0:30                 ` Jeffrey Carter
2004-11-11 12:30       ` Pascal Obry
2004-11-13 16:37 ` Ginduskina
2004-11-13 18:41   ` Björn Lundin
2004-11-13 16:39 ` Ginduskina
2004-11-13 16:49   ` Simon Wright
2004-11-13 16:53   ` David C. Hoos, Sr.
2004-11-13 16:55   ` Pascal Obry
replies disabled

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