From 2848729465df201ecc0a303891bec14e2211f72d Mon Sep 17 00:00:00 2001 From: Yingbo Ma Date: Fri, 2 Apr 2021 12:26:06 -0400 Subject: [PATCH] Fix tests --- src/extra_functions.jl | 2 -- src/num.jl | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extra_functions.jl b/src/extra_functions.jl index f07a9dd87..300aa5bd0 100644 --- a/src/extra_functions.jl +++ b/src/extra_functions.jl @@ -24,8 +24,6 @@ function derivative(::typeof(max), args::NTuple{2,Any}, ::Val{2}) IfElse.ifelse(x > y, zero(y), one(y)) end -IfElse.ifelse(x::Num,y,z) = Num(Term{Real}(IfElse.ifelse, [value(x), value(y), value(z)])) - @register Base.rand(x) @register Base.randn(x) diff --git a/src/num.jl b/src/num.jl index ba38f9bb7..bcc18b587 100644 --- a/src/num.jl +++ b/src/num.jl @@ -31,6 +31,8 @@ Base.typemin(::Type{Num}) = Num(-Inf) Base.typemax(::Type{Num}) = Num(Inf) Base.float(x::Num) = x +IfElse.ifelse(x::Num,y,z) = Num(IfElse.ifelse(value(x), value(y), value(z))) + Base.promote_rule(::Type{Bool}, ::Type{<:Num}) = Num for C in [Complex, Complex{Bool}] @eval begin