Skip to content

How do I create negative numbers? #784

@akrzemi1

Description

@akrzemi1

The docs aren't that clear on how to create negative numbers.

There is a declaration:

template <typename Integral1, typename Integral2>
constexpr decimal128(Integral1 coeff, Integral2 exp, bool sign = false) noexcept;

sign looks like it, but it is still not clear if sign == true means "positive" or "negative". Maybe name is_negative would be more self-explanatory.

But even then, I can also do it with coeff:

decimal128 d {-1, 1};

But then I wonder whether the following is positive or negative:

decimal128 d {-1, 1, true};

And then I wonder whether

decimal128 d {-1, 1, false};

has the opposite meaning or not.

This constructor requires more attention in the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Boost ReviewCollected Comments from Boost Review Period

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions