{"id":20989940,"url":"https://github.com/robtillaart/interval","last_synced_at":"2025-05-14T18:32:22.948Z","repository":{"id":45331889,"uuid":"281416412","full_name":"RobTillaart/Interval","owner":"RobTillaart","description":"Arduino library for Interval datatype","archived":false,"fork":false,"pushed_at":"2024-04-13T09:05:22.000Z","size":35,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-07T18:26:52.011Z","etag":null,"topics":["arduino","data-type","interval"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RobTillaart.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"RobTillaart","custom":"https://www.paypal.me/robtillaart"}},"created_at":"2020-07-21T14:13:14.000Z","updated_at":"2024-01-25T19:37:49.000Z","dependencies_parsed_at":"2024-04-13T10:23:18.638Z","dependency_job_id":"733c4280-0708-483c-a093-f97d22e97770","html_url":"https://github.com/RobTillaart/Interval","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FInterval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FInterval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FInterval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FInterval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobTillaart","download_url":"https://codeload.github.com/RobTillaart/Interval/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225305817,"owners_count":17453458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","data-type","interval"],"created_at":"2024-11-19T06:26:46.130Z","updated_at":"2024-11-19T06:26:46.799Z","avatar_url":"https://github.com/RobTillaart.png","language":"C++","funding_links":["https://github.com/sponsors/RobTillaart","https://www.paypal.me/robtillaart"],"categories":[],"sub_categories":[],"readme":"\n[![Arduino CI](https://github.com/RobTillaart/Interval/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)\n[![Arduino-lint](https://github.com/RobTillaart/Interval/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/Interval/actions/workflows/arduino-lint.yml)\n[![JSON check](https://github.com/RobTillaart/Interval/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/Interval/actions/workflows/jsoncheck.yml)\n[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/Interval.svg)](https://github.com/RobTillaart/Interval/issues)\n\n[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/Interval/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/RobTillaart/Interval.svg?maxAge=3600)](https://github.com/RobTillaart/Interval/releases)\n[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/Interval.svg)](https://registry.platformio.org/libraries/robtillaart/Interval)\n\n\n# Interval\n\nArduino library for the Interval data type. **Experimental**\n\n\n## Description\n\nThis **experimental** library provides basic math when you do not know a quantity.\nThe only thing you do know is the value is in a certain interval. \nAfter doing some math you want to know the interval of possible outcomes.\n\nAn interval exist of a pair of floats, low and high, the borders of the interval. \n\n**footnote:**\nThe data type Interval was created to do some experiments.\nIt was inspired by the **frink** language which has an interval data type.\nFrink itself is not investigated, so semantics are not necessary similar.\n\n\n## Interface\n\n```cpp\n#include \"Interval.h\"\n```\n\nThe Interval class implements the public interface of Printable.\nThis allows you to print an Interval in human readable form.\n\n```cpp\n    Interval x(3, 4);\n    x.setDecimals(2);\n    Serial.println(x); // will print [3.00, 4.00]\n```\n\n\n### Constructors\n\n- **Interval()** zero = interval \\[0, 0]\n- **Interval(float lo, float hi)** interval \\[lo, hi]\n- **Interval(float f)** interval \\[f, f]\n\n\n### Basic functions\n\nThe basic functions are used to get and set some core attributes.\n\n- **setDecimals()** set nr of decimals for printing.\n- **value()** is the middle of the interval (as we do not know distribution)\n- **range()** = high() - low()\n- **high()** idem\n- **low()** idem\n- **relAccuracy()** = range() / value()\n- **setRange(float r)** adjust range around value() =- r/2\n\n\n### Math Operators\n\nMath operators\n\n- **addition + +=** \n- **subtraction - -=**  \n- **multiplication \\* \\*=**  \n- **quotient \\/ \\/=**  \n\n\n### Functions \n\nFunctions are not implemented yet as these need **to be investigated**.\nFor a monotonous function it is relative easy\n\n```\nInterval v = F( [a, b] );         ==\u003e [ F(a), F(b)]\ne.g.\nInterval f = exp( [a, b]);        ==\u003e [exp(a), exp(b)]\nInterval g = log( [a, b]);        ==\u003e [log(a), log(b)]    a \u003e 0!!\n```\nThe math for non monotonous functions is more complex\nas one cannot use the function values as above.\n\n```\nInterval p = sin( [0, PI] );      ==\u003e [0, 1]\nInterval q = sin( [0, -PI] );     ==\u003e [-1, 0]\nInterval r = sin( [0, 10 * PI] ); ==\u003e [-1, 1]\n\nInterval s = sqr( [-5, -3] ) ;    ==\u003e [9, 25]\nInterval t = sqr( [-5,  3] ) ;    ==\u003e [0, 25]\n\n```\n\n- change range while keeping value.\n\n\n### Comparison operators\n\n**To be investigated**. The semantics make at least a difference between when\nan interval is Certainly Less Equal or Probably Less or Equal.\nThe Certainly group will be boolean math as we know it.\nThe Probably group will be more like fuzzy logic so a float between 0..100%.\n\n- **bool == ** \n- **bool != ** \n- **bool \u003e  ** \n- **bool \u003e= ** \n- **bool \u003c  ** \n- **bool \u003c= ** \n\n\n### Set operators\n\n**To be investigated** include:\n- If you have two or more intervals, what is the 'super interval' that includes all?\n- How to subtract elements of an interval from another Interval?  \nThis is different than the subtraction above,  \nthink of it as \" I know the number I look for is in \\[1, 4] but it is not in \\[3, 5]  \nso it is in \\[1,3]\n\n\n### Other\n\n- a known problem is difference between border inclusive \\[ \\] and  \nborder exclusive \\\u003c \\\u003e. How to deal with that? \n- 1/\\[-1, 1\\]  ==\u003e ?? singularity for 0?\n- infinity as border? In math we have \\[0, \\-\u003e\u003e for all positive floats.\n\n\n## Operation\n\nSee example\n\n\n## Future\n\n#### Must\n\n- improve documentation\n  - clean up\n\n#### Should\n\n- play and extend the library.\n- check all to be investigated above.\n\n#### Could\n\n#### Wont\n\n\n## Support\n\nIf you appreciate my libraries, you can support the development and maintenance.\nImprove the quality of the libraries by providing issues and Pull Requests, or\ndonate through PayPal or GitHub sponsors.\n\nThank you,\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtillaart%2Finterval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobtillaart%2Finterval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtillaart%2Finterval/lists"}