Mercurial > projects > dstress
changeset 522:7466721ce7d1
opDiv run time versus compile time
David Friedman <d3rdclsmail_a_@_t_earthlink_d_._t_net>
2005-05-03
news:d595il$lqr$2@digitaldaemon.com
author | thomask |
---|---|
date | Wed, 11 May 2005 17:11:23 +0000 |
parents | a8b982e594e7 |
children | a0ba0562feac |
files | run/o/opDiv_09_A.d run/o/opDiv_09_B.d |
diffstat | 2 files changed, 56 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/o/opDiv_09_A.d Wed May 11 17:11:23 2005 +0000 @@ -0,0 +1,28 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ David Friedman <d3rdclsmail_a_@_t_earthlink_d_._t_net> +// @date@ 2005-05-03 +// @uri@ news:d595il$lqr$2@digitaldaemon.com + +module dstress.run.o.opDiv_09_A; + +int main(){ + real a = -1.0L / 0.0L; + + real b = -1.0L; + real c = 0.0L; + real d; + + byte* X = cast(byte*) (cast(void*) &a); + + d = b/c; + byte* Y = cast(byte*) (cast(void*) &d); + + for(int i=0; i<a.sizeof; i++){ + assert(X[i]==Y[i]); + } + + return 0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run/o/opDiv_09_B.d Wed May 11 17:11:23 2005 +0000 @@ -0,0 +1,28 @@ +// $HeadURL$ +// $Date$ +// $Author$ + +// @author@ David Friedman <d3rdclsmail_a_@_t_earthlink_d_._t_net> +// @date@ 2005-05-03 +// @uri@ news:d595il$lqr$2@digitaldaemon.com + +module dstress.run.o.opDiv_09_B; + +int main(){ + ireal a = -1.0Li / 0.0Li; + + ireal b = -1.0Li; + ireal c = 0.0Li; + ireal d; + + byte* X = cast(byte*) (cast(void*) &a); + + d = b/c; + byte* Y = cast(byte*) (cast(void*) &d); + + for(int i=0; i<a.sizeof; i++){ + assert(X[i]==Y[i]); + } + + return 0; +}