I am experiencing a hell of a problem!
Note the following code:
Const
MetricFactor = 1259.84252; {DataCad to imperial to metric}
VAR
WorkStr : str255;
debugRl : real;
A point is initialized with these settings:
RelPnt.x := 433000.0;
RelPnt.y := 7712000.0;
RelPnt.z := 0.0;
Surveyvec is an array of records that includes a point in the location field.
And runs through this code: (note line numbers at end of each line for reference)
Reportstr (‘ X = ‘); !1
Reportstr (‘String: ‘); !2
Reportstr (workstr); !3
IF cvstrll (workstr, surveyvec [1].location.x) THEN !4
Reportstr (‘, Converted Loc.x: ‘); !5
reportdis (surveyvec [1].location.x*metricfactor); !6
surveyvec [1].location.x := (surveyvec [1].location.x – RelPnt.x)* metricfactor; !7
END; !8
Reportstr (‘, RelPnt.x: ‘); !9
Reportdis (relpnt.x*metricfactor); !10
Reportstr (‘, Adjusted Loc.x: ‘); !11
reportdis (surveyvec [1].location.x); !12
Reportstr (‘ metricfactor= ‘); !13
Debugrl := metricfactor; !14
Reportdis (debugRl); !15
Reportstr (‘ 32,800 meter = ‘); !16
Debugrl := 32800.0; !17
DebugRl := debugRl * metricfactor; !18
Reportdis(debugRl); !19
Reportshow; !20
The procedures reportstr, reportdis etc. are similar to utilities in the wrtutl module, except they write to a file instead of the screen. They do not affect the math error I found.
Yields the following in the report file:
X = String: 433847.493,
Converted Loc.x: 433847.487 m,
RelPnt.x: 25751.999 m,
Adjusted Loc.x: 459599.48 m
metricfactor= 1.00 m
32,800 meter = 32735.999 m
The workstr variable reads from a file. Notice that the conversion is handled correctly. RelPnt.x is not handled correctly given an incorrect answer. Also notice that it is adding to the Loc.x variable instead of deducting as is established in the formula. I then tested metricfactor which is correctly reported as one meter. Any multiplication to the metric factor up to 32760 (the limit of an integer) is handled correctly. Once the multiplier surpasses 32760 it begins to deduct instead of add to the value. Note that the variable debugRl handles multiplication in line 18 the same way location does in line 12, but one has the error, and the other does not.
Comments?
Note the following code:
Const
MetricFactor = 1259.84252; {DataCad to imperial to metric}
VAR
WorkStr : str255;
debugRl : real;
A point is initialized with these settings:
RelPnt.x := 433000.0;
RelPnt.y := 7712000.0;
RelPnt.z := 0.0;
Surveyvec is an array of records that includes a point in the location field.
And runs through this code: (note line numbers at end of each line for reference)
Reportstr (‘ X = ‘); !1
Reportstr (‘String: ‘); !2
Reportstr (workstr); !3
IF cvstrll (workstr, surveyvec [1].location.x) THEN !4
Reportstr (‘, Converted Loc.x: ‘); !5
reportdis (surveyvec [1].location.x*metricfactor); !6
surveyvec [1].location.x := (surveyvec [1].location.x – RelPnt.x)* metricfactor; !7
END; !8
Reportstr (‘, RelPnt.x: ‘); !9
Reportdis (relpnt.x*metricfactor); !10
Reportstr (‘, Adjusted Loc.x: ‘); !11
reportdis (surveyvec [1].location.x); !12
Reportstr (‘ metricfactor= ‘); !13
Debugrl := metricfactor; !14
Reportdis (debugRl); !15
Reportstr (‘ 32,800 meter = ‘); !16
Debugrl := 32800.0; !17
DebugRl := debugRl * metricfactor; !18
Reportdis(debugRl); !19
Reportshow; !20
The procedures reportstr, reportdis etc. are similar to utilities in the wrtutl module, except they write to a file instead of the screen. They do not affect the math error I found.
Yields the following in the report file:
X = String: 433847.493,
Converted Loc.x: 433847.487 m,
RelPnt.x: 25751.999 m,
Adjusted Loc.x: 459599.48 m
metricfactor= 1.00 m
32,800 meter = 32735.999 m
The workstr variable reads from a file. Notice that the conversion is handled correctly. RelPnt.x is not handled correctly given an incorrect answer. Also notice that it is adding to the Loc.x variable instead of deducting as is established in the formula. I then tested metricfactor which is correctly reported as one meter. Any multiplication to the metric factor up to 32760 (the limit of an integer) is handled correctly. Once the multiplier surpasses 32760 it begins to deduct instead of add to the value. Note that the variable debugRl handles multiplication in line 18 the same way location does in line 12, but one has the error, and the other does not.
Comments?
Joe
User since V2.4
User since V2.4