
(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 13 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 (+ -1.0 (* y (+ -0.5 (* y (+ -0.3333333333333333 (* y -0.25)))))))))
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 + (y * -0.25))))))))) - 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) + (y * (-0.25d0)))))))))) - 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 + (y * -0.25))))))))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25))))))))) - 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 * Float64(-0.3333333333333333 + Float64(y * -0.25))))))))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25))))))))) - 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 * N[(-0.3333333333333333 + N[(y * -0.25), $MachinePrecision]), $MachinePrecision]), $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 \left(-0.3333333333333333 + y \cdot -0.25\right)\right)\right)\right)\right) - t
\end{array}
Initial program 86.7%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6499.3%
Simplified99.3%
(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
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6499.2%
Simplified99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x (log y)) t)))
(if (<= x -1700000.0)
t_1
(if (<= x 3.6e-144)
(-
(*
z
(*
y
(+ -1.0 (* y (+ -0.5 (* y (+ -0.3333333333333333 (* y -0.25))))))))
t)
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x * log(y)) - t;
double tmp;
if (x <= -1700000.0) {
tmp = t_1;
} else if (x <= 3.6e-144) {
tmp = (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25)))))))) - 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 = (x * log(y)) - t
if (x <= (-1700000.0d0)) then
tmp = t_1
else if (x <= 3.6d-144) then
tmp = (z * (y * ((-1.0d0) + (y * ((-0.5d0) + (y * ((-0.3333333333333333d0) + (y * (-0.25d0))))))))) - 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 = (x * Math.log(y)) - t;
double tmp;
if (x <= -1700000.0) {
tmp = t_1;
} else if (x <= 3.6e-144) {
tmp = (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25)))))))) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * math.log(y)) - t tmp = 0 if x <= -1700000.0: tmp = t_1 elif x <= 3.6e-144: tmp = (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25)))))))) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * log(y)) - t) tmp = 0.0 if (x <= -1700000.0) tmp = t_1; elseif (x <= 3.6e-144) tmp = Float64(Float64(z * Float64(y * Float64(-1.0 + Float64(y * Float64(-0.5 + Float64(y * Float64(-0.3333333333333333 + Float64(y * -0.25)))))))) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * log(y)) - t; tmp = 0.0; if (x <= -1700000.0) tmp = t_1; elseif (x <= 3.6e-144) tmp = (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25)))))))) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -1700000.0], t$95$1, If[LessEqual[x, 3.6e-144], N[(N[(z * N[(y * N[(-1.0 + N[(y * N[(-0.5 + N[(y * N[(-0.3333333333333333 + N[(y * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y - t\\
\mathbf{if}\;x \leq -1700000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-144}:\\
\;\;\;\;z \cdot \left(y \cdot \left(-1 + y \cdot \left(-0.5 + y \cdot \left(-0.3333333333333333 + y \cdot -0.25\right)\right)\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.7e6 or 3.6e-144 < x Initial program 96.2%
Taylor expanded in y around 0
remove-double-negN/A
log-recN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
--lowering--.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
remove-double-negN/A
*-lowering-*.f64N/A
log-lowering-log.f6494.5%
Simplified94.5%
if -1.7e6 < x < 3.6e-144Initial program 70.3%
Taylor expanded in x around 0
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
--lowering--.f6462.4%
Simplified62.4%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6492.1%
Simplified92.1%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (- (+ (* x (log y)) (* (+ -1.0 (* y -0.5)) (* y z))) t))
double code(double x, double y, double z, double t) {
return ((x * log(y)) + ((-1.0 + (y * -0.5)) * (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)) + (((-1.0d0) + (y * (-0.5d0))) * (y * z))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x * Math.log(y)) + ((-1.0 + (y * -0.5)) * (y * z))) - t;
}
def code(x, y, z, t): return ((x * math.log(y)) + ((-1.0 + (y * -0.5)) * (y * z))) - t
function code(x, y, z, t) return Float64(Float64(Float64(x * log(y)) + Float64(Float64(-1.0 + Float64(y * -0.5)) * Float64(y * z))) - t) end
function tmp = code(x, y, z, t) tmp = ((x * log(y)) + ((-1.0 + (y * -0.5)) * (y * z))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log y + \left(-1 + y \cdot -0.5\right) \cdot \left(y \cdot z\right)\right) - t
\end{array}
Initial program 86.7%
Taylor expanded in y around 0
*-commutativeN/A
remove-double-negN/A
log-recN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
+-commutativeN/A
+-lowering-+.f64N/A
Simplified99.0%
Final simplification99.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (log y))))
(if (<= x -3.8e+24)
t_1
(if (<= x 55000000000000.0)
(-
(*
z
(*
y
(+ -1.0 (* y (+ -0.5 (* y (+ -0.3333333333333333 (* y -0.25))))))))
t)
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * log(y);
double tmp;
if (x <= -3.8e+24) {
tmp = t_1;
} else if (x <= 55000000000000.0) {
tmp = (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25)))))))) - 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 = x * log(y)
if (x <= (-3.8d+24)) then
tmp = t_1
else if (x <= 55000000000000.0d0) then
tmp = (z * (y * ((-1.0d0) + (y * ((-0.5d0) + (y * ((-0.3333333333333333d0) + (y * (-0.25d0))))))))) - 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 = x * Math.log(y);
double tmp;
if (x <= -3.8e+24) {
tmp = t_1;
} else if (x <= 55000000000000.0) {
tmp = (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25)))))))) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * math.log(y) tmp = 0 if x <= -3.8e+24: tmp = t_1 elif x <= 55000000000000.0: tmp = (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25)))))))) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * log(y)) tmp = 0.0 if (x <= -3.8e+24) tmp = t_1; elseif (x <= 55000000000000.0) tmp = Float64(Float64(z * Float64(y * Float64(-1.0 + Float64(y * Float64(-0.5 + Float64(y * Float64(-0.3333333333333333 + Float64(y * -0.25)))))))) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * log(y); tmp = 0.0; if (x <= -3.8e+24) tmp = t_1; elseif (x <= 55000000000000.0) tmp = (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25)))))))) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.8e+24], t$95$1, If[LessEqual[x, 55000000000000.0], N[(N[(z * N[(y * N[(-1.0 + N[(y * N[(-0.5 + N[(y * N[(-0.3333333333333333 + N[(y * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \log y\\
\mathbf{if}\;x \leq -3.8 \cdot 10^{+24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 55000000000000:\\
\;\;\;\;z \cdot \left(y \cdot \left(-1 + y \cdot \left(-0.5 + y \cdot \left(-0.3333333333333333 + y \cdot -0.25\right)\right)\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -3.80000000000000015e24 or 5.5e13 < x Initial program 97.2%
Taylor expanded in x around inf
*-lowering-*.f64N/A
log-lowering-log.f6471.1%
Simplified71.1%
if -3.80000000000000015e24 < x < 5.5e13Initial program 76.5%
Taylor expanded in x around 0
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
--lowering--.f6468.3%
Simplified68.3%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6490.7%
Simplified90.7%
Final simplification81.0%
(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 86.7%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
remove-double-negN/A
log-recN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
--lowering--.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
remove-double-negN/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6498.6%
Simplified98.6%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (- (* z (* y (+ -1.0 (* y (+ -0.5 (* y (+ -0.3333333333333333 (* y -0.25)))))))) t))
double code(double x, double y, double z, double t) {
return (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25)))))))) - 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 = (z * (y * ((-1.0d0) + (y * ((-0.5d0) + (y * ((-0.3333333333333333d0) + (y * (-0.25d0))))))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25)))))))) - t;
}
def code(x, y, z, t): return (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25)))))))) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(y * Float64(-1.0 + Float64(y * Float64(-0.5 + Float64(y * Float64(-0.3333333333333333 + Float64(y * -0.25)))))))) - t) end
function tmp = code(x, y, z, t) tmp = (z * (y * (-1.0 + (y * (-0.5 + (y * (-0.3333333333333333 + (y * -0.25)))))))) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(y * N[(-1.0 + N[(y * N[(-0.5 + N[(y * N[(-0.3333333333333333 + N[(y * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(y \cdot \left(-1 + y \cdot \left(-0.5 + y \cdot \left(-0.3333333333333333 + y \cdot -0.25\right)\right)\right)\right) - t
\end{array}
Initial program 86.7%
Taylor expanded in x around 0
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
--lowering--.f6448.4%
Simplified48.4%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6460.5%
Simplified60.5%
Final simplification60.5%
(FPCore (x y z t) :precision binary64 (if (<= t -6.5e-64) (- 0.0 t) (if (<= t 6e-123) (- 0.0 (* y z)) (- 0.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.5e-64) {
tmp = 0.0 - t;
} else if (t <= 6e-123) {
tmp = 0.0 - (y * z);
} else {
tmp = 0.0 - 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 <= (-6.5d-64)) then
tmp = 0.0d0 - t
else if (t <= 6d-123) then
tmp = 0.0d0 - (y * z)
else
tmp = 0.0d0 - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.5e-64) {
tmp = 0.0 - t;
} else if (t <= 6e-123) {
tmp = 0.0 - (y * z);
} else {
tmp = 0.0 - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.5e-64: tmp = 0.0 - t elif t <= 6e-123: tmp = 0.0 - (y * z) else: tmp = 0.0 - t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.5e-64) tmp = Float64(0.0 - t); elseif (t <= 6e-123) tmp = Float64(0.0 - Float64(y * z)); else tmp = Float64(0.0 - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -6.5e-64) tmp = 0.0 - t; elseif (t <= 6e-123) tmp = 0.0 - (y * z); else tmp = 0.0 - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.5e-64], N[(0.0 - t), $MachinePrecision], If[LessEqual[t, 6e-123], N[(0.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(0.0 - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.5 \cdot 10^{-64}:\\
\;\;\;\;0 - t\\
\mathbf{elif}\;t \leq 6 \cdot 10^{-123}:\\
\;\;\;\;0 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;0 - t\\
\end{array}
\end{array}
if t < -6.5000000000000004e-64 or 5.99999999999999968e-123 < t Initial program 93.4%
Taylor expanded in t around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6464.5%
Simplified64.5%
sub0-negN/A
neg-lowering-neg.f6464.5%
Applied egg-rr64.5%
if -6.5000000000000004e-64 < t < 5.99999999999999968e-123Initial program 70.8%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
remove-double-negN/A
log-recN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
--lowering--.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
remove-double-negN/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
*-commutativeN/A
*-lowering-*.f6498.0%
Simplified98.0%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f6431.7%
Simplified31.7%
sub0-negN/A
neg-lowering-neg.f6431.7%
Applied egg-rr31.7%
Final simplification54.8%
(FPCore (x y z t) :precision binary64 (- (* z (* y (+ -1.0 (* y (+ -0.5 (* y -0.3333333333333333)))))) t))
double code(double x, double y, double z, double t) {
return (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 = (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 (z * (y * (-1.0 + (y * (-0.5 + (y * -0.3333333333333333)))))) - t;
}
def code(x, y, z, t): return (z * (y * (-1.0 + (y * (-0.5 + (y * -0.3333333333333333)))))) - t
function code(x, y, z, t) return Float64(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 = (z * (y * (-1.0 + (y * (-0.5 + (y * -0.3333333333333333)))))) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(y * N[(-1.0 + N[(y * N[(-0.5 + N[(y * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(y \cdot \left(-1 + y \cdot \left(-0.5 + y \cdot -0.3333333333333333\right)\right)\right) - t
\end{array}
Initial program 86.7%
Taylor expanded in x around 0
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
--lowering--.f6448.4%
Simplified48.4%
Taylor expanded in y around 0
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6460.4%
Simplified60.4%
Final simplification60.4%
(FPCore (x y z t) :precision binary64 (- (* y (- (* (+ -0.5 (* y -0.3333333333333333)) (* y z)) z)) t))
double code(double x, double y, double z, double t) {
return (y * (((-0.5 + (y * -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 * ((((-0.5d0) + (y * (-0.3333333333333333d0))) * (y * z)) - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (((-0.5 + (y * -0.3333333333333333)) * (y * z)) - z)) - t;
}
def code(x, y, z, t): return (y * (((-0.5 + (y * -0.3333333333333333)) * (y * z)) - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(Float64(Float64(-0.5 + Float64(y * -0.3333333333333333)) * Float64(y * z)) - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * (((-0.5 + (y * -0.3333333333333333)) * (y * z)) - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[(N[(-0.5 + N[(y * -0.3333333333333333), $MachinePrecision]), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(\left(-0.5 + y \cdot -0.3333333333333333\right) \cdot \left(y \cdot z\right) - z\right) - t
\end{array}
Initial program 86.7%
Taylor expanded in x around 0
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
--lowering--.f6448.4%
Simplified48.4%
Taylor expanded in y around 0
mul-1-negN/A
+-commutativeN/A
fma-undefineN/A
+-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
metadata-evalN/A
sub-negN/A
fmm-defN/A
--lowering--.f64N/A
Simplified60.4%
Final simplification60.4%
(FPCore (x y z t) :precision binary64 (- (* y (- (* -0.5 (* y z)) z)) t))
double code(double x, double y, double z, double t) {
return (y * ((-0.5 * (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 * (((-0.5d0) * (y * z)) - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * ((-0.5 * (y * z)) - z)) - t;
}
def code(x, y, z, t): return (y * ((-0.5 * (y * z)) - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(Float64(-0.5 * Float64(y * z)) - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * ((-0.5 * (y * z)) - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[(-0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(-0.5 \cdot \left(y \cdot z\right) - z\right) - t
\end{array}
Initial program 86.7%
Taylor expanded in x around 0
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
--lowering--.f6448.4%
Simplified48.4%
Taylor expanded in y around 0
--lowering--.f64N/A
*-lowering-*.f64N/A
mul-1-negN/A
+-commutativeN/A
sub-negN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6460.2%
Simplified60.2%
Final simplification60.2%
(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(0.0 - Float64(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[(0.0 - N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0 - \left(t + y \cdot z\right)
\end{array}
Initial program 86.7%
Taylor expanded in x around 0
--lowering--.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
--lowering--.f6448.4%
Simplified48.4%
Taylor expanded in y around 0
--lowering--.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6459.9%
Simplified59.9%
Final simplification59.9%
(FPCore (x y z t) :precision binary64 (- 0.0 t))
double code(double x, double y, double z, double t) {
return 0.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 = 0.0d0 - t
end function
public static double code(double x, double y, double z, double t) {
return 0.0 - t;
}
def code(x, y, z, t): return 0.0 - t
function code(x, y, z, t) return Float64(0.0 - t) end
function tmp = code(x, y, z, t) tmp = 0.0 - t; end
code[x_, y_, z_, t_] := N[(0.0 - t), $MachinePrecision]
\begin{array}{l}
\\
0 - t
\end{array}
Initial program 86.7%
Taylor expanded in t around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f6446.7%
Simplified46.7%
sub0-negN/A
neg-lowering-neg.f6446.7%
Applied egg-rr46.7%
Final simplification46.7%
(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 2024155
(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))