------- Comment #13 from gdr at integrable-solutions dot net  2006-01-30 12:50 
-------
Subject: Re:  std::advance() isn't stable for floating point numbers

"Woebbeking at web dot de" <[EMAIL PROTECTED]> writes:

| Subject: Re:  std::advance() isn't stable for floating point numbers
| 
| On Monday 30 January 2006 08:54, gdr at integrable-solutions dot net 
| wrote:
| > ------- Comment #11 from gdr at integrable-solutions dot net 
| 
| > | FYI, I suggested tests for > 0 and < 0 as MSVC 7.1 does it that
| > | way.
| > |
| > | If you convert Distance to difference_type the question is what
| > | happens if Distance is i.e. 0.2. Do you advance by 0 or 1 position?
| >
| > does not that follow from the conversion rule?
| 
| Of course. I meant what should it do. Do you want it to advance by 0 or 
| 1 position? Do we just use a simple cast or do we need to do some 
| rounding? AFAIK MSVC advance by 1 in this case.

Given that Distance is supposed to behave "like" en integral type in
the first place, I would simply use:

  (1) implicit conversion to convert it to difference_type;
  (2) advance the number of time computed from (1).

-- Gaby


-- 


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

Reply via email to