
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * ((y - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * ((y - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
(FPCore (x y z) :precision binary64 (if (or (<= z -1.25e-8) (not (<= z 1e-26))) (* x (+ (/ (+ y 1.0) z) -1.0)) (/ (* x (+ y 1.0)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.25e-8) || !(z <= 1e-26)) {
tmp = x * (((y + 1.0) / z) + -1.0);
} else {
tmp = (x * (y + 1.0)) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.25d-8)) .or. (.not. (z <= 1d-26))) then
tmp = x * (((y + 1.0d0) / z) + (-1.0d0))
else
tmp = (x * (y + 1.0d0)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.25e-8) || !(z <= 1e-26)) {
tmp = x * (((y + 1.0) / z) + -1.0);
} else {
tmp = (x * (y + 1.0)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.25e-8) or not (z <= 1e-26): tmp = x * (((y + 1.0) / z) + -1.0) else: tmp = (x * (y + 1.0)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.25e-8) || !(z <= 1e-26)) tmp = Float64(x * Float64(Float64(Float64(y + 1.0) / z) + -1.0)); else tmp = Float64(Float64(x * Float64(y + 1.0)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.25e-8) || ~((z <= 1e-26))) tmp = x * (((y + 1.0) / z) + -1.0); else tmp = (x * (y + 1.0)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.25e-8], N[Not[LessEqual[z, 1e-26]], $MachinePrecision]], N[(x * N[(N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-8} \lor \neg \left(z \leq 10^{-26}\right):\\
\;\;\;\;x \cdot \left(\frac{y + 1}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + 1\right)}{z}\\
\end{array}
\end{array}
if z < -1.2499999999999999e-8 or 1e-26 < z Initial program 78.1%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
if -1.2499999999999999e-8 < z < 1e-26Initial program 99.9%
associate-/l*89.7%
+-commutative89.7%
associate-+r-89.7%
div-sub89.7%
*-inverses89.7%
sub-neg89.7%
metadata-eval89.7%
+-commutative89.7%
Simplified89.7%
Taylor expanded in z around 0 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= z -6.2e+64)
(- x)
(if (<= z -4.2e-37)
(* x (/ y z))
(if (<= z 3e-10) (/ x z) (if (<= z 3.2e+53) (* y (/ x z)) (- x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.2e+64) {
tmp = -x;
} else if (z <= -4.2e-37) {
tmp = x * (y / z);
} else if (z <= 3e-10) {
tmp = x / z;
} else if (z <= 3.2e+53) {
tmp = y * (x / z);
} else {
tmp = -x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-6.2d+64)) then
tmp = -x
else if (z <= (-4.2d-37)) then
tmp = x * (y / z)
else if (z <= 3d-10) then
tmp = x / z
else if (z <= 3.2d+53) then
tmp = y * (x / z)
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6.2e+64) {
tmp = -x;
} else if (z <= -4.2e-37) {
tmp = x * (y / z);
} else if (z <= 3e-10) {
tmp = x / z;
} else if (z <= 3.2e+53) {
tmp = y * (x / z);
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.2e+64: tmp = -x elif z <= -4.2e-37: tmp = x * (y / z) elif z <= 3e-10: tmp = x / z elif z <= 3.2e+53: tmp = y * (x / z) else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.2e+64) tmp = Float64(-x); elseif (z <= -4.2e-37) tmp = Float64(x * Float64(y / z)); elseif (z <= 3e-10) tmp = Float64(x / z); elseif (z <= 3.2e+53) tmp = Float64(y * Float64(x / z)); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6.2e+64) tmp = -x; elseif (z <= -4.2e-37) tmp = x * (y / z); elseif (z <= 3e-10) tmp = x / z; elseif (z <= 3.2e+53) tmp = y * (x / z); else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.2e+64], (-x), If[LessEqual[z, -4.2e-37], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e-10], N[(x / z), $MachinePrecision], If[LessEqual[z, 3.2e+53], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], (-x)]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+64}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-37}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-10}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+53}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -6.1999999999999998e64 or 3.2e53 < z Initial program 71.1%
associate-/l*100.0%
+-commutative100.0%
associate-+r-100.0%
div-sub100.0%
*-inverses100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 84.3%
neg-mul-184.3%
Simplified84.3%
if -6.1999999999999998e64 < z < -4.2000000000000002e-37Initial program 99.8%
associate-/l*99.6%
+-commutative99.6%
associate-+r-99.6%
div-sub99.6%
*-inverses99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in y around inf 76.6%
associate-/l*76.4%
Simplified76.4%
if -4.2000000000000002e-37 < z < 3e-10Initial program 99.9%
Taylor expanded in y around 0 65.5%
associate-/l*65.3%
Simplified65.3%
Taylor expanded in z around 0 65.2%
if 3e-10 < z < 3.2e53Initial program 99.8%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around inf 64.6%
*-commutative64.6%
associate-*r/64.6%
Simplified64.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ y z))))
(if (<= z -4.1e+64)
(- x)
(if (<= z -1.3e-36)
t_0
(if (<= z 4.6e-8) (/ x z) (if (<= z 6.7e+56) t_0 (- x)))))))
double code(double x, double y, double z) {
double t_0 = x * (y / z);
double tmp;
if (z <= -4.1e+64) {
tmp = -x;
} else if (z <= -1.3e-36) {
tmp = t_0;
} else if (z <= 4.6e-8) {
tmp = x / z;
} else if (z <= 6.7e+56) {
tmp = t_0;
} else {
tmp = -x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x * (y / z)
if (z <= (-4.1d+64)) then
tmp = -x
else if (z <= (-1.3d-36)) then
tmp = t_0
else if (z <= 4.6d-8) then
tmp = x / z
else if (z <= 6.7d+56) then
tmp = t_0
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (y / z);
double tmp;
if (z <= -4.1e+64) {
tmp = -x;
} else if (z <= -1.3e-36) {
tmp = t_0;
} else if (z <= 4.6e-8) {
tmp = x / z;
} else if (z <= 6.7e+56) {
tmp = t_0;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = x * (y / z) tmp = 0 if z <= -4.1e+64: tmp = -x elif z <= -1.3e-36: tmp = t_0 elif z <= 4.6e-8: tmp = x / z elif z <= 6.7e+56: tmp = t_0 else: tmp = -x return tmp
function code(x, y, z) t_0 = Float64(x * Float64(y / z)) tmp = 0.0 if (z <= -4.1e+64) tmp = Float64(-x); elseif (z <= -1.3e-36) tmp = t_0; elseif (z <= 4.6e-8) tmp = Float64(x / z); elseif (z <= 6.7e+56) tmp = t_0; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (y / z); tmp = 0.0; if (z <= -4.1e+64) tmp = -x; elseif (z <= -1.3e-36) tmp = t_0; elseif (z <= 4.6e-8) tmp = x / z; elseif (z <= 6.7e+56) tmp = t_0; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.1e+64], (-x), If[LessEqual[z, -1.3e-36], t$95$0, If[LessEqual[z, 4.6e-8], N[(x / z), $MachinePrecision], If[LessEqual[z, 6.7e+56], t$95$0, (-x)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{y}{z}\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{+64}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-36}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 4.6 \cdot 10^{-8}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 6.7 \cdot 10^{+56}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -4.09999999999999978e64 or 6.7e56 < z Initial program 71.1%
associate-/l*100.0%
+-commutative100.0%
associate-+r-100.0%
div-sub100.0%
*-inverses100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 84.3%
neg-mul-184.3%
Simplified84.3%
if -4.09999999999999978e64 < z < -1.3e-36 or 4.6000000000000002e-8 < z < 6.7e56Initial program 99.8%
associate-/l*99.7%
+-commutative99.7%
associate-+r-99.7%
div-sub99.7%
*-inverses99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 71.8%
associate-/l*71.7%
Simplified71.7%
if -1.3e-36 < z < 4.6000000000000002e-8Initial program 99.9%
Taylor expanded in y around 0 65.5%
associate-/l*65.3%
Simplified65.3%
Taylor expanded in z around 0 65.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.25) (not (<= z 1.0))) (* x (+ -1.0 (/ y z))) (/ (* x (+ y 1.0)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.25) || !(z <= 1.0)) {
tmp = x * (-1.0 + (y / z));
} else {
tmp = (x * (y + 1.0)) / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1.25d0)) .or. (.not. (z <= 1.0d0))) then
tmp = x * ((-1.0d0) + (y / z))
else
tmp = (x * (y + 1.0d0)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.25) || !(z <= 1.0)) {
tmp = x * (-1.0 + (y / z));
} else {
tmp = (x * (y + 1.0)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.25) or not (z <= 1.0): tmp = x * (-1.0 + (y / z)) else: tmp = (x * (y + 1.0)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.25) || !(z <= 1.0)) tmp = Float64(x * Float64(-1.0 + Float64(y / z))); else tmp = Float64(Float64(x * Float64(y + 1.0)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.25) || ~((z <= 1.0))) tmp = x * (-1.0 + (y / z)); else tmp = (x * (y + 1.0)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.25], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + 1\right)}{z}\\
\end{array}
\end{array}
if z < -1.25 or 1 < z Initial program 77.0%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around inf 98.3%
if -1.25 < z < 1Initial program 99.9%
associate-/l*90.3%
+-commutative90.3%
associate-+r-90.3%
div-sub90.3%
*-inverses90.3%
sub-neg90.3%
metadata-eval90.3%
+-commutative90.3%
Simplified90.3%
Taylor expanded in z around 0 98.8%
Final simplification98.5%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 0.065))) (* x (+ -1.0 (/ y z))) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 0.065)) {
tmp = x * (-1.0 + (y / z));
} else {
tmp = (x / z) - x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1.0d0)) .or. (.not. (y <= 0.065d0))) then
tmp = x * ((-1.0d0) + (y / z))
else
tmp = (x / z) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 0.065)) {
tmp = x * (-1.0 + (y / z));
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.0) or not (y <= 0.065): tmp = x * (-1.0 + (y / z)) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.0) || !(y <= 0.065)) tmp = Float64(x * Float64(-1.0 + Float64(y / z))); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.0) || ~((y <= 0.065))) tmp = x * (-1.0 + (y / z)); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 0.065]], $MachinePrecision]], N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 0.065\right):\\
\;\;\;\;x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -1 or 0.065000000000000002 < y Initial program 90.0%
associate-/l*89.3%
+-commutative89.3%
associate-+r-89.3%
div-sub89.3%
*-inverses89.3%
sub-neg89.3%
metadata-eval89.3%
+-commutative89.3%
Simplified89.3%
Taylor expanded in y around inf 88.6%
if -1 < y < 0.065000000000000002Initial program 87.3%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
clear-num99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 99.3%
sub-neg99.3%
metadata-eval99.3%
distribute-rgt-in99.3%
associate-*l/99.5%
*-lft-identity99.5%
neg-mul-199.5%
unsub-neg99.5%
Simplified99.5%
Final simplification94.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.2e+47) (not (<= y 0.065))) (* y (/ x z)) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.2e+47) || !(y <= 0.065)) {
tmp = y * (x / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-5.2d+47)) .or. (.not. (y <= 0.065d0))) then
tmp = y * (x / z)
else
tmp = (x / z) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5.2e+47) || !(y <= 0.065)) {
tmp = y * (x / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5.2e+47) or not (y <= 0.065): tmp = y * (x / z) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5.2e+47) || !(y <= 0.065)) tmp = Float64(y * Float64(x / z)); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5.2e+47) || ~((y <= 0.065))) tmp = y * (x / z); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.2e+47], N[Not[LessEqual[y, 0.065]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+47} \lor \neg \left(y \leq 0.065\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -5.20000000000000007e47 or 0.065000000000000002 < y Initial program 89.9%
associate-/l*89.1%
+-commutative89.1%
associate-+r-89.1%
div-sub89.1%
*-inverses89.1%
sub-neg89.1%
metadata-eval89.1%
+-commutative89.1%
Simplified89.1%
Taylor expanded in y around inf 77.9%
*-commutative77.9%
associate-*r/78.4%
Simplified78.4%
if -5.20000000000000007e47 < y < 0.065000000000000002Initial program 87.5%
associate-/l*99.2%
+-commutative99.2%
associate-+r-99.2%
div-sub99.2%
*-inverses99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
clear-num99.2%
associate-/r/99.2%
Applied egg-rr99.2%
Taylor expanded in y around 0 97.4%
sub-neg97.4%
metadata-eval97.4%
distribute-rgt-in97.4%
associate-*l/97.5%
*-lft-identity97.5%
neg-mul-197.5%
unsub-neg97.5%
Simplified97.5%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (<= y -5.2e+53) (/ (* x y) z) (if (<= y 0.065) (- (/ x z) x) (* y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.2e+53) {
tmp = (x * y) / z;
} else if (y <= 0.065) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-5.2d+53)) then
tmp = (x * y) / z
else if (y <= 0.065d0) then
tmp = (x / z) - x
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.2e+53) {
tmp = (x * y) / z;
} else if (y <= 0.065) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.2e+53: tmp = (x * y) / z elif y <= 0.065: tmp = (x / z) - x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.2e+53) tmp = Float64(Float64(x * y) / z); elseif (y <= 0.065) tmp = Float64(Float64(x / z) - x); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.2e+53) tmp = (x * y) / z; elseif (y <= 0.065) tmp = (x / z) - x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.2e+53], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 0.065], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+53}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;y \leq 0.065:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -5.19999999999999996e53Initial program 95.4%
associate-/l*82.8%
+-commutative82.8%
associate-+r-82.8%
div-sub82.8%
*-inverses82.8%
sub-neg82.8%
metadata-eval82.8%
+-commutative82.8%
Simplified82.8%
Taylor expanded in y around inf 82.3%
if -5.19999999999999996e53 < y < 0.065000000000000002Initial program 87.5%
associate-/l*99.2%
+-commutative99.2%
associate-+r-99.2%
div-sub99.2%
*-inverses99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
clear-num99.2%
associate-/r/99.2%
Applied egg-rr99.2%
Taylor expanded in y around 0 97.4%
sub-neg97.4%
metadata-eval97.4%
distribute-rgt-in97.4%
associate-*l/97.5%
*-lft-identity97.5%
neg-mul-197.5%
unsub-neg97.5%
Simplified97.5%
if 0.065000000000000002 < y Initial program 86.0%
associate-/l*93.7%
+-commutative93.7%
associate-+r-93.7%
div-sub93.7%
*-inverses93.7%
sub-neg93.7%
metadata-eval93.7%
+-commutative93.7%
Simplified93.7%
Taylor expanded in y around inf 74.7%
*-commutative74.7%
associate-*r/77.0%
Simplified77.0%
(FPCore (x y z) :precision binary64 (if (<= x 2.1e-80) (/ (* x (+ (- y z) 1.0)) z) (* x (+ (/ (+ y 1.0) z) -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2.1e-80) {
tmp = (x * ((y - z) + 1.0)) / z;
} else {
tmp = x * (((y + 1.0) / z) + -1.0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 2.1d-80) then
tmp = (x * ((y - z) + 1.0d0)) / z
else
tmp = x * (((y + 1.0d0) / z) + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 2.1e-80) {
tmp = (x * ((y - z) + 1.0)) / z;
} else {
tmp = x * (((y + 1.0) / z) + -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 2.1e-80: tmp = (x * ((y - z) + 1.0)) / z else: tmp = x * (((y + 1.0) / z) + -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 2.1e-80) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z); else tmp = Float64(x * Float64(Float64(Float64(y + 1.0) / z) + -1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2.1e-80) tmp = (x * ((y - z) + 1.0)) / z; else tmp = x * (((y + 1.0) / z) + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 2.1e-80], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(x * N[(N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.1 \cdot 10^{-80}:\\
\;\;\;\;\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y + 1}{z} + -1\right)\\
\end{array}
\end{array}
if x < 2.10000000000000001e-80Initial program 93.3%
if 2.10000000000000001e-80 < x Initial program 76.1%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.155) (not (<= z 1.0))) (- x) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.155) || !(z <= 1.0)) {
tmp = -x;
} else {
tmp = x / z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.155d0)) .or. (.not. (z <= 1.0d0))) then
tmp = -x
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.155) || !(z <= 1.0)) {
tmp = -x;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.155) or not (z <= 1.0): tmp = -x else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.155) || !(z <= 1.0)) tmp = Float64(-x); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.155) || ~((z <= 1.0))) tmp = -x; else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.155], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], (-x), N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.155 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if z < -0.154999999999999999 or 1 < z Initial program 77.1%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 70.9%
neg-mul-170.9%
Simplified70.9%
if -0.154999999999999999 < z < 1Initial program 99.9%
Taylor expanded in y around 0 63.8%
associate-/l*63.6%
Simplified63.6%
Taylor expanded in z around 0 62.7%
Final simplification66.8%
(FPCore (x y z) :precision binary64 (- x))
double code(double x, double y, double z) {
return -x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -x
end function
public static double code(double x, double y, double z) {
return -x;
}
def code(x, y, z): return -x
function code(x, y, z) return Float64(-x) end
function tmp = code(x, y, z) tmp = -x; end
code[x_, y_, z_] := (-x)
\begin{array}{l}
\\
-x
\end{array}
Initial program 88.5%
associate-/l*95.1%
+-commutative95.1%
associate-+r-95.1%
div-sub95.1%
*-inverses95.1%
sub-neg95.1%
metadata-eval95.1%
+-commutative95.1%
Simplified95.1%
Taylor expanded in z around inf 37.0%
neg-mul-137.0%
Simplified37.0%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 88.5%
associate-/l*95.1%
+-commutative95.1%
associate-+r-95.1%
div-sub95.1%
*-inverses95.1%
sub-neg95.1%
metadata-eval95.1%
+-commutative95.1%
Simplified95.1%
Taylor expanded in z around inf 37.0%
neg-mul-137.0%
Simplified37.0%
neg-sub037.0%
sub-neg37.0%
add-sqr-sqrt18.0%
sqrt-unprod16.2%
sqr-neg16.2%
sqrt-unprod1.5%
add-sqr-sqrt3.1%
Applied egg-rr3.1%
+-lft-identity3.1%
Simplified3.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (+ 1.0 y) (/ x z)) x)))
(if (< x -2.71483106713436e-162)
t_0
(if (< x 3.874108816439546e-197)
(* (* x (+ (- y z) 1.0)) (/ 1.0 z))
t_0))))
double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = ((1.0d0 + y) * (x / z)) - x
if (x < (-2.71483106713436d-162)) then
tmp = t_0
else if (x < 3.874108816439546d-197) then
tmp = (x * ((y - z) + 1.0d0)) * (1.0d0 / z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((1.0 + y) * (x / z)) - x tmp = 0 if x < -2.71483106713436e-162: tmp = t_0 elif x < 3.874108816439546e-197: tmp = (x * ((y - z) + 1.0)) * (1.0 / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(1.0 + y) * Float64(x / z)) - x) tmp = 0.0 if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) * Float64(1.0 / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((1.0 + y) * (x / z)) - x; tmp = 0.0; if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = (x * ((y - z) + 1.0)) * (1.0 / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]}, If[Less[x, -2.71483106713436e-162], t$95$0, If[Less[x, 3.874108816439546e-197], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + y\right) \cdot \frac{x}{z} - x\\
\mathbf{if}\;x < -2.71483106713436 \cdot 10^{-162}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x < 3.874108816439546 \cdot 10^{-197}:\\
\;\;\;\;\left(x \cdot \left(\left(y - z\right) + 1\right)\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024145
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:alt
(! :herbie-platform default (if (< x -67870776678359/25000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (+ 1 y) (/ x z)) x) (if (< x 1937054408219773/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (* x (+ (- y z) 1)) (/ 1 z)) (- (* (+ 1 y) (/ x z)) x))))
(/ (* x (+ (- y z) 1.0)) z))