Linepicks - do they give same result on all PCs

Blitz3D Forums/Blitz3D Programming/Linepicks - do they give same result on all PCs

Simple question:

If I have the same mesh being used on two separate PCs, and perform a linepick against it using the same parameters on both PCs will it return the same values for Pickedy(),pickedx(),pickedz()?

Or to put it another way - do floating point calculations give the same result on different processors?

They should (plus or minus the infamous "pentium bug" ;) )

Put up some test code using large numbers (to allow for more probability of floating point rounding issues).

Then have varius people test it. I think that most computers will return the same result but it shouldn't be relied upon.

with floating point you don't test for equality, you test with an epsilon value, so instead of saying is a=b (where a and b are floats) you'd do (a-b)<0.5 where the 0.5 is a value your games engine works with. That way you'll avoid accuracy problems.

Could people run the code below for me and send me the file as an attachment in an email to gezeder@...

Thanks

myfile=writefile("test.txt")
a#=5.0
b#=2.0
c#=3.0
for i=1 to 100
writefloat myfile,float(i)*sqr(a#*a#/float(i)+b#*b#+c#*c#*float(i))
writefloat myfile,float(i)*sin(float(i))
next
closefile myfile


I'll just give yah the numbers
6.16441
0.0174524
11.7473
0.069799
18.8149
0.157008
27.2029
0.279026
36.7423
0.435779
47.3075
0.627171
58.8048
0.853085
71.1618
1.11338
84.3208
1.40791
98.2344
1.73648
112.863
2.0989
128.172
2.49494
144.132
2.92436
160.717
3.38691
177.904
3.88229
195.673
4.4102
214.005
4.97032
232.882
5.56231
252.29
6.18579
272.213
6.8404
292.64
7.52573
313.557
8.24135
334.954
8.98682
356.819
9.76168
379.144
10.5655
401.918
11.3976
425.133
12.2577
448.781
13.1452
472.853
14.0595
497.343
15.0
522.243
15.9662
547.547
16.9574
573.249
17.9731
599.341
19.0126
625.819
20.0752
652.678
21.1603
679.91
22.2672
707.513
23.3951
735.479
24.5435
763.806
25.7115
792.488
26.8984
821.522
28.1035
850.902
29.3259
880.625
30.565
910.687
31.8198
941.083
33.0896
971.812
34.3736
1002.87
35.671
1034.25
36.9808
1065.95
38.3022
1097.97
39.6344
1130.3
40.9766
1162.95
42.3277
1195.91
43.6869
1229.17
45.0534
1262.73
46.4261
1296.59
47.8042
1330.76
49.1868
1365.21
50.5729
1399.96
51.9615
1435.0
53.3518
1470.33
54.7427
1505.95
56.1334
1541.84
57.5228
1578.02
58.91
1614.48
60.294
1651.21
61.6738
1688.22
63.0485
1725.5
64.417
1763.05
65.7785
1800.87
67.1318
1838.96
68.4761
1877.31
69.8102
1915.93
71.1334
1954.8
72.4444
1993.94
73.7425
2033.33
75.0265
2072.98
76.2955
2112.89
77.5485
2153.04
78.7846
2193.45
80.0028
2234.11
81.202
2275.02
82.3813
2316.17
83.5398
2357.57
84.6766
2399.22
85.7905
2441.1
86.8808
2483.23
87.9464
2525.59
88.9864
2568.2
90.0
2611.04
90.9861
2654.12
91.944
2697.43
92.8725
2740.98
93.771
2784.75
94.6385
2828.76
95.4741
2873.0
96.277
2917.46
97.0463
2962.16
97.7811
3007.07
98.4808


Oh, and if others just want to pust them:
a#=5.0
b#=2.0
c#=3.0
For i=1 To 100
 DebugLog Float(i)*Sqr(a#*a#/Float(i)+b#*b#+c#*c#*Float(i))
 DebugLog Float(i)*Sin(Float(i))
Next
Stop ;so you can copy/paste


6.16441
0.0174524
11.7473
0.069799
18.8149
0.157008
27.2029
0.279026
36.7423
0.435779
47.3075
0.627171
58.8048
0.853085
71.1618
1.11338
84.3208
1.40791
98.2344
1.73648
112.863
2.0989
128.172
2.49494
144.132
2.92436
160.717
3.38691
177.904
3.88229
195.673
4.4102
214.005
4.97032
232.882
5.56231
252.29
6.18579
272.213
6.8404
292.64
7.52573
313.557
8.24135
334.954
8.98682
356.819
9.76168
379.144
10.5655
401.918
11.3976
425.133
12.2577
448.781
13.1452
472.853
14.0595
497.343
15.0
522.243
15.9662
547.547
16.9574
573.249
17.9731
599.341
19.0126
625.819
20.0752
652.678
21.1603
679.91
22.2672
707.513
23.3951
735.479
24.5435
763.806
25.7115
792.488
26.8984
821.522
28.1035
850.902
29.3259
880.625
30.565
910.687
31.8198
941.083
33.0896
971.812
34.3736
1002.87
35.671
1034.25
36.9808
1065.95
38.3022
1097.97
39.6344
1130.3
40.9766
1162.95
42.3277
1195.91
43.6869
1229.17
45.0534
1262.73
46.4261
1296.59
47.8042
1330.76
49.1868
1365.21
50.5729
1399.96
51.9615
1435.0
53.3518
1470.33
54.7427
1505.95
56.1334
1541.84
57.5228
1578.02
58.91
1614.48
60.294
1651.21
61.6738
1688.22
63.0485
1725.5
64.417
1763.05
65.7785
1800.87
67.1318
1838.96
68.4761
1877.31
69.8102
1915.93
71.1334
1954.8
72.4444
1993.94
73.7425
2033.33
75.0265
2072.98
76.2955
2112.89
77.5485
2153.04
78.7846
2193.45
80.0028
2234.11
81.202
2275.02
82.3813
2316.17
83.5398
2357.57
84.6766
2399.22
85.7905
2441.1
86.8808
2483.23
87.9464
2525.59
88.9864
2568.2
90.0
2611.04
90.9861
2654.12
91.944
2697.43
92.8725
2740.98
93.771
2784.75
94.6385
2828.76
95.4741
2873.0
96.277
2917.46
97.0463
2962.16
97.7811
3007.07
98.4808


My results.

6.16441
0.0174524
11.7473
0.069799
18.8149
0.157008
27.2029
0.279026
36.7423
0.435779
47.3075
0.627171
58.8048
0.853085
71.1618
1.11338
84.3208
1.40791
98.2344
1.73648
112.863
2.0989
128.172
2.49494
144.132
2.92436
160.717
3.38691
177.904
3.88229
195.673
4.4102
214.005
4.97032
232.882
5.56231
252.29
6.18579
272.213
6.8404
292.64
7.52573
313.557
8.24135
334.954
8.98682
356.819
9.76168
379.144
10.5655
401.918
11.3976
425.133
12.2577
448.781
13.1452
472.853
14.0595
497.343
15.0
522.243
15.9662
547.547
16.9574
573.249
17.9731
599.341
19.0126
625.819
20.0752
652.678
21.1603
679.91
22.2672
707.513
23.3951
735.479
24.5435
763.806
25.7115
792.488
26.8984
821.522
28.1035
850.902
29.3259
880.625
30.565
910.687
31.8198
941.083
33.0896
971.812
34.3736
1002.87
35.671
1034.25
36.9808
1065.95
38.3022
1097.97
39.6344
1130.3
40.9766
1162.95
42.3277
1195.91
43.6869
1229.17
45.0534
1262.73
46.4261
1296.59
47.8042
1330.76
49.1868
1365.21
50.5729
1399.96
51.9615
1435.0
53.3518
1470.33
54.7427
1505.95
56.1334
1541.84
57.5228
1578.02
58.91
1614.48
60.294
1651.21
61.6738
1688.22
63.0485
1725.5
64.417
1763.05
65.7785
1800.87
67.1318
1838.96
68.4761
1877.31
69.8102
1915.93
71.1334
1954.8
72.4444
1993.94
73.7425
2033.33
75.0265
2072.98
76.2955
2112.89
77.5485
2153.04
78.7846
2193.45
80.0028
2234.11
81.202
2275.02
82.3813
2316.17
83.5398
2357.57
84.6766
2399.22
85.7905
2441.1
86.8808
2483.23
87.9464
2525.59
88.9864
2568.2
90.0
2611.04
90.9861
2654.12
91.944
2697.43
92.8725
2740.98
93.771
2784.75
94.6385
2828.76
95.4741
2873.0
96.277
2917.46
97.0463
2962.16
97.7811
3007.07
98.4808


How do I put this in one of those snazzy table thingy mi jigs???

EDIT : Cheers :o)

6.16441
0.0174524
11.7473
0.069799
18.8149
0.157008
27.2029
0.279026
36.7423
0.435779
47.3075
0.627171
58.8048
0.853085
71.1618
1.11338
84.3208
1.40791
98.2344
1.73648
112.863
2.0989
128.172
2.49494
144.132
2.92436
160.717
3.38691
177.904
3.88229
195.673
4.4102
214.005
4.97032
232.882
5.56231
252.29
6.18579
272.213
6.8404
292.64
7.52573
313.557
8.24135
334.954
8.98682
356.819
9.76168
379.144
10.5655
401.918
11.3976
425.133
12.2577
448.781
13.1452
472.853
14.0595
497.343
15.0
522.243
15.9662
547.547
16.9574
573.249
17.9731
599.341
19.0126
625.819
20.0752
652.678
21.1603
679.91
22.2672
707.513
23.3951
735.479
24.5435
763.806
25.7115
792.488
26.8984
821.522
28.1035
850.902
29.3259
880.625
30.565
910.687
31.8198
941.083
33.0896
971.812
34.3736
1002.87
35.671
1034.25
36.9808
1065.95
38.3022
1097.97
39.6344
1130.3
40.9766
1162.95
42.3277
1195.91
43.6869
1229.17
45.0534
1262.73
46.4261
1296.59
47.8042
1330.76
49.1868
1365.21
50.5729
1399.96
51.9615
1435.0
53.3518
1470.33
54.7427
1505.95
56.1334
1541.84
57.5228
1578.02
58.91
1614.48
60.294
1651.21
61.6738
1688.22
63.0485
1725.5
64.417
1763.05
65.7785
1800.87
67.1318
1838.96
68.4761
1877.31
69.8102
1915.93
71.1334
1954.8
72.4444
1993.94
73.7425
2033.33
75.0265
2072.98
76.2955
2112.89
77.5485
2153.04
78.7846
2193.45
80.0028
2234.11
81.202
2275.02
82.3813
2316.17
83.5398
2357.57
84.6766
2399.22
85.7905
2441.1
86.8808
2483.23
87.9464
2525.59
88.9864
2568.2
90.0
2611.04
90.9861
2654.12
91.944
2697.43
92.8725
2740.98
93.771
2784.75
94.6385
2828.76
95.4741
2873.0
96.277
2917.46
97.0463
2962.16
97.7811
3007.07
98.4808


3Ghz Pentium

6.16441
0.0174524
11.7473
0.069799
18.8149
0.157008
27.2029
0.279026
36.7423
0.435779
47.3075
0.627171
58.8048
0.853085
71.1618
1.11338
84.3208
1.40791
98.2344
1.73648
112.863
2.0989
128.172
2.49494
144.132
2.92436
160.717
3.38691
177.904
3.88229
195.673
4.4102
214.005
4.97032
232.882
5.56231
252.29
6.18579
272.213
6.8404
292.64
7.52573
313.557
8.24135
334.954
8.98682
356.819
9.76168
379.144
10.5655
401.918
11.3976
425.133
12.2577
448.781
13.1452
472.853
14.0595
497.343
15.0
522.243
15.9662
547.547
16.9574
573.249
17.9731
599.341
19.0126
625.819
20.0752
652.678
21.1603
679.91
22.2672
707.513
23.3951
735.479
24.5435
763.806
25.7115
792.488
26.8984
821.522
28.1035
850.902
29.3259
880.625
30.565
910.687
31.8198
941.083
33.0896
971.812
34.3736
1002.87
35.671
1034.25
36.9808
1065.95
38.3022
1097.97
39.6344
1130.3
40.9766
1162.95
42.3277
1195.91
43.6869
1229.17
45.0534
1262.73
46.4261
1296.59
47.8042
1330.76
49.1868
1365.21
50.5729
1399.96
51.9615
1435.0
53.3518
1470.33
54.7427
1505.95
56.1334
1541.84
57.5228
1578.02
58.91
1614.48
60.294
1651.21
61.6738
1688.22
63.0485
1725.5
64.417
1763.05
65.7785
1800.87
67.1318
1838.96
68.4761
1877.31
69.8102
1915.93
71.1334
1954.8
72.4444
1993.94
73.7425
2033.33
75.0265
2072.98
76.2955
2112.89
77.5485
2153.04
78.7846
2193.45
80.0028
2234.11
81.202
2275.02
82.3813
2316.17
83.5398
2357.57
84.6766
2399.22
85.7905
2441.1
86.8808
2483.23
87.9464
2525.59
88.9864
2568.2
90.0
2611.04
90.9861
2654.12
91.944
2697.43
92.8725
2740.98
93.771
2784.75
94.6385
2828.76
95.4741
2873.0
96.277
2917.46
97.0463
2962.16
97.7811
3007.07
98.4808


Hmmm.......the results seem to be pretty well the same (cant be arsed to do a full for-number check between sources...or let alone code one up, but they look pretty-well the same to me anyway.

Oh, btw, on an AMD Athlon XP1800+ processor here.

(psst, Rhyolite, look over here)

For future compatibility, I wouldn't rely on this if I were you.

I would prefer to receive the numbers not in string format. I have found that Blitz does not return the same values on various pcs when they are converted to strings. So if I could just have the test.txt file and then do a file comparison on the bytes present in the file that would be appreciated.

6.16441
0.0174524
11.7473
0.069799
18.8149
0.157008
27.2029
0.279026
36.7423
0.435779
47.3075
0.627171
58.8048
0.853085
71.1618
1.11338
84.3208
1.40791
98.2344
1.73648
112.863
2.0989
128.172
2.49494
144.132
2.92436
160.717
3.38691
177.904
3.88229
195.673
4.4102
214.005
4.97032
232.882
5.56231
252.29
6.18579
272.213
6.8404
292.64
7.52573
313.557
8.24135
334.954
8.98682
356.819
9.76168
379.144
10.5655
401.918
11.3976
425.133
12.2577
448.781
13.1452
472.853
14.0595
497.343
15.0
522.243
15.9662
547.547
16.9574
573.249
17.9731
599.341
19.0126
625.819
20.0752
652.678
21.1603
679.91
22.2672
707.513
23.3951
735.479
24.5435
763.806
25.7115
792.488
26.8984
821.522
28.1035
850.902
29.3259
880.625
30.565
910.687
31.8198
941.083
33.0896
971.812
34.3736
1002.87
35.671
1034.25
36.9808
1065.95
38.3022
1097.97
39.6344
1130.3
40.9766
1162.95
42.3277
1195.91
43.6869
1229.17
45.0534
1262.73
46.4261
1296.59
47.8042
1330.76
49.1868
1365.21
50.5729
1399.96
51.9615
1435.0
53.3518
1470.33
54.7427
1505.95
56.1334
1541.84
57.5228
1578.02
58.91
1614.48
60.294
1651.21
61.6738
1688.22
63.0485
1725.5
64.417
1763.05
65.7785
1800.87
67.1318
1838.96
68.4761
1877.31
69.8102
1915.93
71.1334
1954.8
72.4444
1993.94
73.7425
2033.33
75.0265
2072.98
76.2955
2112.89
77.5485
2153.04
78.7846
2193.45
80.0028
2234.11
81.202
2275.02
82.3813
2316.17
83.5398
2357.57
84.6766
2399.22
85.7905
2441.1
86.8808
2483.23
87.9464
2525.59
88.9864
2568.2
90.0
2611.04
90.9861
2654.12
91.944
2697.43
92.8725
2740.98
93.771
2784.75
94.6385
2828.76
95.4741
2873.0
96.277
2917.46
97.0463
2962.16
97.7811
3007.07
98.4808