summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/avremu/test-suite/float.c
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/avremu/test-suite/float.c
Initial commit
Diffstat (limited to 'macros/latex/contrib/avremu/test-suite/float.c')
-rw-r--r--macros/latex/contrib/avremu/test-suite/float.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/macros/latex/contrib/avremu/test-suite/float.c b/macros/latex/contrib/avremu/test-suite/float.c
new file mode 100644
index 0000000000..af6a8edebc
--- /dev/null
+++ b/macros/latex/contrib/avremu/test-suite/float.c
@@ -0,0 +1,41 @@
+#include <avr/io.h>
+#include <stdio.h>
+
+static int uart_putchar(char c, FILE *stream);
+static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL,
+ _FDEV_SETUP_WRITE);
+static int
+uart_putchar(char c, FILE *stream)
+{
+ UDR = c;
+ return 0;
+}
+
+volatile uint16_t xxx = 65;
+
+int
+main(void)
+{
+ stdout = &mystdout;
+
+ volatile float a = 0.23;
+ volatile float b = 0.43;
+
+ printf("%.2f", 1/ (a * b * 3));
+ asm volatile("break;");
+
+ return 0;
+}
+
+
+/**
+ check-name: Calculate with floats
+ compiler-opts: -Wl,-u,vfprintf -lm -lprintf_flt
+
+ check-start:
+
+ \avr@instr@stepn{100000}
+ \avr@test@UDR{3.37}
+
+ check-end:
+**/