
(FPCore (x y z t) :precision binary64 (- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (z * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * log(y)) + (z * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (z * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (z * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(z * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (z * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (z * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * log(y)) + (z * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (z * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (z * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(z * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (z * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + z \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (- (+ (* (log1p (- 0.0 y)) z) (* x (log y))) t))
double code(double x, double y, double z, double t) {
return ((log1p((0.0 - y)) * z) + (x * log(y))) - t;
}
public static double code(double x, double y, double z, double t) {
return ((Math.log1p((0.0 - y)) * z) + (x * Math.log(y))) - t;
}
def code(x, y, z, t): return ((math.log1p((0.0 - y)) * z) + (x * math.log(y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log1p(Float64(0.0 - y)) * z) + Float64(x * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[1 + N[(0.0 - y), $MachinePrecision]], $MachinePrecision] * z), $MachinePrecision] + N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{log1p}\left(0 - y\right) \cdot z + x \cdot \log y\right) - t
\end{array}
Initial program 86.7%
Applied egg-rr0
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -1.5e+134)
t_1
(if (<= x -1.4e+92)
(- (- 0.0 t) (* y z))
(if (<= x -600000.0)
t_1
(if (<= x 5.4e+62)
(- (* y (- (* y (* z (+ (* -0.3333333333333333 y) -0.5))) z)) t)
t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -1.5e+134) {
tmp = t_1;
} else if (x <= -1.4e+92) {
tmp = (0.0 - t) - (y * z);
} else if (x <= -600000.0) {
tmp = t_1;
} else if (x <= 5.4e+62) {
tmp = (y * ((y * (z * ((-0.3333333333333333 * y) + -0.5))) - z)) - t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = log(y) * x
if (x <= (-1.5d+134)) then
tmp = t_1
else if (x <= (-1.4d+92)) then
tmp = (0.0d0 - t) - (y * z)
else if (x <= (-600000.0d0)) then
tmp = t_1
else if (x <= 5.4d+62) then
tmp = (y * ((y * (z * (((-0.3333333333333333d0) * y) + (-0.5d0)))) - z)) - t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * x;
double tmp;
if (x <= -1.5e+134) {
tmp = t_1;
} else if (x <= -1.4e+92) {
tmp = (0.0 - t) - (y * z);
} else if (x <= -600000.0) {
tmp = t_1;
} else if (x <= 5.4e+62) {
tmp = (y * ((y * (z * ((-0.3333333333333333 * y) + -0.5))) - z)) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x tmp = 0 if x <= -1.5e+134: tmp = t_1 elif x <= -1.4e+92: tmp = (0.0 - t) - (y * z) elif x <= -600000.0: tmp = t_1 elif x <= 5.4e+62: tmp = (y * ((y * (z * ((-0.3333333333333333 * y) + -0.5))) - z)) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -1.5e+134) tmp = t_1; elseif (x <= -1.4e+92) tmp = Float64(Float64(0.0 - t) - Float64(y * z)); elseif (x <= -600000.0) tmp = t_1; elseif (x <= 5.4e+62) tmp = Float64(Float64(y * Float64(Float64(y * Float64(z * Float64(Float64(-0.3333333333333333 * y) + -0.5))) - z)) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; tmp = 0.0; if (x <= -1.5e+134) tmp = t_1; elseif (x <= -1.4e+92) tmp = (0.0 - t) - (y * z); elseif (x <= -600000.0) tmp = t_1; elseif (x <= 5.4e+62) tmp = (y * ((y * (z * ((-0.3333333333333333 * y) + -0.5))) - z)) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -1.5e+134], t$95$1, If[LessEqual[x, -1.4e+92], N[(N[(0.0 - t), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -600000.0], t$95$1, If[LessEqual[x, 5.4e+62], N[(N[(y * N[(N[(y * N[(z * N[(N[(-0.3333333333333333 * y), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{+92}:\\
\;\;\;\;\left(0 - t\right) - y \cdot z\\
\mathbf{elif}\;x \leq -600000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{+62}:\\
\;\;\;\;y \cdot \left(y \cdot \left(z \cdot \left(-0.3333333333333333 \cdot y + -0.5\right)\right) - z\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.49999999999999998e134 or -1.4e92 < x < -6e5 or 5.4e62 < x Initial program 97.1%
Taylor expanded in x around inf 0
Simplified0
if -1.49999999999999998e134 < x < -1.4e92Initial program 89.0%
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
if -6e5 < x < 5.4e62Initial program 79.0%
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
(FPCore (x y z t) :precision binary64 (- (+ (* x (log y)) (* z (* y (+ -1.0 (* y (+ -0.5 (* y -0.3333333333333333))))))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (z * (y * (-1.0 + (y * (-0.5 + (y * -0.3333333333333333))))))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * log(y)) + (z * (y * ((-1.0d0) + (y * ((-0.5d0) + (y * (-0.3333333333333333d0)))))))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (z * (y * (-1.0 + (y * (-0.5 + (y * -0.3333333333333333))))))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (z * (y * (-1.0 + (y * (-0.5 + (y * -0.3333333333333333))))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(z * Float64(y * Float64(-1.0 + Float64(y * Float64(-0.5 + Float64(y * -0.3333333333333333))))))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (z * (y * (-1.0 + (y * (-0.5 + (y * -0.3333333333333333))))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[(y * N[(-1.0 + N[(y * N[(-0.5 + N[(y * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + z \cdot \left(y \cdot \left(-1 + y \cdot \left(-0.5 + y \cdot -0.3333333333333333\right)\right)\right)\right) - t
\end{array}
Initial program 86.7%
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* (log y) x) t)))
(if (<= t -9.5e-108)
t_1
(if (<= t 8.5e-181) (- (* x (log y)) (* y z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - t;
double tmp;
if (t <= -9.5e-108) {
tmp = t_1;
} else if (t <= 8.5e-181) {
tmp = (x * log(y)) - (y * z);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (log(y) * x) - t
if (t <= (-9.5d-108)) then
tmp = t_1
else if (t <= 8.5d-181) then
tmp = (x * log(y)) - (y * z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (Math.log(y) * x) - t;
double tmp;
if (t <= -9.5e-108) {
tmp = t_1;
} else if (t <= 8.5e-181) {
tmp = (x * Math.log(y)) - (y * z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (math.log(y) * x) - t tmp = 0 if t <= -9.5e-108: tmp = t_1 elif t <= 8.5e-181: tmp = (x * math.log(y)) - (y * z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - t) tmp = 0.0 if (t <= -9.5e-108) tmp = t_1; elseif (t <= 8.5e-181) tmp = Float64(Float64(x * log(y)) - Float64(y * z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (log(y) * x) - t; tmp = 0.0; if (t <= -9.5e-108) tmp = t_1; elseif (t <= 8.5e-181) tmp = (x * log(y)) - (y * z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t, -9.5e-108], t$95$1, If[LessEqual[t, 8.5e-181], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - t\\
\mathbf{if}\;t \leq -9.5 \cdot 10^{-108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-181}:\\
\;\;\;\;x \cdot \log y - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -9.5000000000000005e-108 or 8.49999999999999953e-181 < t Initial program 92.1%
Taylor expanded in x around inf 0
Simplified0
if -9.5000000000000005e-108 < t < 8.49999999999999953e-181Initial program 73.9%
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in t around 0 0
Simplified0
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* (log y) x) t)))
(if (<= x -0.105)
t_1
(if (<= x 4.8e-159)
(- (* y (- (* y (* z (+ (* -0.3333333333333333 y) -0.5))) z)) t)
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - t;
double tmp;
if (x <= -0.105) {
tmp = t_1;
} else if (x <= 4.8e-159) {
tmp = (y * ((y * (z * ((-0.3333333333333333 * y) + -0.5))) - z)) - t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (log(y) * x) - t
if (x <= (-0.105d0)) then
tmp = t_1
else if (x <= 4.8d-159) then
tmp = (y * ((y * (z * (((-0.3333333333333333d0) * y) + (-0.5d0)))) - z)) - t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (Math.log(y) * x) - t;
double tmp;
if (x <= -0.105) {
tmp = t_1;
} else if (x <= 4.8e-159) {
tmp = (y * ((y * (z * ((-0.3333333333333333 * y) + -0.5))) - z)) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (math.log(y) * x) - t tmp = 0 if x <= -0.105: tmp = t_1 elif x <= 4.8e-159: tmp = (y * ((y * (z * ((-0.3333333333333333 * y) + -0.5))) - z)) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - t) tmp = 0.0 if (x <= -0.105) tmp = t_1; elseif (x <= 4.8e-159) tmp = Float64(Float64(y * Float64(Float64(y * Float64(z * Float64(Float64(-0.3333333333333333 * y) + -0.5))) - z)) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (log(y) * x) - t; tmp = 0.0; if (x <= -0.105) tmp = t_1; elseif (x <= 4.8e-159) tmp = (y * ((y * (z * ((-0.3333333333333333 * y) + -0.5))) - z)) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -0.105], t$95$1, If[LessEqual[x, 4.8e-159], N[(N[(y * N[(N[(y * N[(z * N[(N[(-0.3333333333333333 * y), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - t\\
\mathbf{if}\;x \leq -0.105:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{-159}:\\
\;\;\;\;y \cdot \left(y \cdot \left(z \cdot \left(-0.3333333333333333 \cdot y + -0.5\right)\right) - z\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -0.104999999999999996 or 4.79999999999999995e-159 < x Initial program 93.7%
Taylor expanded in x around inf 0
Simplified0
if -0.104999999999999996 < x < 4.79999999999999995e-159Initial program 75.1%
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) x) (* z (* y (+ -1.0 (* y -0.5))))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * x) + (z * (y * (-1.0 + (y * -0.5))))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((log(y) * x) + (z * (y * ((-1.0d0) + (y * (-0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * x) + (z * (y * (-1.0 + (y * -0.5))))) - t;
}
def code(x, y, z, t): return ((math.log(y) * x) + (z * (y * (-1.0 + (y * -0.5))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * x) + Float64(z * Float64(y * Float64(-1.0 + Float64(y * -0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * x) + (z * (y * (-1.0 + (y * -0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] + N[(z * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot x + z \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right)\right) - t
\end{array}
Initial program 86.7%
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y z t) :precision binary64 (- (- (* (log y) x) (* y z)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * x) - (y * z)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((log(y) * x) - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * x) - (y * z)) - t;
}
def code(x, y, z, t): return ((math.log(y) * x) - (y * z)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * x) - Float64(y * z)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * x) - (y * z)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot x - y \cdot z\right) - t
\end{array}
Initial program 86.7%
Taylor expanded in y around 0 0
Simplified0
(FPCore (x y z t) :precision binary64 (- (* y (- (* y (* z (+ (* -0.3333333333333333 y) -0.5))) z)) t))
double code(double x, double y, double z, double t) {
return (y * ((y * (z * ((-0.3333333333333333 * y) + -0.5))) - z)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y * ((y * (z * (((-0.3333333333333333d0) * y) + (-0.5d0)))) - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * ((y * (z * ((-0.3333333333333333 * y) + -0.5))) - z)) - t;
}
def code(x, y, z, t): return (y * ((y * (z * ((-0.3333333333333333 * y) + -0.5))) - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(Float64(y * Float64(z * Float64(Float64(-0.3333333333333333 * y) + -0.5))) - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * ((y * (z * ((-0.3333333333333333 * y) + -0.5))) - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[(y * N[(z * N[(N[(-0.3333333333333333 * y), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(y \cdot \left(z \cdot \left(-0.3333333333333333 \cdot y + -0.5\right)\right) - z\right) - t
\end{array}
Initial program 86.7%
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
(FPCore (x y z t) :precision binary64 (if (<= t -1.9e-112) (- t) (if (<= t 1.7e-172) (* (- z) y) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.9e-112) {
tmp = -t;
} else if (t <= 1.7e-172) {
tmp = -z * y;
} else {
tmp = -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-1.9d-112)) then
tmp = -t
else if (t <= 1.7d-172) then
tmp = -z * y
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.9e-112) {
tmp = -t;
} else if (t <= 1.7e-172) {
tmp = -z * y;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.9e-112: tmp = -t elif t <= 1.7e-172: tmp = -z * y else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.9e-112) tmp = Float64(-t); elseif (t <= 1.7e-172) tmp = Float64(Float64(-z) * y); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.9e-112) tmp = -t; elseif (t <= 1.7e-172) tmp = -z * y; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.9e-112], (-t), If[LessEqual[t, 1.7e-172], N[((-z) * y), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{-112}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{-172}:\\
\;\;\;\;\left(-z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -1.89999999999999997e-112 or 1.6999999999999999e-172 < t Initial program 92.1%
Taylor expanded in t around inf 0
Simplified0
Applied egg-rr0
if -1.89999999999999997e-112 < t < 1.6999999999999999e-172Initial program 74.2%
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in t around inf 0
Simplified0
Taylor expanded in y around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z t) :precision binary64 (- (- 0.0 t) (* y z)))
double code(double x, double y, double z, double t) {
return (0.0 - t) - (y * z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (0.0d0 - t) - (y * z)
end function
public static double code(double x, double y, double z, double t) {
return (0.0 - t) - (y * z);
}
def code(x, y, z, t): return (0.0 - t) - (y * z)
function code(x, y, z, t) return Float64(Float64(0.0 - t) - Float64(y * z)) end
function tmp = code(x, y, z, t) tmp = (0.0 - t) - (y * z); end
code[x_, y_, z_, t_] := N[(N[(0.0 - t), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0 - t\right) - y \cdot z
\end{array}
Initial program 86.7%
Taylor expanded in y around 0 0
Simplified0
Taylor expanded in x around 0 0
Simplified0
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
return -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t
end function
public static double code(double x, double y, double z, double t) {
return -t;
}
def code(x, y, z, t): return -t
function code(x, y, z, t) return Float64(-t) end
function tmp = code(x, y, z, t) tmp = -t; end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 86.7%
Taylor expanded in t around inf 0
Simplified0
Applied egg-rr0
(FPCore (x y z t)
:precision binary64
(-
(*
(- z)
(+
(+ (* 0.5 (* y y)) y)
(* (/ 0.3333333333333333 (* 1.0 (* 1.0 1.0))) (* y (* y y)))))
(- t (* x (log y)))))
double code(double x, double y, double z, double t) {
return (-z * (((0.5 * (y * y)) + y) + ((0.3333333333333333 / (1.0 * (1.0 * 1.0))) * (y * (y * y))))) - (t - (x * log(y)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (-z * (((0.5d0 * (y * y)) + y) + ((0.3333333333333333d0 / (1.0d0 * (1.0d0 * 1.0d0))) * (y * (y * y))))) - (t - (x * log(y)))
end function
public static double code(double x, double y, double z, double t) {
return (-z * (((0.5 * (y * y)) + y) + ((0.3333333333333333 / (1.0 * (1.0 * 1.0))) * (y * (y * y))))) - (t - (x * Math.log(y)));
}
def code(x, y, z, t): return (-z * (((0.5 * (y * y)) + y) + ((0.3333333333333333 / (1.0 * (1.0 * 1.0))) * (y * (y * y))))) - (t - (x * math.log(y)))
function code(x, y, z, t) return Float64(Float64(Float64(-z) * Float64(Float64(Float64(0.5 * Float64(y * y)) + y) + Float64(Float64(0.3333333333333333 / Float64(1.0 * Float64(1.0 * 1.0))) * Float64(y * Float64(y * y))))) - Float64(t - Float64(x * log(y)))) end
function tmp = code(x, y, z, t) tmp = (-z * (((0.5 * (y * y)) + y) + ((0.3333333333333333 / (1.0 * (1.0 * 1.0))) * (y * (y * y))))) - (t - (x * log(y))); end
code[x_, y_, z_, t_] := N[(N[((-z) * N[(N[(N[(0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] + N[(N[(0.3333333333333333 / N[(1.0 * N[(1.0 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t - N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-z\right) \cdot \left(\left(0.5 \cdot \left(y \cdot y\right) + y\right) + \frac{0.3333333333333333}{1 \cdot \left(1 \cdot 1\right)} \cdot \left(y \cdot \left(y \cdot y\right)\right)\right) - \left(t - x \cdot \log y\right)
\end{array}
herbie shell --seed 2024110
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"
:precision binary64
:alt
(- (* (- z) (+ (+ (* 0.5 (* y y)) y) (* (/ 0.3333333333333333 (* 1.0 (* 1.0 1.0))) (* y (* y y))))) (- t (* x (log y))))
(- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))