1
0
Fork
You've already forked radicalite
0
C语言 分数、二次根式和多项式库 Fractions, Quadratic radical, and Polynomial library for C language.
  • C 84%
  • CMake 10.9%
  • Lua 5.1%
Find a file
maxchen32 7350548809
All checks were successful
ci/woodpecker/manual/woodpecker Pipeline was successful
Added an isqrt_rad() function to accelerate square root on machines without fpu and avoid dependency on standard math library.
Use div() function to avoid duplicate divide in Radsqrt().
2025年07月25日 13:43:59 +08:00
.github/workflows updated xmake.io and workflow file 2024年05月03日 18:54:49 +08:00
.woodpecker test ci 3 2024年05月18日 20:18:45 +08:00
docs updated document 2023年07月28日 20:06:26 +08:00
examples updated README.md; removed MAX and MIN marco; fixed normal calc in simple_vector_calcs 2025年03月07日 14:43:31 +08:00
include Added an isqrt_rad() function to accelerate square root on machines without fpu and avoid dependency on standard math library. 2025年07月25日 13:43:59 +08:00
src Added an isqrt_rad() function to accelerate square root on machines without fpu and avoid dependency on standard math library. 2025年07月25日 13:43:59 +08:00
.gitignore update .gitignore 2024年01月14日 15:46:26 +08:00
CMakeLists.txt updated README.md; removed MAX and MIN marco; fixed normal calc in simple_vector_calcs 2025年03月07日 14:43:31 +08:00
Doxyfile add some comments for document 2023年07月28日 22:40:09 +08:00
LICENSE Initial commit 2023年01月24日 15:44:43 +00:00
README.md updated README.md; removed MAX and MIN marco; fixed normal calc in simple_vector_calcs 2025年03月07日 14:43:31 +08:00
xmake.lua updated xmake.io and workflow file 2024年05月03日 18:54:49 +08:00

radicalite

A better version of maxchen32/radical.

介绍 Intruductions

C语言编写的基础分数、二次根式和多项式类库。
radicalite is a library written in C for Fractions, Radicals, and Polynomials.

编译 Compilation

确保你安装了C编译器(GCC/MinGW,Clang,MSVC......),如果没有的话,Windows用户建议 使用这个编译好的 MinGW-gcc,Linux用户请通过所用发行版 的包管理器安装。
Make sure you have a C compiler (GCC/MinGW,Clang,MSVC...) installed. If not, Windows users are recommended to use this precompiled MinGW-gcc, and Linux users can install it through the distribution's package manager.

建议使用 xmake ,但是我们也提供 CMake 支持。
It is recommended to use xmake , but we also provide support for CMake .

xmake:

xmake f -m release
xmake

如果你在windows上使用MinGW,第一行得写成:
If you are using MinGW on windows, the first line should be written as:

xmake f -m release --toolchain=mingw

如果你想要安装到系统的话(默认 /usr/local/lib ):
If you want to install into the system (default is /usr/local/lib ):

xmake install --admin

如果你想要编译示例程序的话:
If you want to compile the example program:

xmake -a

CMake:

mkdir build
cd build 
cmake ..
cmake --build .

如果你想要安装到系统的话(默认 /usr/local/lib ):
If you want to install into the system (default is /usr/local/lib ):

sudo cmake --install .

用法 Usage

正在编写更多的文档,敬请期待......
More documentation coming soon...

或者你可以先看看头文件:
Or you can take a look at the header file first:

下面这些表说明了在不同类型之间运算应该使用什么函数
These tables describe what functions should be used to operate between different types.

加法 add

ADD Fraction Radical Polynomial int
Fraction addFrac Frac2Rad+addRad Frac2Rad+addRad int2Frac+addFrac
Radical Frac2Rad+addRad addRad addRad int2Rad+addRad
Polynomial Frac2Rad+addRad addRad addPoly int2Rad+addRad
int int2Frac+addFrac int2Rad+addRad int2Rad+addRad +

减法 sub

SUBTRAT Fraction Radical Polynomial int
Fraction subFrac Frac2Rad+subRad Frac2Rad+subRad int2Frac+subFrac
Radical Frac2Rad+subRad subRad subRad int2Rad+subRad
Polynomial Frac2Rad+subRad subRad subPoly int2Rad+subRad
int int2Frac+subFrac int2Rad+subRad int2Rad+subRad -

乘法 mul

multiply Fraction Radical Polynomial int
Fraction mulFrac Frac2Rad+mulRad Frac2Rad+mulRadPoly int2Frac+mulFrac
Radical Frac2Rad+mulRad mulRad mulRadPoly int2Rad+mulRad
Polynomial Frac2Rad+mulRadPoly mulRadPoly mulPoly int2Rad+mulRadPoly
int int2Frac+mulFrac int2Rad+mulRad int2Rad+mulRadPoly *

除法 div

divide Fraction Radical Polynomial int
Fraction divFrac Frac2Rad+divRad Frac2Rad+divRadPoly int2Frac+divFrac
Radical Frac2Rad+divRad divRad divRadPoly divintRad
Polynomial Frac2Rad+divRadPoly divRadPoly Not implemented divintPoly
int int2Frac+divFrac divintRad divintPoly /

乘方 pow

power Fraction Radical Polynomial int
int powFrac powRad Not implemented qpow_frac

P.S.: Radical类型还有一个squareRad专门用于平方,比powRad效率高。
P.S.: The Radical type also has a squareRad specialized for calculating squares, which performs better than powRad.

开方 sqrt

sqrt Fraction Radical Polynomial int
sqrtFrac N/A N/A Radsqrt