| Alternative 1 | |
|---|---|
| Error | 29.1 |
| Cost | 13440 |
\[3 \cdot \left(-0.3333333333333333 + \frac{0.6666666666666666}{1 + {\left(e^{x}\right)}^{-2}}\right)
\]
(FPCore (x y) :precision binary64 (- (/ 2.0 (+ 1.0 (exp (* -2.0 x)))) 1.0))
(FPCore (x y)
:precision binary64
(*
(log
(exp
(+ -0.3333333333333333 (/ 0.6666666666666666 (+ 1.0 (exp (* x -2.0)))))))
3.0))double code(double x, double y) {
return (2.0 / (1.0 + exp((-2.0 * x)))) - 1.0;
}
double code(double x, double y) {
return log(exp((-0.3333333333333333 + (0.6666666666666666 / (1.0 + exp((x * -2.0))))))) * 3.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (2.0d0 / (1.0d0 + exp(((-2.0d0) * x)))) - 1.0d0
end function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = log(exp(((-0.3333333333333333d0) + (0.6666666666666666d0 / (1.0d0 + exp((x * (-2.0d0)))))))) * 3.0d0
end function
public static double code(double x, double y) {
return (2.0 / (1.0 + Math.exp((-2.0 * x)))) - 1.0;
}
public static double code(double x, double y) {
return Math.log(Math.exp((-0.3333333333333333 + (0.6666666666666666 / (1.0 + Math.exp((x * -2.0))))))) * 3.0;
}
def code(x, y): return (2.0 / (1.0 + math.exp((-2.0 * x)))) - 1.0
def code(x, y): return math.log(math.exp((-0.3333333333333333 + (0.6666666666666666 / (1.0 + math.exp((x * -2.0))))))) * 3.0
function code(x, y) return Float64(Float64(2.0 / Float64(1.0 + exp(Float64(-2.0 * x)))) - 1.0) end
function code(x, y) return Float64(log(exp(Float64(-0.3333333333333333 + Float64(0.6666666666666666 / Float64(1.0 + exp(Float64(x * -2.0))))))) * 3.0) end
function tmp = code(x, y) tmp = (2.0 / (1.0 + exp((-2.0 * x)))) - 1.0; end
function tmp = code(x, y) tmp = log(exp((-0.3333333333333333 + (0.6666666666666666 / (1.0 + exp((x * -2.0))))))) * 3.0; end
code[x_, y_] := N[(N[(2.0 / N[(1.0 + N[Exp[N[(-2.0 * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
code[x_, y_] := N[(N[Log[N[Exp[N[(-0.3333333333333333 + N[(0.6666666666666666 / N[(1.0 + N[Exp[N[(x * -2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * 3.0), $MachinePrecision]
\frac{2}{1 + e^{-2 \cdot x}} - 1
\log \left(e^{-0.3333333333333333 + \frac{0.6666666666666666}{1 + e^{x \cdot -2}}}\right) \cdot 3
Results
Initial program 29.1
Applied egg-rr30.1
Simplified30.1
Applied egg-rr30.1
Simplified29.1
Applied egg-rr29.1
Final simplification29.1
| Alternative 1 | |
|---|---|
| Error | 29.1 |
| Cost | 13440 |
| Alternative 2 | |
|---|---|
| Error | 29.1 |
| Cost | 6976 |
herbie shell --seed 2022334
(FPCore (x y)
:name "Logistic function from Lakshay Garg"
:precision binary64
(- (/ 2.0 (+ 1.0 (exp (* -2.0 x)))) 1.0))