[ 
https://issues.apache.org/jira/browse/LUCENE-7312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15313579#comment-15313579
 ] 

Karl Wright commented on LUCENE-7312:
-------------------------------------

Hmm, looking at what I did for Geo3DDocValuesField, and trying to see whether 
it would suffer from the same issue, it looks like I did something somewhat 
different:

{code}
  private static int encodeX(final double x) {
    if (x > PlanetModel.WGS84.getMaximumXValue()) {
      throw new IllegalArgumentException("x value exceeds WGS84 maximum");
    } else if (x < PlanetModel.WGS84.getMinimumXValue()) {
      throw new IllegalArgumentException("x value less than WGS84 minimum");
    }
    return (int)Math.floor((x - PlanetModel.WGS84.getMinimumXValue()) * xFactor 
+ 0.5);
  }
  
  private static double decodeX(final int x) {
    return x * inverseXFactor + PlanetModel.WGS84.getMinimumXValue();
  }
{code}

... where xFactor and inverseXFactor are related such that inverseXFactor = 
1.0/xFactor.  Basically, by adding the 0.5 right before floor time I made sure 
no such effects could happen?  I think??  This stuff makes my head hurt...


> Geo3dPoint test failure
> -----------------------
>
>                 Key: LUCENE-7312
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7312
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/spatial3d
>    Affects Versions: master (7.0)
>            Reporter: Karl Wright
>            Assignee: Karl Wright
>         Attachments: LUCENE-7312.patch
>
>
> Here's the failure:
> {code}
> ant test  -Dtestcase=TestGeo3DPoint -Dtests.method=testEncodeDecodeRoundsDown 
> -Dtests.seed=7046405B94C1716E -Dtests.multiplier=3 -Dtests.slow=true 
> -Dtests.locale=da-DK -Dtests.timezone=America/Detroit -Dtests.asserts=true 
> -Dtests.file.encoding=UTF-8
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to