Boost logo

Boost :

From: hervebronnimann_at_[hidden]
Date: 2008-05-05 13:34:45

Johan: you can construct an iterator wrapper that map operator++ to next(float), and then it *really* is the specialization of std::distance() for this iterator type. In my opinion, difference implies an algebraic structure (which there is on float, but not what you want). I hope this convinces you that distance is the right name.

Sent via BlackBerry from T-Mobile

-----Original Message-----
From: Johan Råde <rade_at_[hidden]>

Date: Mon, 05 May 2008 17:10:09
Subject: Re: [boost] [Math/nextafter] A question of naming functions...

John Maddock wrote:
> So, it looks like so far we have:
> next(val)
> prior(val)
> and either of
> representation_distance(a, b);
> discrete_distance(a, b);

I'm still a bit unhappy about calling a signed quantity a "distance".
I would prefer "difference". Let me elaborate:

To me a "distance" is a quantity that satisfies the rules:

d(x,y) >= 0
d(x,x) = 0
d(y,x) = d(x,y)
d(x,y) + d(y,z) >= d(x,z)

while a "difference" is a quantity that satisfies the rules

d(x,x) = 0
d(y,x) = -d(x,y)
d(x,y) + d(y,z) = d(x,z)

The function we are discussing satisfies the second set of rules.


Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at