annotate run/float_22.d @ 1630:d0efa3ae5522 default tip

run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author David Nadlinger <code@klickverbot.at>
date Sat, 23 Apr 2011 22:57:32 +0200
parents eaf0a0d20b60
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
376
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
1 // $HeadURL$
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
2 // $Date$
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
3 // $Author$
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
4
564
e77e4444c170 partial metadata fix
thomask
parents: 377
diff changeset
5 // @author@ Derek Parnell <derek@psych.ward>
376
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
6 // @date@ 2005-04-02
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
7 // @uri@ news:5efpfwr0e1l5$.ks45nx0xz2zf$.dlg@40tude.net
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
8
812
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
9 // For floating point operations and expression intermediate values,
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
10 // a greater precision can be used than the type of the expression.
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
11 // Only the minimum precision is set by the types of the operands,
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
12 // not the maximum.
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
13
376
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
14 module dstress.run.float_22;
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
15
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
16 int main(){
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
17 float f = 0.0000195f;
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
18 assert(typeid(typeof(0.0000195f)) == typeid(float));
812
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
19
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
20 real diff = (0.5f + f * 1e6f) - (0.5f + 0.0000195f * 1e6f);
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
21
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
22
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
23 if(diff < 0){
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
24 diff *= -1;
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
25 }
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
26
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
27 if(diff < float.epsilon * 8){
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
28 return 0;
eaf0a0d20b60 Walter <walter@digitalmars.com>
thomask
parents: 564
diff changeset
29 }
376
52a8b1249941 float literals versus variable
thomask
parents:
diff changeset
30 }