@@ -322,18 +322,18 @@ for pred in [:isequal, :(==)]
322322 @eval begin
323323 @define_binary_dual_op (
324324 Base.$ (pred),
325- $ (pred)(value (x), value (y)) && $ (pred)(partials (x), partials (y)),
326- $ (pred)(value (x), y) && $ (pred)( partials (x), zero ( partials (x) )),
327- $ (pred)(x, value (y)) && $ (pred)( zero ( partials (y)), partials (y)),
325+ $ (pred)(value (x), value (y)) && $ (pred)(partials (x), partials (y)),
326+ $ (pred)(value (x), y) && iszero ( partials (x)),
327+ $ (pred)(x, value (y)) && iszero ( partials (y)),
328328 )
329329 end
330330end
331331
332332@define_binary_dual_op (
333333 Base.:(!= ),
334- (!= )(value (x), value (y)) || (!= )(partials (x), partials (y)),
335- (!= )(value (x), y) || ( != ) (partials (x), zero ( partials (x) )),
336- (!= )(x, value (y)) || ( != )( zero ( partials (y)), partials (y)),
334+ (!= )(value (x), value (y)) || (!= )(partials (x), partials (y)),
335+ (!= )(value (x), y) || ! iszero (partials (x)),
336+ (!= )(x, value (y)) || ! iszero ( partials (y)),
337337)
338338
339339for pred in [:isless , :< , :> , :(<= ), :(>= )]
@@ -345,24 +345,12 @@ for pred in [:isless, :<, :>, :(<=), :(>=)]
345345 else
346346 $ (pred)(value (x), value (y))
347347 end ,
348- if value (x) == y # only x is Dual
349- $ (pred)(partials (x), zero (partials (x)))
350- else
351- $ (pred)(value (x), value (y))
352- end ,
353- if x == value (y) # only y is Dual
354- $ (pred)(zero (partials (y)), partials (y))
355- else
356- $ (pred)(value (x), value (y))
357- end ,
348+ $ (pred)(value (x), y), # only x is Dual
349+ $ (pred)(x, value (y)), # only y is Dual
358350 )
359351 end
360352end
361353
362- # @define_binary_dual_op(Base.:(==), false, false, false)
363- # @define_binary_dual_op(Base.isequal, false, false, false)
364- # @define_binary_dual_op(Base.:(!=), true, true, true)
365-
366354# #######################
367355# Promotion/Conversion #
368356# #######################
0 commit comments