376
|
1 // $HeadURL$
|
|
2 // $Date$
|
|
3 // $Author$
|
|
4
|
564
|
5 // @author@ Derek Parnell <derek@psych.ward>
|
376
|
6 // @date@ 2005-04-02
|
|
7 // @uri@ news:5efpfwr0e1l5$.ks45nx0xz2zf$.dlg@40tude.net
|
|
8
|
812
|
9 // For floating point operations and expression intermediate values,
|
|
10 // a greater precision can be used than the type of the expression.
|
|
11 // Only the minimum precision is set by the types of the operands,
|
|
12 // not the maximum.
|
|
13
|
376
|
14 module dstress.run.float_22;
|
|
15
|
|
16 int main(){
|
|
17 float f = 0.0000195f;
|
|
18 assert(typeid(typeof(0.0000195f)) == typeid(float));
|
812
|
19
|
|
20 real diff = (0.5f + f * 1e6f) - (0.5f + 0.0000195f * 1e6f);
|
|
21
|
|
22
|
|
23 if(diff < 0){
|
|
24 diff *= -1;
|
|
25 }
|
|
26
|
|
27 if(diff < float.epsilon * 8){
|
|
28 return 0;
|
|
29 }
|
376
|
30 }
|