Boost logo

Boost Users :

Subject: Re: [Boost-users] problems with C++ integer types
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-02-01 17:40:34

on Tue Jan 31 2012, Daryle Walker <> wrote:

>> From: John
>> Date: Tue, 31 Jan 2012 16:28:41 +0000
>> > Modulo: NO
>> Integer types that are bounded (fixed precision) and implement
> modular
>> arithmetic (ie built-in integers on most/all platforms) can and
> should set
>> is_modulo field to true.
> Yes, but that's not what I'm talking about. The built-in integers
> model a subset of real numbers, and the modulo properties (if present
> on the hardware) are a side-effect of the wrap-around mechanic. This
> isn't the case with an intentional modulo type (with arbitrary
> modulus). For instance, if we have a modulo-5 UDT, then the value
> "1" represents not just 1, but any integer that can be expressed as
> 5x + 1. Since the state represents a whole class of numbers, it
> doesn't model to real numbers any more than a polynomial type does.

I think that's a valid, but pretty twisted, way to look at it. An
instance of a modulo-5 UDT only represents a whole class of numbers if
that's dictated by the way it's being used. It's no more intrinsically
a representative of a class than it is an individual.

Dave Abrahams
BoostPro Computing

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at