mirror of
https://gitee.com/Lamdonn/varch.git
synced 2025-12-06 08:46:42 +08:00
Add flmath readme, update some module versions
This commit is contained in:
parent
226ad1461c
commit
1846fbab1b
@ -2,7 +2,7 @@
|
||||
|
||||

|
||||
|
||||
[](https://gitee.com/Lamdonn/varch)
|
||||
[](https://gitee.com/Lamdonn/varch)
|
||||
[](LICENSE)
|
||||
[](Lamdonn@163.com)
|
||||

|
||||
@ -18,7 +18,7 @@ It has the characteristics of **simplicity, universality, and efficiency**, with
|
||||
|
||||
| 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
|
||||
| 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
|
||||
@ -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
|
||||
| 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
|
||||
| intl | 01.00.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
|
||||
| intl | 01.01.00 | [link](/doc/intl.en.md) | [path](./source/07_math) | Large integer 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
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||

|
||||
|
||||
[](https://gitee.com/Lamdonn/varch)
|
||||
[](https://gitee.com/Lamdonn/varch)
|
||||
[](LICENSE)
|
||||
[](Lamdonn@163.com)
|
||||

|
||||
@ -18,7 +18,7 @@ varch(we-architecture,意为我们的框架库)是嵌入式C语言常用
|
||||
|
||||
| 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) | 初始化导出模块
|
||||
| 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) | 不定参数,获取不定参数和指定参数的个数
|
||||
@ -72,8 +72,9 @@ varch(we-architecture,意为我们的框架库)是嵌入式C语言常用
|
||||
| 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负载测试模块,包含获取和增加负载
|
||||
| unitt | 01.00.00 | [link](/doc/unitt.md) | [path](./source/06_performance) | 简易的单元测试模块
|
||||
| intl | 01.00.00 | [link](/doc/intl.md) | [path](./source/07_math) | 大型整数运算模块
|
||||
| floatl | 01.00.00 | [link](/doc/floatl.md) | [path](./source/07_math) | 大型浮点数运算模块
|
||||
| intl | 01.01.00 | [link](/doc/intl.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
31
doc/flmath.en.md
Normal 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
30
doc/flmath.md
Normal 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);
|
||||
```
|
||||
10
release.txt
10
release.txt
@ -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
|
||||
date 2025.03.04
|
||||
changes
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* \unit flmath
|
||||
* \brief This is a simple large float number math calculate module for C language
|
||||
* \author Lamdonn
|
||||
* \version v1.0.1
|
||||
* \version v1.0.0
|
||||
* \license GPL-2.0
|
||||
* \copyright Copyright (C) 2023 Lamdonn.
|
||||
********************************************************************************************************/
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* \unit flmath
|
||||
* \brief This is a simple large float number math calculate module for C language
|
||||
* \author Lamdonn
|
||||
* \version v1.0.1
|
||||
* \version v1.0.0
|
||||
* \license GPL-2.0
|
||||
* \copyright Copyright (C) 2023 Lamdonn.
|
||||
********************************************************************************************************/
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* \unit floatl
|
||||
* \brief This is a simple large float number calculate module for C language
|
||||
* \author Lamdonn
|
||||
* \version v1.0.1
|
||||
* \version v1.1.0
|
||||
* \license GPL-2.0
|
||||
* \copyright Copyright (C) 2023 Lamdonn.
|
||||
********************************************************************************************************/
|
||||
@ -1687,49 +1687,6 @@ floatl floatl_from(const char *str)
|
||||
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.
|
||||
* \param[in] value: The double - precision floating - point number to be converted.
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* \unit floatl
|
||||
* \brief This is a simple large float number calculate module for C language
|
||||
* \author Lamdonn
|
||||
* \version v1.0.1
|
||||
* \version v1.1.0
|
||||
* \license GPL-2.0
|
||||
* \copyright Copyright (C) 2023 Lamdonn.
|
||||
********************************************************************************************************/
|
||||
@ -24,7 +24,7 @@
|
||||
/* Version infomation */
|
||||
|
||||
#define FLOATL_V_MAJOR 1
|
||||
#define FLOATL_V_MINOR 0
|
||||
#define FLOATL_V_MINOR 1
|
||||
#define FLOATL_V_PATCH 0
|
||||
|
||||
/**
|
||||
@ -150,11 +150,9 @@ floatl floatl_round(floatl a);
|
||||
|
||||
// Conversion functions
|
||||
// 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 floatl_from(const char *str);
|
||||
floatl floatl_from_f(float value);
|
||||
floatl floatl_from_d(double value);
|
||||
|
||||
// Output function
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* \unit floatl
|
||||
* \brief This is a simple large int number calculate module config header file for C language
|
||||
* \author Lamdonn
|
||||
* \version v1.0.1
|
||||
* \version v1.1.0
|
||||
* \license GPL-2.0
|
||||
* \copyright Copyright (C) 2023 Lamdonn.
|
||||
********************************************************************************************************/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user