@@ -342,18 +342,18 @@ for pred in [:isequal, :(==)]
342342 @eval begin
343343 @define_binary_dual_op (
344344 Base.$ (pred),
345- $ (pred)(value (x), value (y)) && $ (pred)(partials (x), partials (y)),
346- $ (pred)(value (x), y) && $ (pred)( partials (x), zero ( partials (x) )),
347- $ (pred)(x, value (y)) && $ (pred)( zero ( partials (y)), partials (y)),
345+ $ (pred)(value (x), value (y)) && $ (pred)(partials (x), partials (y)),
346+ $ (pred)(value (x), y) && iszero ( partials (x)),
347+ $ (pred)(x, value (y)) && iszero ( partials (y)),
348348 )
349349 end
350350end
351351
352352@define_binary_dual_op (
353353 Base.:(!= ),
354- (!= )(value (x), value (y)) || (!= )(partials (x), partials (y)),
355- (!= )(value (x), y) || ( != ) (partials (x), zero ( partials (x) )),
356- (!= )(x, value (y)) || ( != )( zero ( partials (y)), partials (y)),
354+ (!= )(value (x), value (y)) || (!= )(partials (x), partials (y)),
355+ (!= )(value (x), y) || ! iszero (partials (x)),
356+ (!= )(x, value (y)) || ! iszero ( partials (y)),
357357)
358358
359359for pred in [:isless , :< , :> , :(<= ), :(>= )]
@@ -365,24 +365,12 @@ for pred in [:isless, :<, :>, :(<=), :(>=)]
365365 else
366366 $ (pred)(value (x), value (y))
367367 end ,
368- if value (x) == y # only x is Dual
369- $ (pred)(partials (x), zero (partials (x)))
370- else
371- $ (pred)(value (x), value (y))
372- end ,
373- if x == value (y) # only y is Dual
374- $ (pred)(zero (partials (y)), partials (y))
375- else
376- $ (pred)(value (x), value (y))
377- end ,
368+ $ (pred)(value (x), y), # only x is Dual
369+ $ (pred)(x, value (y)), # only y is Dual
378370 )
379371 end
380372end
381373
382- # @define_binary_dual_op(Base.:(==), false, false, false)
383- # @define_binary_dual_op(Base.isequal, false, false, false)
384- # @define_binary_dual_op(Base.:(!=), true, true, true)
385-
386374# #######################
387375# Promotion/Conversion #
388376# #######################
0 commit comments