Re: Comparing Floating Point numbers

2023-09-25 Thread Mike Beckerle
ve to > convert to IEEE float in this case, you may want to be able to check that > is converts into the float as you expect and then the binary representation > may make sense. > > // Mike > > -----Original Message- > From: Steve Lawrence > Sent: Monday, September 25,

Re: Comparing Floating Point numbers

2023-09-25 Thread Steve Lawrence
ransmission in error, please notify the sender immediately. -Original Message- From: Steve Lawrence Sent: Monday, September 25, 2023 10:01 AM To: dev@daffodil.apache.org Subject: Re: Comparing Floating Point numbers Based on what I've learned today from reading that bug, I thin

RE: Comparing Floating Point numbers

2023-09-25 Thread McGann, Mike
oat in this case, you may want to be able to check that is converts into the float as you expect and then the binary representation may make sense. // Mike -Original Message- From: Steve Lawrence Sent: Monday, September 25, 2023 10:01 To: dev@daffodil.apache.org Subject: Re: Compari

Re: Comparing Floating Point numbers

2023-09-25 Thread Dave Fisher
cation is strictly > prohibited. If you have received this transmission in error, please notify > the sender immediately. > > -Original Message- > From: Steve Lawrence > Sent: Monday, September 25, 2023 10:01 AM > To: dev@daffodil.apache.org > Subject: Re: Compa

RE: Comparing Floating Point numbers

2023-09-25 Thread Sood, Harinder
. -Original Message- From: Steve Lawrence Sent: Monday, September 25, 2023 10:01 AM To: dev@daffodil.apache.org Subject: Re: Comparing Floating Point numbers Based on what I've learned today from reading that bug, I think in Java at least, float -> string -> float will give you back the

Re: Comparing Floating Point numbers

2023-09-25 Thread Steve Lawrence
age- From: Steve Lawrence Sent: Monday, September 25, 2023 08:07 To: dev@daffodil.apache.org Subject: Re: Comparing Floating Point numbers +1 for type aware comparisons. It should be a very small change to this function: https://github.com/apache/daffodil/blob/main/daffodil-lib/src/main/scala/org/apa

Re: Comparing Floating Point numbers

2023-09-25 Thread Mike Beckerle
loating point > math is a deep rabbit hole that can be followed. That is probably overkill > for TDML. > > // Mike > > -Original Message- > From: Steve Lawrence > Sent: Monday, September 25, 2023 08:07 > To: dev@daffodil.apache.org > Subject: Re: Comparing Fl

RE: Comparing Floating Point numbers

2023-09-25 Thread McGann, Mike
l for TDML. // Mike -Original Message- From: Steve Lawrence Sent: Monday, September 25, 2023 08:07 To: dev@daffodil.apache.org Subject: Re: Comparing Floating Point numbers +1 for type aware comparisons. It should be a very small change to this function: https://github.com/apache/daffodil

Re: Comparing Floating Point numbers

2023-09-25 Thread Steve Lawrence
+1 for type aware comparisons. It should be a very small change to this function: https://github.com/apache/daffodil/blob/main/daffodil-lib/src/main/scala/org/apache/daffodil/lib/xml/XMLUtils.scala#L1098 And just need to add xsi:type to a few expected infosets that are sensitive to the issue.

RE: Comparing Floating Point numbers

2023-09-25 Thread McGann, Mike
, September 24, 2023 12:09 To: dev@daffodil.apache.org Subject: Comparing Floating Point numbers So Java 21 produces different floating point values in a few cases. Some of our tests (4) are sensitive to this. The "right way" to compare floating point numbers is like this: If(Math.abs(A - B)

Comparing Floating Point numbers

2023-09-24 Thread Mike Beckerle
So Java 21 produces different floating point values in a few cases. Some of our tests (4) are sensitive to this. The "right way" to compare floating point numbers is like this: If(Math.abs(A - B) < epsilon) The TDML runner has outstanding bug https://issues.apache.org/jira/browse/DAFFODIL-2402 w