2021-11-27 10:28:52 -05:00
|
|
|
//
|
|
|
|
// FILE: float16_test1.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: test float16
|
|
|
|
// DATE: 2015-03-11
|
|
|
|
// URL: https://github.com/RobTillaart/float16
|
|
|
|
//
|
|
|
|
|
2021-12-02 14:27:32 -05:00
|
|
|
|
2021-11-27 10:28:52 -05:00
|
|
|
#include "float16.h"
|
|
|
|
|
|
|
|
float16 X;
|
|
|
|
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
while(!Serial);
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println(__FILE__);
|
|
|
|
Serial.print("FLOAT16_LIB_VERSION: ");
|
|
|
|
Serial.println(FLOAT16_LIB_VERSION);
|
|
|
|
|
|
|
|
float f;
|
|
|
|
|
2021-12-02 14:27:32 -05:00
|
|
|
// dump all possible values
|
|
|
|
for (uint16_t n = 0; n < 65535; n++)
|
2021-11-27 10:28:52 -05:00
|
|
|
{
|
|
|
|
f = X.f16tof32(n);
|
|
|
|
Serial.print(n);
|
|
|
|
Serial.print('\t');
|
|
|
|
Serial.println(f, 6);
|
|
|
|
}
|
|
|
|
|
|
|
|
Serial.println("\ndone");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// -- END OF FILE --
|
|
|
|
|
|
|
|
|