view test/intrinsics.d @ 212:4c2689d57ba4 trunk

[svn r228] Fixed: when new'ing basic types, the storage was not default initialized. Fixed: the tango/lib/compiler/llvmdc/llvmdc.mak makefile was a bit incorrect. Changed: the basic gc is now the default. Changed: renamed a few temporary names in the LLVM IR output.
author lindquist
date Tue, 27 May 2008 22:14:24 +0200
parents 44a95ac7368a
children
line wrap: on
line source

import llvm.intrinsic;

extern(C) int printf(char*,...);
extern(C) int scanf(char*,...);

void main()
{
    {
    float f;
    printf("Enter float: ");
    scanf("%f", &f);
    float sf = llvm_sqrt(f);
    printf("sqrt(%f) = %f\n", f, sf);
    }
    
    {
    double d;
    printf("Enter double: ");
    scanf("%lf", &d);
    double sd = llvm_sqrt(d);
    printf("sqrt(%lf) = %lf\n", d, sd);
    }
    
    {
    real d;
    printf("Enter real: ");
    scanf("%lf", &d);
    real sd = llvm_sqrt(d);
    printf("sqrt(%lf) = %lf\n", d, sd);
    }
}