Boost logo

Boost :

From: Maarten Kronenburg (M.Kronenburg_at_[hidden])
Date: 2006-05-25 10:39:46

"Joe Gottman" <jgottman_at_[hidden]> wrote in message
> "Maarten Kronenburg" <M.Kronenburg_at_[hidden]> wrote in message
> news:e5254e$tba$
> > In the boost vault
> >
> > under Math - Numerics the document
> > infintdraft.pdf contains the
> > Proposal for an Infinite Precision Integer
> > for Library Technical Report 2, Draft.
> There's a few members that I'd really like to see.
> First, an operator unspecified_bool_type(), like the one found in
> shared_ptr. There's a lot of code that looks like the following:
> long x = doSomething();
> if (x) { //whatever.
> If integer is going to be a drop-in replacement for long then it should
> this functionality.

Thanks for your comments.
The integer is not a drop-in replacement for any base type;
because it accesses its data through a pointer, and has to
check on certain conditions and carries etc, it is much slower
than the base types.
A conversion operator will generate ambiguities in
expressions, even a bool conversion operator,
because bool can be implicitly converted to int.
Therefore no conversion operators are provided.
In this case one should use:
if( !x.is_zero() )
if( x.get_sign() )

> Second, it would be very nice if we could have a two-parameter constructor
> for emulating scientific notation:
> integer googol(1, 100);

This can be done by:
integer googol = pow( 10, 100 );

> I'm not sure how technically feasible this second one is, but it would
> certainly be useful.
> Joe Gottman
> _______________________________________________
> Unsubscribe & other changes:

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