mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-19 04:56:30 +00:00
bugfix: 修复浮点数打印错误的bug
This commit is contained in:
@ -1,11 +1,14 @@
|
||||
|
||||
all: fabs.o round.o
|
||||
|
||||
CFLAGS += -I .
|
||||
|
||||
all: fabs.o round.o pow.o
|
||||
|
||||
fabs.o: fabs.c
|
||||
gcc $(CFLAGS) -c fabs.c -o fabs.o
|
||||
|
||||
round.o: round.c
|
||||
gcc $(CFLAGS) -c round.c -o round.o
|
||||
gcc $(CFLAGS) -c round.c -o round.o
|
||||
|
||||
pow.o: pow.c
|
||||
gcc $(CFLAGS) -c pow.c -o pow.o
|
@ -1,6 +1,7 @@
|
||||
#include <libc/math.h>
|
||||
#include <libc/sys/types.h>
|
||||
#include "libm.h"
|
||||
|
||||
double fabs(double x)
|
||||
{
|
||||
union
|
||||
|
10
user/libs/libc/math/pow.c
Normal file
10
user/libs/libc/math/pow.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include "math.h"
|
||||
#include <libc/stddef.h>
|
||||
|
||||
int64_t pow(int64_t x, int y)
|
||||
{
|
||||
int64_t res = 1;
|
||||
for (int i = 0; i < y; ++i)
|
||||
res *= x;
|
||||
return res;
|
||||
}
|
Reference in New Issue
Block a user