diff --git a/.arduino-ci.yml b/.arduino-ci.yml index e7cb463..9947b71 100644 --- a/.arduino-ci.yml +++ b/.arduino-ci.yml @@ -1,3 +1,18 @@ +platforms: + rpipico: + board: rp2040:rp2040:rpipico + package: rp2040:rp2040 + gcc: + features: + defines: + - ARDUINO_ARCH_RP2040 + warnings: + flags: + +packages: + rp2040:rp2040: + url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json + compile: # Choosing to run compilation tests on 2 different Arduino platforms platforms: @@ -8,4 +23,8 @@ compile: - m4 - esp32 # - esp8266 - # - mega2560 \ No newline at end of file + # - mega2560 + - rpipico + + libraries: + - "printHelpers" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b2a408b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,42 @@ +# Change Log Float16 + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + +## [0.1.7] - 2022-11-07 +- add changelog.md +- add rp2040 to build-CI +- update readme.md +- update keywords.txt + + +## [0.1.6] - 2021-12-18 +- update library.json +- update license +- minor edits + +## [0.1.5] - 2021-12-02 +- add basic math +- optimize compare operators + +## [0.1.4] - 2021-11-26 +- setup repo to get it working again. +- still experimental. + +---- + +## [0.1.03] - eons ago ?? +- ?? + +## [0.1.02] - 2015-03-14 +- getting rounding right + +## [0.1.01] - 2015-03-12 +- make base conversion separate functions + +## [0.1.00] - 2015-03-10 +- initial version + diff --git a/float16.cpp b/float16.cpp index ec89e2e..327db77 100644 --- a/float16.cpp +++ b/float16.cpp @@ -1,19 +1,11 @@ // // FILE: float16.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.1.5 +// VERSION: 0.1.7 // PURPOSE: library for Float16s for Arduino // URL: http://en.wikipedia.org/wiki/Half-precision_floating-point_format // -// HISTORY: -// 0.1.00 2015-03-10 initial version -// 0.1.01 2015-03-12 make base conversion separate functions -// 0.1.02 2015-03-14 getting rounding right -// 0.1.03 -// 0.1.4 2021-11-26 setup repo to get it working again. -// still experimental. -// 0.1.5 2021-12-02 add basic math, optimize compare operators -// 0.1.6 2021-12-18 update library.json, license, minor edits +// HISTORY: see changelog.md #include "float16.h" @@ -27,7 +19,6 @@ float16::float16(double f) _value = f32tof16(f); } - // PRINTING size_t float16::printTo(Print& p) const { @@ -35,7 +26,6 @@ size_t float16::printTo(Print& p) const return p.print(d, _decimals); }; - double float16::toDouble() const { return f16tof32(_value); @@ -51,7 +41,6 @@ bool float16::operator == (const float16 &f) return (_value == f._value); } - bool float16::operator != (const float16 &f) { return (_value != f._value); @@ -111,46 +100,39 @@ float16 float16::operator + (const float16 &f) return float16(this->toDouble() + f.toDouble()); } - float16 float16::operator - (const float16 &f) { return float16(this->toDouble() - f.toDouble()); } - float16 float16::operator * (const float16 &f) { return float16(this->toDouble() * f.toDouble()); } - float16 float16::operator / (const float16 &f) { return float16(this->toDouble() / f.toDouble()); } - float16& float16::operator += (const float16 &f) { *this = this->toDouble() + f.toDouble(); return *this; } - float16& float16::operator -= (const float16 &f) { *this = this->toDouble() - f.toDouble(); return *this; } - float16& float16::operator *= (const float16 &f) { *this = this->toDouble() * f.toDouble(); return *this; } - float16& float16::operator /= (const float16 &f) { *this = this->toDouble() / f.toDouble(); @@ -170,7 +152,6 @@ int float16::sign() return 0; } - bool float16::isZero() { return ((_value & 0x7FFF) == 0x0000); @@ -231,7 +212,6 @@ float float16::f16tof32(uint16_t _value) const return sgn ? -f : f; } - uint16_t float16::f32tof16(float f) const { uint32_t t = *(uint32_t *) &f; diff --git a/float16.h b/float16.h index ce6f850..1bb3d89 100644 --- a/float16.h +++ b/float16.h @@ -2,7 +2,7 @@ // // FILE: float16.h // AUTHOR: Rob Tillaart -// VERSION: 0.1.6 +// VERSION: 0.1.7 // PURPOSE: Arduino library to implement float16 data type. // half-precision floating point format, // used for efficient storage and transport. @@ -12,7 +12,7 @@ #include "Arduino.h" -#define FLOAT16_LIB_VERSION (F("0.1.6")) +#define FLOAT16_LIB_VERSION (F("0.1.7")) class float16: public Printable diff --git a/keywords.txt b/keywords.txt index 5396c88..dc1662f 100644 --- a/keywords.txt +++ b/keywords.txt @@ -6,7 +6,14 @@ float16 KEYWORD1 # Methods and Functions (KEYWORD2) +toDouble KEYWORD2 +getBinary KEYWORD2 +setBinary KEYWORD2 + +setDecimals KEYWORD2 +getDecimals KEYWORD2 # Constants (LITERAL1) +FLOAT16_LIB_VERSION LITERAL1 diff --git a/library.json b/library.json index e4c39a3..e1317eb 100644 --- a/library.json +++ b/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/float16.git" }, - "version": "0.1.6", + "version": "0.1.7", "license": "MIT", "frameworks": "arduino", "platforms": "*", diff --git a/library.properties b/library.properties index 41a856d..c0e5cb5 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=float16 -version=0.1.6 +version=0.1.7 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library to implement float16 data type. diff --git a/test/unit_test_001.cpp b/test/unit_test_001.cpp index a19522d..22dad87 100644 --- a/test/unit_test_001.cpp +++ b/test/unit_test_001.cpp @@ -88,8 +88,6 @@ unittest(test_constructor) unittest(test_compare_equal) { - fprintf(stderr, "FLOAT16_LIB_VERSION: %s\n", (char*) FLOAT16_LIB_VERSION); - float16 a(1); float16 b(1); float16 c(2); @@ -110,8 +108,6 @@ unittest(test_compare_equal) unittest(test_compare_1nequal) { - fprintf(stderr, "FLOAT16_LIB_VERSION: %s\n", (char*) FLOAT16_LIB_VERSION); - float16 a(1); float16 b(1); float16 c(2); @@ -138,8 +134,6 @@ unittest(test_compare_1nequal) unittest(test_negation) { - fprintf(stderr, "FLOAT16_LIB_VERSION: %s\n", (char*) FLOAT16_LIB_VERSION); - float16 f16(123.456); float16 f17(-f16); float16 f18 = -f16; @@ -151,8 +145,6 @@ unittest(test_negation) unittest(test_conversion) { - fprintf(stderr, "FLOAT16_LIB_VERSION: %s\n", (char*) FLOAT16_LIB_VERSION); - for (int i = 0; i < 20; i++) { float f = random(60000000) * 0.001; @@ -164,8 +156,6 @@ unittest(test_conversion) unittest(test_printable) { - fprintf(stderr, "FLOAT16_LIB_VERSION: %s\n", (char*) FLOAT16_LIB_VERSION); - float16 f16(123.456); // test default value. assertEqual(4, f16.getDecimals());