
(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 10 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 (- (+ (* x (log y)) (* z (* y (+ (* y (- (* y -0.3333333333333333) 0.5)) -1.0)))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + (z * (y * ((y * ((y * -0.3333333333333333) - 0.5)) + -1.0)))) - 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 * ((y * ((y * (-0.3333333333333333d0)) - 0.5d0)) + (-1.0d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + (z * (y * ((y * ((y * -0.3333333333333333) - 0.5)) + -1.0)))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (z * (y * ((y * ((y * -0.3333333333333333) - 0.5)) + -1.0)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(z * Float64(y * Float64(Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5)) + -1.0)))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (z * (y * ((y * ((y * -0.3333333333333333) - 0.5)) + -1.0)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[(y * N[(N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + z \cdot \left(y \cdot \left(y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right) + -1\right)\right)\right) - t
\end{array}
Initial program 83.4%
Taylor expanded in y around 0 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (log y)))) (if (or (<= z -2.5e+191) (not (<= z 7.6e+42))) (- t_1 (* y z)) (- t_1 t))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if ((z <= -2.5e+191) || !(z <= 7.6e+42)) {
tmp = t_1 - (y * z);
} else {
tmp = t_1 - 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) :: t_1
real(8) :: tmp
t_1 = x * log(y)
if ((z <= (-2.5d+191)) .or. (.not. (z <= 7.6d+42))) then
tmp = t_1 - (y * z)
else
tmp = t_1 - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * Math.log(y);
double tmp;
if ((z <= -2.5e+191) || !(z <= 7.6e+42)) {
tmp = t_1 - (y * z);
} else {
tmp = t_1 - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if (z <= -2.5e+191) or not (z <= 7.6e+42): tmp = t_1 - (y * z) else: tmp = t_1 - t return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if ((z <= -2.5e+191) || !(z <= 7.6e+42)) tmp = Float64(t_1 - Float64(y * z)); else tmp = Float64(t_1 - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if ((z <= -2.5e+191) || ~((z <= 7.6e+42))) tmp = t_1 - (y * z); else tmp = t_1 - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[z, -2.5e+191], N[Not[LessEqual[z, 7.6e+42]], $MachinePrecision]], N[(t$95$1 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+191} \lor \neg \left(z \leq 7.6 \cdot 10^{+42}\right):\\
\;\;\;\;t\_1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t\\
\end{array}
\end{array}
if z < -2.5000000000000001e191 or 7.5999999999999997e42 < z Initial program 53.1%
+-rgt-identity53.1%
+-rgt-identity53.1%
+-commutative53.1%
fma-define53.1%
sub-neg53.1%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 99.6%
fma-define99.6%
fma-define99.6%
associate-*r*99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in y around 0 98.7%
associate-*r*98.7%
mul-1-neg98.7%
Simplified98.7%
Taylor expanded in t around 0 78.0%
+-commutative78.0%
neg-mul-178.0%
unsub-neg78.0%
Simplified78.0%
if -2.5000000000000001e191 < z < 7.5999999999999997e42Initial program 95.1%
+-rgt-identity95.1%
+-rgt-identity95.1%
+-commutative95.1%
fma-define95.1%
sub-neg95.1%
log1p-define99.8%
Simplified99.8%
Taylor expanded in z around 0 94.8%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.00016) (not (<= x 1.9e-95))) (- (* x (log y)) t) (- (* y (- (* (* y z) -0.5) z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.00016) || !(x <= 1.9e-95)) {
tmp = (x * log(y)) - t;
} else {
tmp = (y * (((y * z) * -0.5) - z)) - 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 ((x <= (-0.00016d0)) .or. (.not. (x <= 1.9d-95))) then
tmp = (x * log(y)) - t
else
tmp = (y * (((y * z) * (-0.5d0)) - z)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.00016) || !(x <= 1.9e-95)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (y * (((y * z) * -0.5) - z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.00016) or not (x <= 1.9e-95): tmp = (x * math.log(y)) - t else: tmp = (y * (((y * z) * -0.5) - z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.00016) || !(x <= 1.9e-95)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(y * Float64(Float64(Float64(y * z) * -0.5) - z)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -0.00016) || ~((x <= 1.9e-95))) tmp = (x * log(y)) - t; else tmp = (y * (((y * z) * -0.5) - z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.00016], N[Not[LessEqual[x, 1.9e-95]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y * N[(N[(N[(y * z), $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00016 \lor \neg \left(x \leq 1.9 \cdot 10^{-95}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\left(y \cdot z\right) \cdot -0.5 - z\right) - t\\
\end{array}
\end{array}
if x < -1.60000000000000013e-4 or 1.8999999999999999e-95 < x Initial program 91.3%
+-rgt-identity91.3%
+-rgt-identity91.3%
+-commutative91.3%
fma-define91.3%
sub-neg91.3%
log1p-define99.7%
Simplified99.7%
Taylor expanded in z around 0 90.4%
if -1.60000000000000013e-4 < x < 1.8999999999999999e-95Initial program 73.2%
+-rgt-identity73.2%
+-rgt-identity73.2%
+-commutative73.2%
fma-define73.2%
sub-neg73.2%
log1p-define100.0%
Simplified100.0%
Taylor expanded in x around 0 63.0%
fmm-def63.0%
sub-neg63.0%
log1p-define89.8%
Simplified89.8%
Taylor expanded in y around 0 89.7%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.3e+85) (not (<= x 9.5e+33))) (* x (log y)) (- (* y (- (* y (+ (* z -0.5) (* -0.3333333333333333 (* y z)))) z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.3e+85) || !(x <= 9.5e+33)) {
tmp = x * log(y);
} else {
tmp = (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (y * z)))) - z)) - 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 ((x <= (-3.3d+85)) .or. (.not. (x <= 9.5d+33))) then
tmp = x * log(y)
else
tmp = (y * ((y * ((z * (-0.5d0)) + ((-0.3333333333333333d0) * (y * z)))) - z)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.3e+85) || !(x <= 9.5e+33)) {
tmp = x * Math.log(y);
} else {
tmp = (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (y * z)))) - z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.3e+85) or not (x <= 9.5e+33): tmp = x * math.log(y) else: tmp = (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (y * z)))) - z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.3e+85) || !(x <= 9.5e+33)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(y * Float64(Float64(y * Float64(Float64(z * -0.5) + Float64(-0.3333333333333333 * Float64(y * z)))) - z)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.3e+85) || ~((x <= 9.5e+33))) tmp = x * log(y); else tmp = (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (y * z)))) - z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.3e+85], N[Not[LessEqual[x, 9.5e+33]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(-0.3333333333333333 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{+85} \lor \neg \left(x \leq 9.5 \cdot 10^{+33}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot \left(z \cdot -0.5 + -0.3333333333333333 \cdot \left(y \cdot z\right)\right) - z\right) - t\\
\end{array}
\end{array}
if x < -3.2999999999999999e85 or 9.5000000000000003e33 < x Initial program 93.2%
+-rgt-identity93.2%
+-rgt-identity93.2%
+-commutative93.2%
fma-define93.2%
sub-neg93.2%
log1p-define99.6%
Simplified99.6%
Taylor expanded in y around 0 99.6%
fma-define99.6%
fma-define99.6%
associate-*r*99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 81.2%
if -3.2999999999999999e85 < x < 9.5000000000000003e33Initial program 77.3%
+-rgt-identity77.3%
+-rgt-identity77.3%
+-commutative77.3%
fma-define77.3%
sub-neg77.3%
log1p-define99.9%
Simplified99.9%
Taylor expanded in x around 0 62.6%
fmm-def62.6%
sub-neg62.6%
log1p-define85.1%
Simplified85.1%
Taylor expanded in y around 0 85.1%
Final simplification83.6%
(FPCore (x y z t) :precision binary64 (- (- (* x (log y)) (* y z)) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) - (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 = ((x * log(y)) - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) - (y * z)) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) - (y * z)) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) - Float64(y * z)) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) - (y * z)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y - y \cdot z\right) - t
\end{array}
Initial program 83.4%
+-rgt-identity83.4%
+-rgt-identity83.4%
+-commutative83.4%
fma-define83.4%
sub-neg83.4%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
fma-define99.8%
fma-define99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
Simplified99.4%
(FPCore (x y z t) :precision binary64 (- (* y (- (* y (+ (* z -0.5) (* -0.3333333333333333 (* y z)))) z)) t))
double code(double x, double y, double z, double t) {
return (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (y * z)))) - 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.5d0)) + ((-0.3333333333333333d0) * (y * z)))) - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (y * z)))) - z)) - t;
}
def code(x, y, z, t): return (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (y * z)))) - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(Float64(y * Float64(Float64(z * -0.5) + Float64(-0.3333333333333333 * Float64(y * z)))) - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (y * z)))) - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(-0.3333333333333333 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(y \cdot \left(z \cdot -0.5 + -0.3333333333333333 \cdot \left(y \cdot z\right)\right) - z\right) - t
\end{array}
Initial program 83.4%
+-rgt-identity83.4%
+-rgt-identity83.4%
+-commutative83.4%
fma-define83.4%
sub-neg83.4%
log1p-define99.8%
Simplified99.8%
Taylor expanded in x around 0 43.6%
fmm-def43.6%
sub-neg43.6%
log1p-define59.9%
Simplified59.9%
Taylor expanded in y around 0 59.9%
Final simplification59.9%
(FPCore (x y z t) :precision binary64 (- (* y (- (* (* y z) -0.5) z)) t))
double code(double x, double y, double z, double t) {
return (y * (((y * z) * -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.5d0)) - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (((y * z) * -0.5) - z)) - t;
}
def code(x, y, z, t): return (y * (((y * z) * -0.5) - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(Float64(Float64(y * z) * -0.5) - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * (((y * z) * -0.5) - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[(N[(y * z), $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(\left(y \cdot z\right) \cdot -0.5 - z\right) - t
\end{array}
Initial program 83.4%
+-rgt-identity83.4%
+-rgt-identity83.4%
+-commutative83.4%
fma-define83.4%
sub-neg83.4%
log1p-define99.8%
Simplified99.8%
Taylor expanded in x around 0 43.6%
fmm-def43.6%
sub-neg43.6%
log1p-define59.9%
Simplified59.9%
Taylor expanded in y around 0 59.8%
Final simplification59.8%
(FPCore (x y z t) :precision binary64 (- (* y (- z)) t))
double code(double x, double y, double z, double t) {
return (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 = (y * -z) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * -z) - t;
}
def code(x, y, z, t): return (y * -z) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(-z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * -z) - t; end
code[x_, y_, z_, t_] := N[(N[(y * (-z)), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(-z\right) - t
\end{array}
Initial program 83.4%
+-rgt-identity83.4%
+-rgt-identity83.4%
+-commutative83.4%
fma-define83.4%
sub-neg83.4%
log1p-define99.8%
Simplified99.8%
Taylor expanded in x around 0 43.6%
fmm-def43.6%
sub-neg43.6%
log1p-define59.9%
Simplified59.9%
Taylor expanded in y around 0 59.5%
associate-*r*59.5%
mul-1-neg59.5%
Simplified59.5%
Final simplification59.5%
(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 83.4%
+-rgt-identity83.4%
+-rgt-identity83.4%
+-commutative83.4%
fma-define83.4%
sub-neg83.4%
log1p-define99.8%
Simplified99.8%
Taylor expanded in t around inf 42.7%
neg-mul-142.7%
Simplified42.7%
(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 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 83.4%
+-rgt-identity83.4%
+-rgt-identity83.4%
+-commutative83.4%
fma-define83.4%
sub-neg83.4%
log1p-define99.8%
Simplified99.8%
Taylor expanded in t around inf 42.7%
neg-mul-142.7%
Simplified42.7%
neg-sub042.7%
sub-neg42.7%
add-sqr-sqrt22.3%
sqrt-unprod13.3%
sqr-neg13.3%
sqrt-unprod1.0%
add-sqr-sqrt2.2%
Applied egg-rr2.2%
+-lft-identity2.2%
Simplified2.2%
(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 2024165
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, B"
:precision binary64
:alt
(! :herbie-platform default (- (* (- z) (+ (+ (* 1/2 (* y y)) y) (* (/ 1/3 (* 1 (* 1 1))) (* y (* y y))))) (- t (* x (log y)))))
(- (+ (* x (log y)) (* z (log (- 1.0 y)))) t))