Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #15010

Re: Setting floating point variable as infinite

From glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups comp.lang.c++
Subject Re: Setting floating point variable as infinite
Date 2012-03-23 12:39 +0000
Organization Aioe.org NNTP Server
Message-ID <jkhqts$a68$1@speranza.aioe.org> (permalink)
References <jkhq7k$917$1@speranza.aioe.org> <jkhql8$3vh$1@news-rocq.inria.fr>

Show all headers | View raw


Marc <marc.glisse@gmail.com> wrote:
> Rui Maciel  wrote:

>> Consider a data set whose elements can be mapped to a particular floating 
>> point number.  In order to determine the smallest floating point number 
>> computed from each element from the set, is it a good idea to initialize a 
>> temporary float as infinite, compare the temporary float with the value 
>> mapped from each data element and then update the temporary if the mapped 
>> value is smaller?

(snip)
> You can use the first element of your data set to initialize the minimum
> and only start the loop from the second element. In some cases that can
> be inconvenient to do.

Specifically, it fails in the case that the data set length is zero.

-- glen

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Setting floating point variable as infinite Rui Maciel <rui.maciel@gmail.com> - 2012-03-23 12:27 +0000
  Re: Setting floating point variable as infinite Marc <marc.glisse@gmail.com> - 2012-03-23 12:34 +0000
    Re: Setting floating point variable as infinite glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-03-23 12:39 +0000
      Re: Setting floating point variable as infinite gwowen <gwowen@gmail.com> - 2012-03-23 06:21 -0700
      Re: Setting floating point variable as infinite Rui Maciel <rui.maciel@gmail.com> - 2012-03-23 14:39 +0000
        Re: Setting floating point variable as infinite glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-03-23 20:06 +0000
  Re: Setting floating point variable as infinite Victor Bazarov <v.bazarov@comcast.invalid> - 2012-03-23 10:32 -0400
    Re: Setting floating point variable as infinite Rui Maciel <rui.maciel@gmail.com> - 2012-03-23 15:03 +0000
      Re: Setting floating point variable as infinite Victor Bazarov <v.bazarov@comcast.invalid> - 2012-03-23 11:50 -0400
        Re: Setting floating point variable as infinite Rui Maciel <rui.maciel@gmail.com> - 2012-03-23 19:01 +0000
          Re: Setting floating point variable as infinite Christian Gollwitzer <auriocus@gmx.de> - 2012-03-23 20:26 +0100
          Re: Setting floating point variable as infinite Victor Bazarov <v.bazarov@comcast.invalid> - 2012-03-23 19:10 -0400
            Re: Setting floating point variable as infinite Rui Maciel <rui.maciel@gmail.com> - 2012-03-24 11:43 +0000
        Re: Setting floating point variable as infinite Miles Bader <miles@gnu.org> - 2012-03-24 09:46 +0900
          Re: Setting floating point variable as infinite Victor Bazarov <v.bazarov@comcast.invalid> - 2012-03-23 23:42 -0400
            Re: Setting floating point variable as infinite Rui Maciel <rui.maciel@gmail.com> - 2012-03-24 11:31 +0000
            Re: Setting floating point variable as infinite Miles Bader <miles@gnu.org> - 2012-03-24 23:41 +0900
    Re: Setting floating point variable as infinite Andrea Venturoli <ml.diespammer@netfence.it> - 2012-03-24 13:05 +0100
      Re: Setting floating point variable as infinite Victor Bazarov <v.bazarov@comcast.invalid> - 2012-03-24 15:44 -0400
  Re: Setting floating point variable as infinite Leigh Johnston <leigh@i42.co.uk> - 2012-03-24 12:30 +0000
    Re: Setting floating point variable as infinite Gareth Owen <gwowen@gmail.com> - 2012-03-25 07:52 +0100
    Re: Setting floating point variable as infinite Rui Maciel <rui.maciel@gmail.com> - 2012-03-25 12:38 +0100
      Re: Setting floating point variable as infinite Leigh Johnston <leigh@i42.co.uk> - 2012-03-25 13:36 +0100
        Re: Setting floating point variable as infinite Leigh Johnston <leigh@i42.co.uk> - 2012-03-25 14:00 +0100
          Re: Setting floating point variable as infinite Leigh Johnston <leigh@i42.co.uk> - 2012-03-25 14:05 +0100
            Re: Setting floating point variable as infinite Rui Maciel <rui.maciel@gmail.com> - 2012-03-25 16:54 +0100

csiph-web