Add flmath readme, update some module versions

This commit is contained in:
Lamdonn 2025-03-13 00:04:42 +08:00
parent 226ad1461c
commit 1846fbab1b
10 changed files with 87 additions and 59 deletions

View File

@ -2,7 +2,7 @@
![logo](/image/logo.png) ![logo](/image/logo.png)
[![Version](https://img.shields.io/badge/version-0.3.1-blue.svg)](https://gitee.com/Lamdonn/varch) [![Version](https://img.shields.io/badge/version-0.3.2-blue.svg)](https://gitee.com/Lamdonn/varch)
[![License](https://img.shields.io/badge/license-GPL%202.0-brightgreen.svg)](LICENSE) [![License](https://img.shields.io/badge/license-GPL%202.0-brightgreen.svg)](LICENSE)
[![Author](https://img.shields.io/badge/author-Lamdonn%20%20%20%20%20-brightblue.svg)](Lamdonn@163.com) [![Author](https://img.shields.io/badge/author-Lamdonn%20%20%20%20%20-brightblue.svg)](Lamdonn@163.com)
![Supported Platforms](https://img.shields.io/badge/platform-Linux%20&%20MinGW-yellow.svg) ![Supported Platforms](https://img.shields.io/badge/platform-Linux%20&%20MinGW-yellow.svg)
@ -18,7 +18,7 @@ It has the characteristics of **simplicity, universality, and efficiency**, with
| module | version | usage | path | describe | | module | version | usage | path | describe |
|:-------------|:---------|:-----------------------------|:------------------------------------------|:--------------------------------------| |:-------------|:---------|:-----------------------------|:------------------------------------------|:--------------------------------------|
| overall | 00.03.01 | [link](README.en.md) | [path](./) | Overall | overall | 00.03.02 | [link](README.en.md) | [path](./) | Overall
| init | 01.00.00 | [link](/doc/init.en.md) | [path](./source/00_application) | Initialize export module | init | 01.00.00 | [link](/doc/init.en.md) | [path](./source/00_application) | Initialize export module
| console | 01.00.01 | [link](/doc/console.en.md) | [path](./source/00_application/console) | Console command input, combined with the 'command' module, parsing commands entered in the console | console | 01.00.01 | [link](/doc/console.en.md) | [path](./source/00_application/console) | Console command input, combined with the 'command' module, parsing commands entered in the console
| arg | 01.00.00 | [link](/doc/arg.en.md) | [path](./source/01_general) | Indefinite parameters, obtain the number of indefinite parameters and specified parameters | arg | 01.00.00 | [link](/doc/arg.en.md) | [path](./source/01_general) | Indefinite parameters, obtain the number of indefinite parameters and specified parameters
@ -72,8 +72,9 @@ It has the characteristics of **simplicity, universality, and efficiency**, with
| romt | 01.00.00 | [link](/doc/romt.en.md) | [path](./source/06_performance) | ROM test module | romt | 01.00.00 | [link](/doc/romt.en.md) | [path](./source/06_performance) | ROM test module
| cpul | 01.00.00 | [link](/doc/cpul.en.md) | [path](./source/06_performance) | CPU load test module, including obtaining and increasing load | cpul | 01.00.00 | [link](/doc/cpul.en.md) | [path](./source/06_performance) | CPU load test module, including obtaining and increasing load
| unitt | 01.00.00 | [link](/doc/unitt.en.md) | [path](./source/06_performance) | Simple unit test module | unitt | 01.00.00 | [link](/doc/unitt.en.md) | [path](./source/06_performance) | Simple unit test module
| intl | 01.00.00 | [link](/doc/intl.en.md) | [path](./source/07_math) | Large integer arithmetic module | intl | 01.01.00 | [link](/doc/intl.en.md) | [path](./source/07_math) | Large integer arithmetic module
| floatl | 01.00.00 | [link](/doc/floatl.en.md) | [path](./source/07_math) | Large floating-point arithmetic module | floatl | 01.01.00 | [link](/doc/floatl.en.md) | [path](./source/07_math) | Large floating-point arithmetic module
| flmath | 01.00.00 | [link](/doc/flmath.en.md) | [path](./source/07_math) | Large floating-point arithmetic math module
## Usage ## Usage

View File

@ -2,7 +2,7 @@
![logo](/image/logo.png) ![logo](/image/logo.png)
[![Version](https://img.shields.io/badge/version-0.3.1-blue.svg)](https://gitee.com/Lamdonn/varch) [![Version](https://img.shields.io/badge/version-0.3.2-blue.svg)](https://gitee.com/Lamdonn/varch)
[![License](https://img.shields.io/badge/license-GPL%202.0-brightgreen.svg)](LICENSE) [![License](https://img.shields.io/badge/license-GPL%202.0-brightgreen.svg)](LICENSE)
[![Author](https://img.shields.io/badge/author-Lamdonn%20%20%20%20%20-brightblue.svg)](Lamdonn@163.com) [![Author](https://img.shields.io/badge/author-Lamdonn%20%20%20%20%20-brightblue.svg)](Lamdonn@163.com)
![Supported Platforms](https://img.shields.io/badge/platform-Linux%20&%20MinGW-yellow.svg) ![Supported Platforms](https://img.shields.io/badge/platform-Linux%20&%20MinGW-yellow.svg)
@ -18,7 +18,7 @@ varchwe-architecture意为我们的框架库是嵌入式C语言常用
| module | version | usage | path | describe | | module | version | usage | path | describe |
|:-------------|:---------|:-----------------------------|:------------------------------------------|:--------------------------------------| |:-------------|:---------|:-----------------------------|:------------------------------------------|:--------------------------------------|
| overall | 00.03.01 | [link](README.md) | [path](./) | 整体 | overall | 00.03.02 | [link](README.md) | [path](./) | 整体
| init | 01.00.00 | [link](/doc/init.md) | [path](./source/00_application) | 初始化导出模块 | init | 01.00.00 | [link](/doc/init.md) | [path](./source/00_application) | 初始化导出模块
| console | 01.00.01 | [link](/doc/console.md) | [path](./source/00_application/console) | 控制台命令输入,结合 `command` 模块,解析在控制台中输入的命令 | console | 01.00.01 | [link](/doc/console.md) | [path](./source/00_application/console) | 控制台命令输入,结合 `command` 模块,解析在控制台中输入的命令
| arg | 01.00.00 | [link](/doc/arg.md) | [path](./source/01_general) | 不定参数,获取不定参数和指定参数的个数 | arg | 01.00.00 | [link](/doc/arg.md) | [path](./source/01_general) | 不定参数,获取不定参数和指定参数的个数
@ -72,8 +72,9 @@ varchwe-architecture意为我们的框架库是嵌入式C语言常用
| romt | 01.00.00 | [link](/doc/romt.md) | [path](./source/06_performance) | ROM测试模块 | romt | 01.00.00 | [link](/doc/romt.md) | [path](./source/06_performance) | ROM测试模块
| cpul | 01.00.00 | [link](/doc/cpul.md) | [path](./source/06_performance) | CPU负载测试模块包含获取和增加负载 | cpul | 01.00.00 | [link](/doc/cpul.md) | [path](./source/06_performance) | CPU负载测试模块包含获取和增加负载
| unitt | 01.00.00 | [link](/doc/unitt.md) | [path](./source/06_performance) | 简易的单元测试模块 | unitt | 01.00.00 | [link](/doc/unitt.md) | [path](./source/06_performance) | 简易的单元测试模块
| intl | 01.00.00 | [link](/doc/intl.md) | [path](./source/07_math) | 大型整数运算模块 | intl | 01.01.00 | [link](/doc/intl.md) | [path](./source/07_math) | 大型整数运算模块
| floatl | 01.00.00 | [link](/doc/floatl.md) | [path](./source/07_math) | 大型浮点数运算模块 | floatl | 01.01.00 | [link](/doc/floatl.md) | [path](./source/07_math) | 大型浮点数运算模块
| flmath | 01.00.00 | [link](/doc/flmath.md) | [path](./source/07_math) | 大型浮点数数学运算模块
## 使用说明 ## 使用说明

31
doc/flmath.en.md Normal file
View File

@ -0,0 +1,31 @@
## Introduction
`flmath` is a large floating-point math module that depends on `floatl` and supports common math functions.
## Interfaces
### Arithmetic Functions
```c
floatl floatl_sin(floatl x);
floatl floatl_cos(floatl x);
floatl floatl_sec(floatl x);
floatl floatl_csc(floatl x);
floatl floatl_tan(floatl x);
floatl floatl_exp(floatl x);
floatl floatl_ln(floatl x);
floatl floatl_log(floatl x, floatl y);
floatl floatl_log2(floatl x);
floatl floatl_log10(floatl x);
floatl floatl_sigmoid(floatl x);
floatl floatl_dsigmoid(floatl x);
floatl floatl_sinh(floatl x);
floatl floatl_cosh(floatl x);
floatl floatl_tanh(floatl x);
floatl floatl_coth(floatl x);
floatl floatl_sech(floatl x);
floatl floatl_csch(floatl x);
floatl floatl_sqrt(floatl x);
floatl floatl_pow(floatl x, floatl y);
```

30
doc/flmath.md Normal file
View File

@ -0,0 +1,30 @@
## 介绍
`flmath`为一个大型浮点数数学运算模块,依赖于`floatl`模块,支持常用的数学运算函数。
## 接口
### 运算函数
```c
floatl floatl_sin(floatl x);
floatl floatl_cos(floatl x);
floatl floatl_sec(floatl x);
floatl floatl_csc(floatl x);
floatl floatl_tan(floatl x);
floatl floatl_exp(floatl x);
floatl floatl_ln(floatl x);
floatl floatl_log(floatl x, floatl y);
floatl floatl_log2(floatl x);
floatl floatl_log10(floatl x);
floatl floatl_sigmoid(floatl x);
floatl floatl_dsigmoid(floatl x);
floatl floatl_sinh(floatl x);
floatl floatl_cosh(floatl x);
floatl floatl_tanh(floatl x);
floatl floatl_coth(floatl x);
floatl floatl_sech(floatl x);
floatl floatl_csch(floatl x);
floatl floatl_sqrt(floatl x);
floatl floatl_pow(floatl x, floatl y);
```

View File

@ -1,3 +1,13 @@
version 0.3.2
date 2025.03.13
changes
1. Add the flmath initial version
2. Fix floatl print issue
3. Optimize the configuration code of floatl
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
version 0.3.1 version 0.3.1
date 2025.03.04 date 2025.03.04
changes changes

View File

@ -6,7 +6,7 @@
* \unit flmath * \unit flmath
* \brief This is a simple large float number math calculate module for C language * \brief This is a simple large float number math calculate module for C language
* \author Lamdonn * \author Lamdonn
* \version v1.0.1 * \version v1.0.0
* \license GPL-2.0 * \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn. * \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/ ********************************************************************************************************/

View File

@ -7,7 +7,7 @@
* \unit flmath * \unit flmath
* \brief This is a simple large float number math calculate module for C language * \brief This is a simple large float number math calculate module for C language
* \author Lamdonn * \author Lamdonn
* \version v1.0.1 * \version v1.0.0
* \license GPL-2.0 * \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn. * \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/ ********************************************************************************************************/

View File

@ -6,7 +6,7 @@
* \unit floatl * \unit floatl
* \brief This is a simple large float number calculate module for C language * \brief This is a simple large float number calculate module for C language
* \author Lamdonn * \author Lamdonn
* \version v1.0.1 * \version v1.1.0
* \license GPL-2.0 * \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn. * \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/ ********************************************************************************************************/
@ -1687,49 +1687,6 @@ floatl floatl_from(const char *str)
return number; return number;
} }
/**
* \brief Convert a single - precision floating - point number (float) to a 'floatl' type.
* \param[in] value: The single - precision floating - point number to be converted.
* \return A 'floatl' value representing the converted number. Returns FLOATL_NAN if the input is NaN,
* FLOATL_INF if the input is infinity, and the converted value otherwise.
*
* This function takes a float value and converts it to a 'floatl' value. It first checks if the input
* is NaN or infinity and sets the result accordingly. Otherwise, it extracts the mantissa and exponent
* from the float and adjusts them to fit the 'floatl' format.
*/
floatl floatl_from_f(float value)
{
// Initialize the result to 0
floatl result = {0};
// Union to access the float value as an integer and its components
float_u f = {.float_ = value};
// Check if the input is NaN
if ((f.int_ & 0x7fffffff) > 0x7f800000)
{
result = FLOATL_NAN;
}
// Check if the input is infinity
else if ((f.int_ & 0x7fffffff) == 0x7f800000)
{
result = FLOATL_INF;
}
else
{
// Extract the mantissa from the float and store it in the 'floatl' mantissa
result.mantissas[0] = f.mantissa;
// Shift the mantissa to the appropriate position in the 'floatl' format
result = floatl_int_shl(result, __FLOATL_MANT_BITS__ - 23);
// Adjust the exponent to fit the 'floatl' format
result.exponent = (uint32_t)(((int32_t)f.exponent - 127) + __FLOATL_EXP_MID_VALUE__);
}
// Set the sign of the 'floatl' result
result.sign = f.sign;
return result;
}
/** /**
* \brief Convert a double - precision floating - point number (double) to a 'floatl' type. * \brief Convert a double - precision floating - point number (double) to a 'floatl' type.
* \param[in] value: The double - precision floating - point number to be converted. * \param[in] value: The double - precision floating - point number to be converted.

View File

@ -7,7 +7,7 @@
* \unit floatl * \unit floatl
* \brief This is a simple large float number calculate module for C language * \brief This is a simple large float number calculate module for C language
* \author Lamdonn * \author Lamdonn
* \version v1.0.1 * \version v1.1.0
* \license GPL-2.0 * \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn. * \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/ ********************************************************************************************************/
@ -24,7 +24,7 @@
/* Version infomation */ /* Version infomation */
#define FLOATL_V_MAJOR 1 #define FLOATL_V_MAJOR 1
#define FLOATL_V_MINOR 0 #define FLOATL_V_MINOR 1
#define FLOATL_V_PATCH 0 #define FLOATL_V_PATCH 0
/** /**
@ -150,11 +150,9 @@ floatl floatl_round(floatl a);
// Conversion functions // Conversion functions
// floatl_from: Converts a string to a floatl number // floatl_from: Converts a string to a floatl number
// floatl_from_f: Converts a single-precision floating-point number (float) to a floatl number
// floatl_from_d: Converts a double-precision floating-point number (double) to a floatl number // floatl_from_d: Converts a double-precision floating-point number (double) to a floatl number
floatl floatl_from(const char *str); floatl floatl_from(const char *str);
floatl floatl_from_f(float value);
floatl floatl_from_d(double value); floatl floatl_from_d(double value);
// Output function // Output function

View File

@ -7,7 +7,7 @@
* \unit floatl * \unit floatl
* \brief This is a simple large int number calculate module config header file for C language * \brief This is a simple large int number calculate module config header file for C language
* \author Lamdonn * \author Lamdonn
* \version v1.0.1 * \version v1.1.0
* \license GPL-2.0 * \license GPL-2.0
* \copyright Copyright (C) 2023 Lamdonn. * \copyright Copyright (C) 2023 Lamdonn.
********************************************************************************************************/ ********************************************************************************************************/