@@ -337,18 +337,18 @@ for pred in [:isequal, :(==)]
337337 @eval begin
338338 @define_binary_dual_op (
339339 Base.$ (pred),
340- $ (pred)(value (x), value (y)) && $ (pred)(partials (x), partials (y)),
341- $ (pred)(value (x), y) && $ (pred)( partials (x), zero ( partials (x) )),
342- $ (pred)(x, value (y)) && $ (pred)( zero ( partials (y)), partials (y)),
340+ $ (pred)(value (x), value (y)) && $ (pred)(partials (x), partials (y)),
341+ $ (pred)(value (x), y) && iszero ( partials (x)),
342+ $ (pred)(x, value (y)) && iszero ( partials (y)),
343343 )
344344 end
345345end
346346
347347@define_binary_dual_op (
348348 Base.:(!= ),
349- (!= )(value (x), value (y)) || (!= )(partials (x), partials (y)),
350- (!= )(value (x), y) || ( != ) (partials (x), zero ( partials (x) )),
351- (!= )(x, value (y)) || ( != )( zero ( partials (y)), partials (y)),
349+ (!= )(value (x), value (y)) || (!= )(partials (x), partials (y)),
350+ (!= )(value (x), y) || ! iszero (partials (x)),
351+ (!= )(x, value (y)) || ! iszero ( partials (y)),
352352)
353353
354354for pred in [:isless , :< , :> , :(<= ), :(>= )]
@@ -360,24 +360,12 @@ for pred in [:isless, :<, :>, :(<=), :(>=)]
360360 else
361361 $ (pred)(value (x), value (y))
362362 end ,
363- if value (x) == y # only x is Dual
364- $ (pred)(partials (x), zero (partials (x)))
365- else
366- $ (pred)(value (x), value (y))
367- end ,
368- if x == value (y) # only y is Dual
369- $ (pred)(zero (partials (y)), partials (y))
370- else
371- $ (pred)(value (x), value (y))
372- end ,
363+ $ (pred)(value (x), y), # only x is Dual
364+ $ (pred)(x, value (y)), # only y is Dual
373365 )
374366 end
375367end
376368
377- # @define_binary_dual_op(Base.:(==), false, false, false)
378- # @define_binary_dual_op(Base.isequal, false, false, false)
379- # @define_binary_dual_op(Base.:(!=), true, true, true)
380-
381369# #######################
382370# Promotion/Conversion #
383371# #######################
0 commit comments