Implement sqrtf() as a wrapper around sqrt(), for simplicity.

This commit is contained in:
Serge
2022-05-27 17:14:04 -07:00
parent 2252835438
commit 75302a4eec
4 changed files with 13 additions and 3 deletions

View File

@@ -810,7 +810,7 @@ obj fncn(a,n) node **a;
else if (t == FEXP)
u = exp(getfval(x.optr));
else if (t == FSQRT)
u = 0 /* TODO: sqrt(getfval(x.optr))*/;
u = sqrt(getfval(x.optr));
else
error(FATAL, "illegal function type %d", t);
tempfree(x);

View File

@@ -36,9 +36,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define DEFLINEWIDTH 80
void fold(int width);
int
main(argc, argv)
int argc;
char **argv;
@@ -91,6 +95,7 @@ main(argc, argv)
exit(0);
}
void
fold(width)
register int width;
{

View File

@@ -51,3 +51,8 @@ sqrt(arg)
temp = 0.5*(temp + arg/temp);
return(temp);
}
float sqrtf(float arg)
{
return sqrt(arg);
}

View File

@@ -38,10 +38,10 @@ ifeq ($(LLVMBIN),)
$(error Unable to find any CLANG toolchain!)
endif
CC = $(LLVMBIN)clang -target mipsel -mcpu=mips32r2 -mabi=o32 -mfloat-abi=soft \
CC = $(LLVMBIN)clang -target mipsel -mcpu=mips32r2 -mabi=o32 -msoft-float \
-fomit-frame-pointer -finline-hint-functions -I$(TOPSRC)/include \
-Wno-builtin-requires-header
CXX = $(LLVMBIN)clang++ -target mipsel -mcpu=mips32r2 -mabi=o32 -mfloat-abi=soft \
CXX = $(LLVMBIN)clang++ -target mipsel -mcpu=mips32r2 -mabi=o32 -msoft-float \
-fomit-frame-pointer -finline-hint-functions -I$(TOPSRC)/include
LD = $(LLVMBIN)ld.lld -m elf32ltsmip
AR = $(LLVMBIN)llvm-ar