annotate tests/mini/intrinsics.d @ 663:6aaa3d3c1183

First part of rename to LDC.
author Christian Kamm <kamm incasoftware de>
date Mon, 06 Oct 2008 22:46:55 +0200
parents cc40db549aea
children 55f6c2e454d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
663
6aaa3d3c1183 First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents: 445
diff changeset
1 import ldc.intrinsics;
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
2
133
44a95ac7368a [svn r137] Many fixes towards tango.io.Console working, but not quite there yet...
lindquist
parents: 1
diff changeset
3 extern(C) int printf(char*,...);
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
4 extern(C) int scanf(char*,...);
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
5
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
6 void main()
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
7 {
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
8 float f;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
9 printf("Enter float: ");
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
10 //scanf("%f", &f);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
11 f = 1.22345;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
12 float sf = llvm_sqrt_f32(f);
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
13 printf("sqrt(%f) = %f\n", f, sf);
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
14
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
15 double d;
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
16 printf("Enter double: ");
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
17 //scanf("%lf", &d);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
18 d = 2.2311167895435245;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
19 double sd = llvm_sqrt_f64(d);
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
20 printf("sqrt(%lf) = %lf\n", d, sd);
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
21
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
22 real r;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
23 printf("Enter real: ");
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
24 //scanf("%lf", &d);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
25 r = 3.2311167891231231234754764576;
445
cc40db549aea Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 443
diff changeset
26 version(X86)
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
27 {
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
28 real sr = llvm_sqrt_f80(r);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
29 printf("sqrt(%llf) = %llf\n", r, sr);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
30 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
31 else
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
32 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
33 real sr = llvm_sqrt_f64(r);
445
cc40db549aea Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 443
diff changeset
34 printf("sqrt(%f) = %lf\n", r, sr);
1
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
35 }
c53b6e3fe49a [svn r5] Initial commit. Most things are very rough.
lindquist
parents:
diff changeset
36 }