@@ -390,18 +390,18 @@ for pred in [:isequal, :(==)]
390390 @eval begin
391391 @define_binary_dual_op (
392392 Base.$ (pred),
393- $ (pred)(value (x), value (y)) && $ (pred)(partials (x), partials (y)),
394- $ (pred)(value (x), y) && $ (pred)( partials (x), zero ( partials (x) )),
395- $ (pred)(x, value (y)) && $ (pred)( zero ( partials (y)), partials (y)),
393+ $ (pred)(value (x), value (y)) && $ (pred)(partials (x), partials (y)),
394+ $ (pred)(value (x), y) && iszero ( partials (x)),
395+ $ (pred)(x, value (y)) && iszero ( partials (y)),
396396 )
397397 end
398398end
399399
400400@define_binary_dual_op (
401401 Base.:(!= ),
402- (!= )(value (x), value (y)) || (!= )(partials (x), partials (y)),
403- (!= )(value (x), y) || ( != ) (partials (x), zero ( partials (x) )),
404- (!= )(x, value (y)) || ( != )( zero ( partials (y)), partials (y)),
402+ (!= )(value (x), value (y)) || (!= )(partials (x), partials (y)),
403+ (!= )(value (x), y) || ! iszero (partials (x)),
404+ (!= )(x, value (y)) || ! iszero ( partials (y)),
405405)
406406
407407for pred in [:isless , :< , :> , :(<= ), :(>= )]
@@ -413,24 +413,12 @@ for pred in [:isless, :<, :>, :(<=), :(>=)]
413413 else
414414 $ (pred)(value (x), value (y))
415415 end ,
416- if value (x) == y # only x is Dual
417- $ (pred)(partials (x), zero (partials (x)))
418- else
419- $ (pred)(value (x), value (y))
420- end ,
421- if x == value (y) # only y is Dual
422- $ (pred)(zero (partials (y)), partials (y))
423- else
424- $ (pred)(value (x), value (y))
425- end ,
416+ $ (pred)(value (x), y), # only x is Dual
417+ $ (pred)(x, value (y)), # only y is Dual
426418 )
427419 end
428420end
429421
430- # @define_binary_dual_op(Base.:(==), false, false, false)
431- # @define_binary_dual_op(Base.isequal, false, false, false)
432- # @define_binary_dual_op(Base.:(!=), true, true, true)
433-
434422# #######################
435423# Promotion/Conversion #
436424# #######################
0 commit comments