summary refs log tree commit diff stats
path: root/tests/accept/run/tfloat3.nim
blob: 72acce95870ea5474fa5a9a4816ef5266c7a3bbb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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()