Question

domain violation


Badge +3

When using the arithmitic editor i found it tends to often lead to domainviolation when using goniometic calculations:

 

2016-06-02 12:51:34| 67.4| 0.0|WARN |Number of Coordinates: 2 -- Coordinate Dimension: 2

 

2016-06-02 12:51:34| 67.4| 0.0|WARN |(95221.671876227498,464970.131574183)(95220.230171277391,464970.131574183)

 

2016-06-02 12:51:34| 67.4| 0.0|WARN |===========================================================================

 

2016-06-02 12:51:36| 69.7| 2.2|WARN |Hoek_in_graden_en_radialen._2_AttributeCreator_2: Failed to evaluate arithmetic expression '-1.#IND*(180*1.0/3.1415926535897932)'

 

2016-06-02 12:51:36| 69.7| 0.0|WARN |Hoek_in_graden_en_radialen._2_AttributeCreator_2: TCL Error Message:

 

2016-06-02 12:51:36| 69.7| 0.0|WARN | invalid character "#"

 

2016-06-02 12:51:36| 69.7| 0.0|WARN | in expression "-1.#IND*(180*1.0/3.1415926..."

 

2016-06-02 12:51:36| 69.7| 0.0|WARN |Hoek_in_graden_en_radialen._2_AttributeCreator_2: Failed to evaluate expression '-1.#IND*(180*1.0/3.1415926535897932)'

This bit in the above expression uising above vertices

@Evaluate((@Value(E_x)-@Value(S_x))/@sqrt(@pow(@Value(E_x)-@Value(S_x),2)))

has fme output -1.0000000000000027 (the table view shows value -1 b.t.w. so its a bit lying...lol)

wich leads to acos (-1.0000000000000027) wich is out of domain.

Where is should be

-1 (in fact when line is horizontal it is calculating A/SQRT(Pow(A) wich is A/A wich is 1.. child can do it..)

Fme has no pmin, pmax functions.

the expr tcl function to do the math is more accurate.

using tcl expr

[expr (@Value(E_x)-@Value(S_x))/sqrt(pow(@Value(E_x)-@Value(S_x),2))]

yields the correct -1

I always thought fme waas using the same math engine, tcl one, but appearently not?

so


2 replies

Badge +5

OK, the easy part first is that you need to set View > Display Full Precision in the Data Inspector. Then it will show the true value and not round it off to -1

As for the other, I found that if I create:

result1 = (@Value(E_x)-@Value(S_x))

result2 = @sqrt(@pow(@Value(E_x)-@Value(S_x),2))

result3 = result1/result2

Then result3 is -1 (whereas if I put the whole thing in one expression as you do, then I get -0.99999999999999967).

So something is rounding the data. As far as I know, yes FME does use the Tcl math engine. So I will query both points with our developers and see what they say.

Badge +5

If you're still following this thread - can I ask:

- what platform you are on?

- what build and version of FME are you using (32/64-bit?)

- what tcl version did you use? 8.4, or 8.5 and later?

I have a feeling this is a complex scenario. If you notice, my result is different to your result, suggesting it is platform dependent!

Reply