0.1.16 Fraction

This commit is contained in:
Rob Tillaart 2023-11-02 15:10:48 +01:00
parent 8788c109fa
commit 299170332e
6 changed files with 212 additions and 197 deletions

View File

@ -1,4 +1,4 @@
# Change Log fraction # Change Log Fraction
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.1.16] - 2023-11-02
- update readme.md
- minor edits
## [0.1.15] - 2023-02-02 ## [0.1.15] - 2023-02-02
- update GitHub actions - update GitHub actions
- update license 2023 - update license 2023
@ -14,7 +19,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- change signature **double toDouble()** - change signature **double toDouble()**
- add **Fraction_performance.ino** to start performance testing. - add **Fraction_performance.ino** to start performance testing.
## [0.1.14] - 2022-11-07 ## [0.1.14] - 2022-11-07
- add changelog.md - add changelog.md
- add rp2040 to build-CI - add rp2040 to build-CI

View File

@ -1,7 +1,7 @@
// //
// FILE: fraction.cpp // FILE: fraction.cpp
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// VERSION: 0.1.15 // VERSION: 0.1.16
// PURPOSE: Arduino library to implement a Fraction data type // PURPOSE: Arduino library to implement a Fraction data type
// URL: https://github.com/RobTillaart/Fraction // URL: https://github.com/RobTillaart/Fraction
@ -404,6 +404,7 @@ void Fraction::fractionize(float val)
float testHigh = high.n - high.d * val; float testHigh = high.n - high.d * val;
if (testHigh < Precision * high.d) if (testHigh < Precision * high.d)
break; // high is answer break; // high is answer
if (testLow < Precision * low.d) if (testLow < Precision * low.d)
{ // low is answer { // low is answer
high = low; high = low;

View File

@ -2,15 +2,14 @@
// //
// FILE: fraction.h // FILE: fraction.h
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// VERSION: 0.1.15 // VERSION: 0.1.16
// PURPOSE: Arduino library to implement a Fraction data type // PURPOSE: Arduino library to implement a Fraction data type
// URL: https://github.com/RobTillaart/Fraction // URL: https://github.com/RobTillaart/Fraction
//
#include "Arduino.h" #include "Arduino.h"
#define FRACTION_LIB_VERSION (F("0.1.15")) #define FRACTION_LIB_VERSION (F("0.1.16"))
class Fraction: public Printable class Fraction: public Printable

View File

@ -15,8 +15,8 @@
"type": "git", "type": "git",
"url": "https://github.com/RobTillaart/Fraction.git" "url": "https://github.com/RobTillaart/Fraction.git"
}, },
"version": "0.1.15", "version": "0.1.16",
"frameworks": "arduino", "frameworks": "*",
"platforms": "*", "platforms": "*",
"headers": "fraction.h" "headers": "fraction.h"
} }

View File

@ -1,8 +1,8 @@
name=Fraction name=Fraction
version=0.1.15 version=0.1.16
author=Rob Tillaart <rob.tillaart@gmail.com> author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com> maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library to implement a Fraction datatype sentence=Arduino library to implement a Fraction datatype.
paragraph=Nominator and denominator are limited to 4 digits. Experimental. paragraph=Nominator and denominator are limited to 4 digits. Experimental.
category=Data Processing category=Data Processing
url=https://github.com/RobTillaart/Fraction url=https://github.com/RobTillaart/Fraction

View File

@ -2,8 +2,11 @@
[![Arduino CI](https://github.com/RobTillaart/Fraction/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci) [![Arduino CI](https://github.com/RobTillaart/Fraction/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![Arduino-lint](https://github.com/RobTillaart/Fraction/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/Fraction/actions/workflows/arduino-lint.yml) [![Arduino-lint](https://github.com/RobTillaart/Fraction/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/Fraction/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/Fraction/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/Fraction/actions/workflows/jsoncheck.yml) [![JSON check](https://github.com/RobTillaart/Fraction/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/Fraction/actions/workflows/jsoncheck.yml)
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/Fraction.svg)](https://github.com/RobTillaart/Fraction/issues)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/Fraction/blob/master/LICENSE) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/Fraction/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/Fraction.svg?maxAge=3600)](https://github.com/RobTillaart/Fraction/releases) [![GitHub release](https://img.shields.io/github/release/RobTillaart/Fraction.svg?maxAge=3600)](https://github.com/RobTillaart/Fraction/releases)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/Fraction.svg)](https://registry.platformio.org/libraries/robtillaart/Fraction)
# Fraction # Fraction
@ -51,7 +54,7 @@ In short, use fractions with care otherwise your sketch might get broken ;)
#### Printable #### Printable
The Fraction library implements Printable, so one can do. The Fraction library implements the Printable interface, so one can do.
```cpp ```cpp
Fraction fr(PI); Fraction fr(PI);
@ -102,7 +105,6 @@ The library is reasonably tested. If problems arise please open an issue.
#### Should #### Should
- performance testing - performance testing
- investigate divide by zero errors - investigate divide by zero errors
- NAN in fraction? => 0/0 ? - NAN in fraction? => 0/0 ?
- INF in fraction? => 1/0 and -1/0? - INF in fraction? => 1/0 and -1/0?
@ -120,3 +122,12 @@ The library is reasonably tested. If problems arise please open an issue.
#### Wont #### Wont
## Support
If you appreciate my libraries, you can support the development and maintenance.
Improve the quality of the libraries by providing issues and Pull Requests, or
donate through PayPal or GitHub sponsors.
Thank you,