mirror of
https://github.com/cc65/cc65.git
synced 2024-06-09 06:29:38 +00:00
some cleanup, make testcompiles of the tests with gcc work again
This commit is contained in:
parent
89f8f51c32
commit
af15ce8223
15
test/float/.gitignore
vendored
15
test/float/.gitignore
vendored
|
@ -1,7 +1,8 @@
|
|||
*.bin
|
||||
*.prg
|
||||
*.c64.s
|
||||
*.woz.s
|
||||
float-basic.s
|
||||
float-basic-cmp.s
|
||||
float-minimal.s
|
||||
quick.bin
|
||||
quick.prg
|
||||
quick.s
|
||||
quick.c64.s
|
||||
float-basic
|
||||
float-cmp
|
||||
float-conv
|
||||
float-minimal
|
||||
|
|
|
@ -6,267 +6,48 @@ CL65=../../bin/cl65
|
|||
CA65=../../bin/ca65
|
||||
SIM65=../../bin/sim65
|
||||
|
||||
OPT=
|
||||
OPT=-O
|
||||
|
||||
FILES=\
|
||||
quick.prg \
|
||||
\
|
||||
float-minimal.prg \
|
||||
float-minimal.bin \
|
||||
float-minimal.woz.bin \
|
||||
float-minimal.soft.bin \
|
||||
\
|
||||
float-basic.prg \
|
||||
float-basic.bin \
|
||||
float-basic.woz.bin \
|
||||
float-basic.soft.bin \
|
||||
\
|
||||
float-conv.prg \
|
||||
float-conv.bin \
|
||||
float-conv.woz.bin \
|
||||
float-conv.soft.bin \
|
||||
\
|
||||
float-cmp.prg \
|
||||
float-cmp.bin \
|
||||
float-cmp.woz.bin \
|
||||
float-cmp.soft.bin \
|
||||
\
|
||||
float-misc.prg \
|
||||
float-misc.bin \
|
||||
float-misc.woz.bin \
|
||||
float-misc.soft.bin
|
||||
TDIR=../val
|
||||
|
||||
all: quick
|
||||
|
||||
##############################################################################
|
||||
HEADER=\
|
||||
include/_float.h \
|
||||
include/math.h
|
||||
|
||||
CBMRUNTIME=\
|
||||
cbmkernal/float.s \
|
||||
cbmkernal/ftoa.c \
|
||||
cbmkernal/ffloor.c \
|
||||
cbmkernal/cc65wrapper.s
|
||||
quick.bin: quick.c
|
||||
$(CC65) $(OPT) -t sim6502 --add-source -o quick.s quick.c
|
||||
# gdb --args $(CC65) $(OPT) -t sim6502 --add-source -o quick.s quick.c
|
||||
$(CL65) $(OPT) -t sim6502 -o quick.bin quick.s
|
||||
|
||||
SOFTFLOAT=\
|
||||
softfloat/softfloat.c \
|
||||
softfloat/ftostr.c \
|
||||
softfloat/cc65wrapper.s
|
||||
|
||||
IEEERUNTIME=\
|
||||
ieee754/feaxint.s \
|
||||
ieee754/feaxlong.s \
|
||||
ieee754/fbnegeax.s \
|
||||
ieee754/eaxufloat.s \
|
||||
ieee754/eaxfloat.s \
|
||||
ieee754/axufloat.s \
|
||||
ieee754/axfloat.s \
|
||||
ieee754/aufloat.s \
|
||||
ieee754/afloat.s \
|
||||
ieee754/ftosaddeax.s \
|
||||
ieee754/ftossubeax.s \
|
||||
ieee754/ftosdiveax.s \
|
||||
ieee754/ftosmuleax.s \
|
||||
ieee754/ftoseqeax.s \
|
||||
ieee754/ftosneeax.s \
|
||||
ieee754/ftosgteax.s \
|
||||
ieee754/ftoslteax.s \
|
||||
ieee754/ftosgeeax.s \
|
||||
ieee754/ftosleeax.s \
|
||||
ieee754/_ftostr.c
|
||||
|
||||
WOZRUNTIME=\
|
||||
woz/feaxint.s \
|
||||
woz/feaxlong.s \
|
||||
woz/fbnegeax.s \
|
||||
woz/eaxufloat.s \
|
||||
woz/eaxfloat.s \
|
||||
woz/axufloat.s \
|
||||
woz/axfloat.s \
|
||||
woz/aufloat.s \
|
||||
woz/afloat.s \
|
||||
woz/ftosaddeax.s \
|
||||
woz/ftossubeax.s \
|
||||
woz/ftosdiveax.s \
|
||||
woz/ftosmuleax.s \
|
||||
woz/ftoseqeax.s \
|
||||
woz/ftosneeax.s \
|
||||
woz/ftosgteax.s \
|
||||
woz/ftoslteax.s \
|
||||
woz/ftosgeeax.s \
|
||||
woz/ftosleeax.s \
|
||||
woz/_ftostr.c \
|
||||
woz/wozfp.s
|
||||
|
||||
##############################################################################
|
||||
# The IEEE755 assembler implementation
|
||||
|
||||
all: $(FILES)
|
||||
|
||||
float-minimal.s: float-minimal.c $(HEADER) $(IEEERUNTIME)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-minimal.s float-minimal.c
|
||||
float-minimal.bin: float-minimal.s $(HEADER) $(IEEERUNTIME)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-minimal.bin float-minimal.s $(IEEERUNTIME)
|
||||
|
||||
float-basic.s: float-basic.c $(HEADER) $(IEEERUNTIME)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-basic.s float-basic.c
|
||||
float-basic.bin: float-basic.s $(HEADER) $(IEEERUNTIME)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-basic.bin float-basic.s $(IEEERUNTIME)
|
||||
|
||||
float-conv.s: float-conv.c $(HEADER) $(IEEERUNTIME)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-conv.s float-conv.c
|
||||
float-conv.bin: float-conv.s $(HEADER) $(IEEERUNTIME)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-conv.bin float-conv.s $(IEEERUNTIME)
|
||||
|
||||
float-cmp.s: float-cmp.c $(HEADER) $(IEEERUNTIME)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-cmp.s float-cmp.c
|
||||
float-cmp.bin: float-cmp.s $(HEADER) $(IEEERUNTIME)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-cmp.bin float-cmp.s $(IEEERUNTIME)
|
||||
|
||||
float-misc.s: float-misc.c $(HEADER) $(IEEERUNTIME)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-misc.s float-misc.c
|
||||
float-misc.bin: float-misc.s $(HEADER) $(IEEERUNTIME)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-misc.bin float-misc.s $(IEEERUNTIME)
|
||||
|
||||
###############################################################################
|
||||
# WOZ floats
|
||||
|
||||
float-minimal.woz.s: float-minimal.c $(HEADER) $(WOZRUNTIME)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-minimal.woz.s float-minimal.c
|
||||
float-minimal.woz.bin: float-minimal.woz.s $(HEADER) $(WOZRUNTIME)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-minimal.woz.bin float-minimal.woz.s $(WOZRUNTIME)
|
||||
|
||||
float-basic.woz.s: float-basic.c $(HEADER) $(WOZRUNTIME)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-basic.woz.s float-basic.c
|
||||
float-basic.woz.bin: float-basic.woz.s $(HEADER) $(WOZRUNTIME)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-basic.woz.bin float-basic.woz.s $(WOZRUNTIME)
|
||||
|
||||
float-conv.woz.s: float-conv.c $(HEADER) $(WOZRUNTIME)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-conv.woz.s float-conv.c
|
||||
float-conv.woz.bin: float-conv.woz.s $(HEADER) $(WOZRUNTIME)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-conv.woz.bin float-conv.woz.s $(WOZRUNTIME)
|
||||
|
||||
float-cmp.woz.s: float-cmp.c $(HEADER) $(WOZRUNTIME)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-cmp.woz.s float-cmp.c
|
||||
float-cmp.woz.bin: float-cmp.woz.s $(HEADER) $(WOZRUNTIME)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-cmp.woz.bin float-cmp.woz.s $(WOZRUNTIME)
|
||||
|
||||
float-misc.woz.s: float-misc.c $(HEADER) $(WOZRUNTIME)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-misc.woz.s float-misc.c
|
||||
float-misc.woz.bin: float-misc.woz.s $(HEADER) $(WOZRUNTIME)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-misc.woz.bin float-misc.woz.s $(WOZRUNTIME)
|
||||
|
||||
runwoz: float-minimal.woz.bin float-basic.woz.bin float-cmp.woz.bin
|
||||
$(SIM65) float-minimal.woz.bin
|
||||
$(SIM65) float-basic.woz.bin
|
||||
$(SIM65) float-cmp.woz.bin
|
||||
|
||||
###############################################################################
|
||||
# Berkeley softfloat
|
||||
|
||||
softfloat.s:
|
||||
$(CL65) $(OPT) -S -t sim6502 -I ./include -o softfloat.s softfloat/softfloat.c
|
||||
|
||||
float-minimal.soft.s: float-minimal.c $(HEADER) $(SOFTFLOAT)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-minimal.soft.s float-minimal.c
|
||||
float-minimal.soft.bin: float-minimal.soft.s $(HEADER) $(SOFTFLOAT)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-minimal.soft.bin float-minimal.soft.s $(SOFTFLOAT)
|
||||
|
||||
float-basic.soft.s: float-basic.c $(HEADER) $(SOFTFLOAT)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-basic.soft.s float-basic.c
|
||||
float-basic.soft.bin: float-basic.soft.s $(HEADER) $(SOFTFLOAT)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-basic.soft.bin float-basic.soft.s $(SOFTFLOAT)
|
||||
|
||||
float-conv.soft.s: float-conv.c $(HEADER) $(SOFTFLOAT)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-conv.soft.s float-conv.c
|
||||
float-conv.soft.bin: float-conv.soft.s $(HEADER) $(SOFTFLOAT)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-conv.soft.bin float-conv.soft.s $(SOFTFLOAT)
|
||||
|
||||
float-cmp.soft.s: float-cmp.c $(HEADER) $(SOFTFLOAT)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-cmp.soft.s float-cmp.c
|
||||
float-cmp.soft.bin: float-cmp.soft.s $(HEADER) $(SOFTFLOAT)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-cmp.soft.bin float-cmp.soft.s $(SOFTFLOAT)
|
||||
|
||||
float-misc.soft.s: float-misc.c $(HEADER) $(SOFTFLOAT)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o float-misc.soft.s float-misc.c
|
||||
float-misc.soft.bin: float-misc.soft.s $(HEADER) $(SOFTFLOAT)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o float-misc.soft.bin float-misc.soft.s $(SOFTFLOAT)
|
||||
|
||||
quick.soft.s: quick.c $(HEADER) $(SOFTFLOAT)
|
||||
$(CC65) $(OPT) -t sim6502 -I ./include --add-source -o quick.soft.s quick.c
|
||||
quick.soft.bin: quick.soft.s $(HEADER) $(SOFTFLOAT)
|
||||
$(CL65) $(OPT) -t sim6502 -I ./include -o quick.soft.bin quick.soft.s $(SOFTFLOAT)
|
||||
|
||||
runsoft-minimal: float-minimal.soft.bin
|
||||
$(SIM65) float-minimal.soft.bin
|
||||
runsoft-basic: float-basic.soft.bin
|
||||
$(SIM65) float-basic.soft.bin
|
||||
runsoft-cmp: float-cmp.soft.bin
|
||||
$(SIM65) float-cmp.soft.bin
|
||||
runsoft-conv: float-conv.soft.bin
|
||||
$(SIM65) float-conv.soft.bin
|
||||
runsoft-misc: float-misc.soft.bin
|
||||
$(SIM65) float-misc.soft.bin
|
||||
|
||||
runsoft-quick: quick.soft.bin
|
||||
$(SIM65) quick.soft.bin
|
||||
.PHONY: quick
|
||||
|
||||
runsoft: float-minimal.soft.bin float-basic.soft.bin float-cmp.soft.bin float-conv.soft.bin float-misc.soft.bin
|
||||
$(SIM65) float-minimal.soft.bin
|
||||
# $(SIM65) float-misc.soft.bin
|
||||
# -$(SIM65) float-conv.soft.bin
|
||||
# -$(SIM65) float-cmp.soft.bin
|
||||
# -$(SIM65) float-basic.soft.bin
|
||||
quick: quick.bin
|
||||
$(SIM65) quick.bin
|
||||
|
||||
###############################################################################
|
||||
# CBM kernal floats
|
||||
|
||||
float-minimal.c64.s: float-minimal.c $(HEADER) $(CBMRUNTIME)
|
||||
$(CC65) $(OPT) -DCONIO -t c64 -I ./include -I ./cbmkernal --add-source -o float-minimal.c64.s float-minimal.c
|
||||
float-minimal.prg: float-minimal.c64.s $(HEADER) $(CBMRUNTIME)
|
||||
$(CL65) $(OPT) -t c64 -I ./include -I ./cbmkernal -o float-minimal.prg float-minimal.c64.s $(CBMRUNTIME)
|
||||
|
||||
float-basic.c64.s: float-basic.c $(HEADER) $(CBMRUNTIME)
|
||||
$(CC65) $(OPT) -DCONIO -t c64 -I ./include -I ./cbmkernal --add-source -o float-basic.c64.s float-basic.c
|
||||
float-basic.prg: float-basic.c64.s $(HEADER) $(CBMRUNTIME)
|
||||
$(CL65) $(OPT) -t c64 -I ./include -I ./cbmkernal -o float-basic.prg float-basic.c64.s $(CBMRUNTIME)
|
||||
|
||||
float-conv.c64.s: float-conv.c $(HEADER) $(CBMRUNTIME)
|
||||
$(CC65) $(OPT) -DCONIO -t c64 -I ./include -I ./cbmkernal --add-source -o float-conv.c64.s float-conv.c
|
||||
float-conv.prg: float-conv.c64.s $(HEADER) $(CBMRUNTIME)
|
||||
$(CL65) $(OPT) -t c64 -I ./include -I ./cbmkernal -o float-conv.prg float-conv.c64.s $(CBMRUNTIME)
|
||||
|
||||
float-cmp.c64.s: float-cmp.c $(HEADER) $(CBMRUNTIME)
|
||||
$(CC65) $(OPT) -DCONIO -t c64 -I ./include -I ./cbmkernal --add-source -o float-cmp.c64.s float-cmp.c
|
||||
float-cmp.prg: float-cmp.c64.s $(HEADER) $(CBMRUNTIME)
|
||||
$(CL65) $(OPT) -t c64 -I ./include -I ./cbmkernal -o float-cmp.prg float-cmp.c64.s $(CBMRUNTIME)
|
||||
|
||||
float-misc.c64.s: float-misc.c $(HEADER) $(CBMRUNTIME)
|
||||
$(CC65) $(OPT) -DCONIO -t c64 -I ./include -I ./cbmkernal --add-source -o float-misc.c64.s float-misc.c
|
||||
float-misc.prg: float-misc.c64.s $(HEADER) $(CBMRUNTIME)
|
||||
$(CL65) $(OPT) -t c64 -I ./include -I ./cbmkernal -o float-misc.prg float-misc.c64.s $(CBMRUNTIME)
|
||||
|
||||
quick.c64.s: quick.c $(HEADER) $(CBMRUNTIME)
|
||||
quick.c64.s: quick.c
|
||||
$(CC65) $(OPT) -DCONIO -t c64 -I ./include -I ./cbmkernal --add-source -o quick.c64.s quick.c
|
||||
quick.prg: quick.c64.s $(HEADER) $(CBMRUNTIME)
|
||||
$(CL65) $(OPT) -t c64 -I ./include -I ./cbmkernal -o quick.prg quick.c64.s $(CBMRUNTIME)
|
||||
quick.prg: quick.c64.s
|
||||
$(CL65) $(OPT) -t c64 -I ./include -I ./cbmkernal -o quick.prg quick.c64.s
|
||||
|
||||
runc64-quick: quick.prg
|
||||
x64sc -autostartprgmode 1 quick.prg
|
||||
###############################################################################
|
||||
# test against GCC
|
||||
|
||||
gccminimal: float-minimal.c gccstubs.c
|
||||
gcc -I ./include "-D__fastcall__= " -o float-minimal float-minimal.c gccstubs.c -lm
|
||||
gccbasic: float-basic.c gccstubs.c
|
||||
gcc -I ./include "-D__fastcall__= " -o float-basic float-basic.c gccstubs.c -lm
|
||||
gccconv: float-conv.c gccstubs.c
|
||||
gcc -I ./include "-D__fastcall__= " -o float-conv float-conv.c gccstubs.c -lm
|
||||
gcccmp: float-cmp.c gccstubs.c
|
||||
gcc -I ./include "-D__fastcall__= " -o float-cmp float-cmp.c gccstubs.c -lm
|
||||
gccmisc: float-misc.c gccstubs.c
|
||||
gcc -I ./include "-D__fastcall__= " -o float-misc float-misc.c gccstubs.c -lm
|
||||
COPT=-m32 -mpc32
|
||||
|
||||
gccminimal: $(TDIR)/float-minimal.c gccstubs.c
|
||||
gcc $(COPT) -I ./ "-D__fastcall__= " -o float-minimal $(TDIR)/float-minimal.c gccstubs.c -lm
|
||||
gccbasic: $(TDIR)/float-basic.c gccstubs.c
|
||||
gcc $(COPT) -I ./ "-D__fastcall__= " -o float-basic $(TDIR)/float-basic.c gccstubs.c -lm
|
||||
gccconv: $(TDIR)/float-conv.c gccstubs.c
|
||||
gcc $(COPT) -I ./ "-D__fastcall__= " -o float-conv $(TDIR)/float-conv.c gccstubs.c -lm
|
||||
gcccmp: $(TDIR)/float-cmp.c gccstubs.c
|
||||
gcc $(COPT) -I ./ "-D__fastcall__= " -o float-cmp $(TDIR)/float-cmp.c gccstubs.c -lm
|
||||
gccmisc: $(TDIR)/float-misc.c gccstubs.c
|
||||
gcc $(COPT) -I ./ "-D__fastcall__= " -o float-misc $(TDIR)/float-misc.c gccstubs.c -lm
|
||||
gccquick: quick.c gccstubs.c
|
||||
gcc -I ./include "-D__fastcall__= " -o quick quick.c gccstubs.c -lm
|
||||
gcc $(COPT) -I ./ "-D__fastcall__= " -o quick quick.c gccstubs.c -lm
|
||||
|
||||
rungcc-minimal: gccminimal
|
||||
./float-minimal
|
||||
|
@ -281,8 +62,8 @@ rungcc-misc: gccmisc
|
|||
rungcc-quick: gccquick
|
||||
./quick
|
||||
|
||||
rungcc: gccminimal gccconv gccbasic gcccmp
|
||||
./minimal
|
||||
rungcc: gccminimal gccconv gccbasic gcccmp gccmisc gccquick
|
||||
./float-minimal
|
||||
./float-basic
|
||||
./float-conv
|
||||
./float-cmp
|
||||
|
@ -297,44 +78,8 @@ clean:
|
|||
$(RM) ./float-conv
|
||||
$(RM) ./float-misc
|
||||
$(RM) ./quick
|
||||
$(RM) ./quick.bin
|
||||
$(RM) ./quick.s
|
||||
|
||||
$(RM) $(FILES)
|
||||
|
||||
$(RM) softfloat.s
|
||||
|
||||
$(RM) quick.bin
|
||||
$(RM) quick.c64.prg
|
||||
$(RM) quick.woz.bin
|
||||
$(RM) quick.soft.bin
|
||||
|
||||
$(RM) quick.s
|
||||
$(RM) quick.prg
|
||||
$(RM) quick.c64.s
|
||||
$(RM) quick.woz.s
|
||||
$(RM) quick.soft.s
|
||||
|
||||
$(RM) float-minimal.s
|
||||
$(RM) float-minimal.c64.s
|
||||
$(RM) float-minimal.woz.s
|
||||
$(RM) float-minimal.soft.s
|
||||
|
||||
$(RM) float-basic.s
|
||||
$(RM) float-basic.c64.s
|
||||
$(RM) float-basic.woz.s
|
||||
$(RM) float-basic.soft.s
|
||||
|
||||
$(RM) float-cmp.s
|
||||
$(RM) float-cmp.c64.s
|
||||
$(RM) float-cmp.woz.s
|
||||
$(RM) float-cmp.soft.s
|
||||
|
||||
$(RM) float-conv.s
|
||||
$(RM) float-conv.c64.s
|
||||
$(RM) float-conv.woz.s
|
||||
$(RM) float-conv.soft.s
|
||||
|
||||
$(RM) float-misc.s
|
||||
$(RM) float-misc.c64.s
|
||||
$(RM) float-misc.woz.s
|
||||
$(RM) float-misc.soft.s
|
||||
|
||||
$(MAKE) -C softfloat clean
|
||||
|
|
8
test/float/Readme.md
Normal file
8
test/float/Readme.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
some stuff that may be handy in the early stage of developing the floating
|
||||
point support:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
find the floating point library in libsrc/float/softfloat
|
||||
|
15
test/float/_float.h
Normal file
15
test/float/_float.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
#ifndef FLOAT_H_
|
||||
#define FLOAT_H_
|
||||
|
||||
#include "math.h"
|
||||
|
||||
float _fneg(float f);
|
||||
float _fand(float f1, float f2);
|
||||
char *_ftostr(char *d, float s);
|
||||
char *_ftoa(char *d, float s);
|
||||
float _ctof(char c);
|
||||
float _utof(unsigned int c);
|
||||
float _stof(signed int c);
|
||||
|
||||
#endif
|
|
@ -20,6 +20,7 @@ char *_ftostr(char *d, float s)
|
|||
if (d == NULL) {
|
||||
d = &buffer[0];
|
||||
}
|
||||
// printf("<%f>", (double)s);
|
||||
sprintf(d, "%f", (double)s);
|
||||
return d;
|
||||
}
|
||||
|
|
|
@ -2,10 +2,12 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
//#include <_float.h>
|
||||
/*
|
||||
#include <_float.h>
|
||||
#include <math.h>
|
||||
*/
|
||||
#if 0
|
||||
unsigned char buf[32];
|
||||
|
||||
unsigned char var_uchar;
|
||||
|
@ -67,9 +69,27 @@ char *test(char *buffer, float f) {
|
|||
}
|
||||
return &buffer[0];
|
||||
}
|
||||
|
||||
#endif
|
||||
int test1(void)
|
||||
{
|
||||
float fp2 = 1.5f;
|
||||
if (1.5f == fp2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
// int test2(void)
|
||||
// {
|
||||
// float fp2 = 1.5f;
|
||||
// float fp1 = 1.6f;
|
||||
// if (fp2 >= fp1) {
|
||||
// return 0;
|
||||
// }
|
||||
// return 1;
|
||||
// }
|
||||
int main(void)
|
||||
{
|
||||
#if 0
|
||||
fp2 = 0.001f; printf("fp2 0x%08lx %s\n", *((uint32_t*)&fp2), test(buf, fp2));
|
||||
fp2 = 0.001234f; printf("fp2 0x%08lx %s\n", *((uint32_t*)&fp2), test(buf, fp2));
|
||||
fp2 = 0.01f; printf("fp2 0x%08lx %s\n", *((uint32_t*)&fp2), test(buf, fp2));
|
||||
|
@ -78,6 +98,8 @@ int main(void)
|
|||
fp2 = 1.234f; printf("fp2 0x%08lx %s\n", *((uint32_t*)&fp2), test(buf, fp2));
|
||||
fp2 = 12.34f; printf("fp2 0x%08lx %s\n", *((uint32_t*)&fp2), test(buf, fp2));
|
||||
fp2 = 123.4f; printf("fp2 0x%08lx %s\n", *((uint32_t*)&fp2), test(buf, fp2));
|
||||
|
||||
return 0;
|
||||
#endif
|
||||
printf("test:%d\n", test1());
|
||||
// printf("test:%d\n", test2());
|
||||
// return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user