summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/accept/run/spec.csv1
-rw-r--r--tests/accept/run/tfloat3.nim18
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/accept/run/spec.csv b/tests/accept/run/spec.csv
index 4bb94ed74..075e4e67e 100755
--- a/tests/accept/run/spec.csv
+++ b/tests/accept/run/spec.csv
@@ -27,6 +27,7 @@ tfinally2.nim;ABCD
 tfinally3.nim;false
 tfloat1.nim;Error: unhandled exception: FPU operation caused an overflow [EFloatOverflow]
 tfloat2.nim;Error: unhandled exception: FPU operation caused a NaN result [EFloatInvalidOp]
+tfloat3.nim;Nimrod    3.4368930843, 0.3299290698 C double: 3.4368930843, 0.3299290698
 tformat.nim;Hi Andreas! How do you feel, Rumpf?
 thintoff.nim;0
 tinit.nim;Hello from module! Hello from main module!
diff --git a/tests/accept/run/tfloat3.nim b/tests/accept/run/tfloat3.nim
new file mode 100644
index 000000000..72acce958
--- /dev/null
+++ b/tests/accept/run/tfloat3.nim
@@ -0,0 +1,18 @@
+
+import math, strutils
+
+{.emit: """
+void printFloats(void) {
+    double y = 1.234567890123456789;
+    
+    printf("C double: %.10f, %.10f ", exp(y), cos(y));
+}
+""".}
+
+proc c_printf(frmt: CString) {.importc: "printf", header: "<stdio.h>", varargs.}
+proc printFloats {.importc, nodecl.}
+
+var x: float = 1.234567890123456789
+c_printf("Nimrod    %.10f, %.10f ", exp(x), cos(x))
+printFloats()
+