`length` returns negative values for decreasing continuous domains

Open Beginner friendly
#66 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
67/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

Start by locating the implementation of length for continuous intervals and the tests covering intervals with decreasing domains. Reproduce the example using std::greater and confirm the current negative result. Done when the length is positive for the reported interval and a regression test covers it.

Written by the indexing model from the issue text.

Description

As shown at https://godbolt.org/z/KTP4bG5s4:

#include <boost/icl/interval.hpp>
#include <functional>
#include <iostream>

int main()
{
  using interval = boost::icl::continuous_interval<double, std::greater>;
  interval x = interval::closed(5.0, 3.0);

  std::cout << length(x) << "\n"; // outputs -2, should be 2
}
Dominant language
C++
Stars
15
Forks
51
Avg merge
8d 6h
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/icl

All issues in boostorg/icl

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.