mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-19 16:46:11 -04:00
0.2.3 fast_math
This commit is contained in:
parent
503583d4c0
commit
9b422fd170
@ -6,10 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.2.3] - 2024-01-03
|
||||
- fix typos examples
|
||||
- minor edits
|
||||
|
||||
## [0.2.2] - 2023-10-26
|
||||
- update readme.md
|
||||
|
||||
|
||||
## [0.2.1] - 2022-12-25
|
||||
- add divmod3()
|
||||
- add divmod5()
|
||||
|
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2013-2023 Rob Tillaart
|
||||
Copyright (c) 2013-2024 Rob Tillaart
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -12,6 +12,7 @@
|
||||
uint32_t start, stop;
|
||||
volatile uint8_t z;
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
@ -66,7 +67,7 @@ void setup()
|
||||
Serial.print("\n");
|
||||
delay(100);
|
||||
|
||||
// not 100% correct but it measures performance
|
||||
// not 100% correct but it measures performance
|
||||
Serial.print("bcd2decRef:\t");
|
||||
delay(10);
|
||||
start = micros();
|
||||
@ -81,7 +82,7 @@ void setup()
|
||||
Serial.print("\n");
|
||||
delay(100);
|
||||
|
||||
// not 100% correct but it measures performance
|
||||
// not 100% correct but it measures performance
|
||||
Serial.print("bcd2dec:\t");
|
||||
delay(10);
|
||||
start = micros();
|
||||
@ -145,4 +146,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -85,4 +85,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -85,4 +85,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -85,4 +85,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -85,4 +85,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -85,4 +85,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -85,4 +85,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -2,7 +2,7 @@
|
||||
// FILE: ping2_temp_compensated.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2022-12-25
|
||||
// PUPROSE: test fast routines for PING))) sensor
|
||||
// PURPOSE: test fast routines for PING))) sensor
|
||||
// URL: https://github.com/RobTillaart/fast_math
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// FILE: ping2cm.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2013-05-11
|
||||
// PUPROSE: test fast routines for PING))) sensor
|
||||
// PURPOSE: test fast routines for PING))) sensor
|
||||
// URL: https://github.com/RobTillaart/fast_math
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// FILE: ping2inch.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2022-12-09
|
||||
// PUPROSE: test fast routines for PING))) sensor
|
||||
// PURPOSE: test fast routines for PING))) sensor
|
||||
// URL: https://github.com/RobTillaart/fast_math
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@ float x, y, z, sum, error;
|
||||
float YY1, YY2, YY3;
|
||||
float ar[3];
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
@ -108,7 +109,7 @@ void search_heat()
|
||||
float error;
|
||||
float minimum = 1E9;
|
||||
float a, b, c;
|
||||
a = b = c = 0; // arbitrary start
|
||||
a = b = c = 0; // arbitrary start
|
||||
uint32_t start = millis();
|
||||
while (millis() - start < 60000) // search for 1 minute
|
||||
{
|
||||
@ -158,4 +159,4 @@ void search_heat()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: fast_math.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.2.2
|
||||
// VERSION: 0.2.3
|
||||
// PURPOSE: Arduino library for fast math algorithms
|
||||
// DATE: 27 October 2013
|
||||
// URL: https://github.com/RobTillaart/fast_math
|
||||
@ -175,6 +175,7 @@ uint16_t ping2cm(uint16_t in)
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
uint16_t ping2mm(uint16_t in)
|
||||
{
|
||||
// divide by 2.941176 == * 0.34;
|
||||
@ -194,6 +195,7 @@ uint16_t ping2mm(uint16_t in)
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
uint16_t ping2inch(uint16_t in)
|
||||
{
|
||||
// divide by 74.70588235 == * 0.0133858
|
||||
@ -213,6 +215,7 @@ uint16_t ping2inch(uint16_t in)
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
uint16_t ping2quarter(uint16_t in)
|
||||
{
|
||||
// divide by 18.6764705875 == * 0.05354330709
|
||||
@ -234,6 +237,7 @@ uint16_t ping2quarter(uint16_t in)
|
||||
return q;
|
||||
}
|
||||
|
||||
|
||||
uint16_t ping2sixteenths(uint16_t in)
|
||||
{
|
||||
// divide by 4.669117646875 == * 0.214173228
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// FILE: fast_math.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.2.2
|
||||
// VERSION: 0.2.3
|
||||
// PURPOSE: Arduino library for fast math algorithms
|
||||
// DATE: 27 October 2013
|
||||
// URL: https://github.com/RobTillaart/fast_math
|
||||
@ -16,7 +16,7 @@
|
||||
#include "Arduino.h"
|
||||
#endif
|
||||
|
||||
#define FASTMATH_LIB_VERSION (F("0.2.2"))
|
||||
#define FASTMATH_LIB_VERSION (F("0.2.3"))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -36,6 +36,7 @@ extern "C"
|
||||
void divmod10(uint32_t in, uint32_t *div, uint8_t *mod);
|
||||
void divmod3(uint32_t in, uint32_t *div, uint8_t *mod);
|
||||
void divmod5(uint32_t in, uint32_t *div, uint8_t *mod);
|
||||
|
||||
// for clocks
|
||||
void divmod12(uint32_t in, uint32_t *div, uint8_t *mod);
|
||||
void divmod24(uint32_t in, uint32_t *div, uint8_t *mod);
|
||||
@ -63,6 +64,8 @@ uint8_t bcd2dec(uint8_t value);
|
||||
// assumes degree >= 1, and ar[0] exists, and could be 0.
|
||||
//
|
||||
// e.g y = 3x^2 + 5x + 7 ==> ar[] = { 7, 5, 3 }; degree = 2;
|
||||
// index is exponent of x
|
||||
// 7x^0 + 5x^1 + 3x^2
|
||||
//
|
||||
float polynome(float x, float ar[], uint8_t degree);
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/fast_math.git"
|
||||
},
|
||||
"version": "0.2.2",
|
||||
"version": "0.2.3",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=fast_math
|
||||
version=0.2.2
|
||||
version=0.2.3
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for fast math algorithms
|
||||
|
@ -45,4 +45,4 @@ unittest(test_I)
|
||||
unittest_main()
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
Loading…
Reference in New Issue
Block a user