Skip to content

Commit

Permalink
add changelog.md (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart committed Nov 7, 2022
1 parent aae975c commit 1cbb5a8
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 37 deletions.
21 changes: 20 additions & 1 deletion .arduino-ci.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -8,4 +23,8 @@ compile:
- m4
- esp32
# - esp8266
# - mega2560
# - mega2560
- rpipico

libraries:
- "printHelpers"
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

24 changes: 2 additions & 22 deletions float16.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -27,15 +19,13 @@ float16::float16(double f)
_value = f32tof16(f);
}


// PRINTING
size_t float16::printTo(Print& p) const
{
double d = this->f16tof32(_value);
return p.print(d, _decimals);
};


double float16::toDouble() const
{
return f16tof32(_value);
Expand All @@ -51,7 +41,6 @@ bool float16::operator == (const float16 &f)
return (_value == f._value);
}


bool float16::operator != (const float16 &f)
{
return (_value != f._value);
Expand Down Expand Up @@ -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();
Expand All @@ -170,7 +152,6 @@ int float16::sign()
return 0;
}


bool float16::isZero()
{
return ((_value & 0x7FFF) == 0x0000);
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions float16.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=float16
version=0.1.6
version=0.1.7
author=Rob Tillaart <[email protected]>
maintainer=Rob Tillaart <[email protected]>
sentence=Arduino library to implement float16 data type.
Expand Down
10 changes: 0 additions & 10 deletions test/unit_test_001.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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());
Expand Down

0 comments on commit 1cbb5a8

Please sign in to comment.