@Test
    @FeatureRequirement(featureClass = GraphFeatures.class, feature = GraphFeatures.FEATURE_ORDERABILITY_SEMANTICS)
    public void testCompareNaN() {
        // NaN vs. NaN
        // P.eq
        checkHasNext(false, g.inject(Double.NaN).is(P.eq(Double.NaN)));
        // P.neq
        checkHasNext(true, g.inject(Double.NaN).is(P.neq(Double.NaN)));
        // P.lt
        checkHasNext(false, g.inject(Double.NaN).is(P.lt(Double.NaN)));
        // P.lte
        checkHasNext(false, g.inject(Double.NaN).is(P.lte(Double.NaN)));
        // P.gt
        checkHasNext(false, g.inject(Double.NaN).is(P.gt(Double.NaN)));
        // P.gte
        checkHasNext(false, g.inject(Double.NaN).is(P.gte(Double.NaN)));

        // non-NaN vs. NaN
        // P.eq
        checkHasNext(false, g.inject(1.0d).is(P.eq(Double.NaN)));
        checkHasNext(false, g.inject(Double.NaN).is(P.eq(1.0d)));
        // P.neq
        checkHasNext(true, g.inject(1.0d).is(P.neq(Double.NaN)));
        checkHasNext(true, g.inject(Double.NaN).is(P.neq(1.0d)));
        // P.lt
        checkHasNext(false, g.inject(1.0d).is(P.lt(Double.NaN)));
        checkHasNext(false, g.inject(Double.NaN).is(P.lt(1.0d)));
        // P.lte
        checkHasNext(false, g.inject(1.0d).is(P.lte(Double.NaN)));
        checkHasNext(false, g.inject(Double.NaN).is(P.lte(1.0d)));
        // P.gt
        checkHasNext(false, g.inject(1.0d).is(P.gt(Double.NaN)));
        checkHasNext(false, g.inject(Double.NaN).is(P.gt(1.0d)));
        // P.gte
        checkHasNext(false, g.inject(1.0d).is(P.gte(Double.NaN)));
        checkHasNext(false, g.inject(Double.NaN).is(P.gte(1.0d)));
    }
NaN comparisons always produce UNDEF comparison, reducing to FALSE in ternary->binary reduction.
gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/TernaryBooleanLogicsTest.java