mirror of
https://github.com/cc65/cc65.git
synced 2024-09-27 19:55:09 +00:00
add floattest sample, which contains the stuff that can work without math.h
This commit is contained in:
parent
2da00e7daa
commit
a396f5b1c8
@ -164,6 +164,7 @@ EXELIST_apple2 = \
|
||||
checkversion \
|
||||
diodemo \
|
||||
enumdevdir \
|
||||
floattest \
|
||||
gunzip65 \
|
||||
hello \
|
||||
mandelbrot \
|
||||
@ -181,6 +182,7 @@ EXELIST_apple2enh = $(EXELIST_apple2)
|
||||
EXELIST_atari = \
|
||||
ascii \
|
||||
checkversion \
|
||||
floattest \
|
||||
gunzip65 \
|
||||
hello \
|
||||
mandelbrot \
|
||||
@ -204,6 +206,7 @@ EXELIST_atari5200 = \
|
||||
EXELIST_atmos = \
|
||||
ascii \
|
||||
checkversion \
|
||||
floattest \
|
||||
hello \
|
||||
mandelbrot \
|
||||
mandelfloat \
|
||||
@ -218,6 +221,7 @@ EXELIST_c64 = \
|
||||
ascii \
|
||||
checkversion \
|
||||
enumdevdir \
|
||||
floattest \
|
||||
gunzip65 \
|
||||
hello \
|
||||
mandelbrot \
|
||||
@ -236,6 +240,7 @@ EXELIST_c128 = \
|
||||
ascii \
|
||||
checkversion \
|
||||
enumdevdir \
|
||||
floattest \
|
||||
gunzip65 \
|
||||
hello \
|
||||
mandelbrot \
|
||||
@ -256,6 +261,7 @@ EXELIST_c16 = \
|
||||
EXELIST_cbm510 = \
|
||||
ascii \
|
||||
checkversion \
|
||||
floattest \
|
||||
gunzip65 \
|
||||
hello \
|
||||
mandelfloat \
|
||||
@ -267,6 +273,7 @@ EXELIST_cbm510 = \
|
||||
EXELIST_cbm610 = \
|
||||
ascii \
|
||||
checkversion \
|
||||
floattest \
|
||||
gunzip65 \
|
||||
hello \
|
||||
mandelfloat \
|
||||
@ -282,6 +289,7 @@ EXELIST_cx16 = \
|
||||
ascii \
|
||||
checkversion \
|
||||
enumdevdir \
|
||||
floattest \
|
||||
gunzip65 \
|
||||
hello \
|
||||
mandelbrot \
|
||||
@ -321,6 +329,7 @@ EXELIST_pet = \
|
||||
ascii \
|
||||
checkversion \
|
||||
enumdevdir \
|
||||
floattest \
|
||||
hello \
|
||||
mandelfloat \
|
||||
tinyshell \
|
||||
@ -330,6 +339,7 @@ EXELIST_plus4 = \
|
||||
ascii \
|
||||
checkversion \
|
||||
enumdevdir \
|
||||
floattest \
|
||||
gunzip65 \
|
||||
hello \
|
||||
mandelfloat \
|
||||
@ -355,6 +365,7 @@ EXELIST_kim1 = \
|
||||
EXELIST_telestrat = \
|
||||
ascii \
|
||||
checkversion \
|
||||
floattest \
|
||||
gunzip65 \
|
||||
hello \
|
||||
mandelbrot \
|
||||
@ -366,6 +377,7 @@ EXELIST_vic20 = \
|
||||
ascii \
|
||||
checkversion \
|
||||
enumdevdir \
|
||||
floattest \
|
||||
hello \
|
||||
mandelbrot \
|
||||
mandelfloat \
|
||||
@ -463,6 +475,9 @@ OVERLAYLIST := $(foreach I,1 2 3,multdemo.$I ovrldemo.$I)
|
||||
|
||||
# link float examples against the (much faster) kernal lib, if available
|
||||
ifeq ($(SYS),c64)
|
||||
floattest: override CFLAGS += -D DYN_DRV=0
|
||||
floattest: floattest.o
|
||||
$(LD) $(LDFLAGS) -o $@ -C c64.cfg -m $@.map $^ c64-fp754kernal.o $(SYS).lib
|
||||
mandelfloat.o: override CFLAGS += -D DYN_DRV=0
|
||||
mandelfloat: mandelfloat.o
|
||||
$(LD) $(LDFLAGS) -o $@ -C c64.cfg -m $@.map $^ c64-fp754kernal.o $(SYS).lib
|
||||
|
39
samples/floattest.c
Normal file
39
samples/floattest.c
Normal file
@ -0,0 +1,39 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
//#include <conio.h> // for cgetc
|
||||
|
||||
char buf[100];
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
// quick check to see if printing float value works
|
||||
void constants(void)
|
||||
{
|
||||
printf("-100.0 %15s\n", _ftostr(buf, -100.0f));
|
||||
printf(" -10.0 %15s\n", _ftostr(buf, -10.0f));
|
||||
printf(" -1.0 %15s\n", _ftostr(buf, -1.0f));
|
||||
printf(" -0.1 %15s\n", _ftostr(buf, -0.1f));
|
||||
printf(" -0.01 %15s\n", _ftostr(buf, -0.01f));
|
||||
printf(" -0.001 %15s\n", _ftostr(buf, -0.001f));
|
||||
printf(" -0.0001 %15s\n", _ftostr(buf, -0.0001f));
|
||||
printf(" -0.00001 %15s\n", _ftostr(buf, -0.00001f));
|
||||
printf(" 0.0 %15s\n", _ftostr(buf, 0.0f));
|
||||
printf(" 0.1 %15s\n", _ftostr(buf, 0.1f));
|
||||
printf(" 0.01 %15s\n", _ftostr(buf, 0.01f));
|
||||
printf(" 0.001 %15s\n", _ftostr(buf, 0.001f));
|
||||
printf(" 0.0001 %15s\n", _ftostr(buf, 0.0001f));
|
||||
printf(" 0.00001 %15s\n", _ftostr(buf, 0.00001f));
|
||||
printf(" 1.0 %15s\n", _ftostr(buf, 1.0f));
|
||||
printf(" 10.0 %15s\n", _ftostr(buf, 10.0f));
|
||||
printf(" 100.0 %15s\n", _ftostr(buf, 100.0f));
|
||||
printf("<key>\n");
|
||||
// cgetc();
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
constants();
|
||||
return 0;
|
||||
}
|
@ -5,26 +5,6 @@
|
||||
|
||||
char buf[100];
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
// quick check to see if printing float value works
|
||||
void constants(void)
|
||||
{
|
||||
printf("-100.0 %15s\n", _ftostr(buf, -100.0f));
|
||||
printf(" -10.0 %15s\n", _ftostr(buf, -10.0f));
|
||||
printf(" -1.0 %15s\n", _ftostr(buf, -1.0f));
|
||||
printf(" -0.1 %15s\n", _ftostr(buf, -0.1f));
|
||||
printf(" -0.01 %15s\n", _ftostr(buf, -0.01f));
|
||||
printf(" 0.0 %15s\n", _ftostr(buf, 0.0f));
|
||||
printf(" 0.01 %15s\n", _ftostr(buf, 0.01f));
|
||||
printf(" 0.1 %15s\n", _ftostr(buf, 0.1f));
|
||||
printf(" 1.0 %15s\n", _ftostr(buf, 1.0f));
|
||||
printf(" 10.0 %15s\n", _ftostr(buf, 10.0f));
|
||||
printf(" 100.0 %15s\n", _ftostr(buf, 100.0f));
|
||||
printf("<key>\n"); cgetc();
|
||||
}
|
||||
|
||||
/*
|
||||
float __fastcall__ sinf(float s);
|
||||
float __fastcall__ cosf(float s);
|
||||
@ -220,7 +200,6 @@ void logexp(void)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
constants();
|
||||
roundtruncabs();
|
||||
sincostanatan();
|
||||
powersqrt();
|
||||
|
Loading…
Reference in New Issue
Block a user