
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - 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 = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - 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 = (x * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
(FPCore (x y z t) :precision binary64 (* (/ (- y z) (- t z)) x))
double code(double x, double y, double z, double t) {
return ((y - z) / (t - z)) * x;
}
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 - z)) * x
end function
public static double code(double x, double y, double z, double t) {
return ((y - z) / (t - z)) * x;
}
def code(x, y, z, t): return ((y - z) / (t - z)) * x
function code(x, y, z, t) return Float64(Float64(Float64(y - z) / Float64(t - z)) * x) end
function tmp = code(x, y, z, t) tmp = ((y - z) / (t - z)) * x; end
code[x_, y_, z_, t_] := N[(N[(N[(y - z), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y - z}{t - z} \cdot x
\end{array}
Initial program 82.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6497.1
Applied rewrites97.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -2.7e-7)
(fma (- x) (/ y z) x)
(if (<= z 1.7e-266)
(/ (* (- y z) x) t)
(if (<= z 9.5e+32) (* (/ x (- t z)) y) (* (/ (- z y) z) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.7e-7) {
tmp = fma(-x, (y / z), x);
} else if (z <= 1.7e-266) {
tmp = ((y - z) * x) / t;
} else if (z <= 9.5e+32) {
tmp = (x / (t - z)) * y;
} else {
tmp = ((z - y) / z) * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -2.7e-7) tmp = fma(Float64(-x), Float64(y / z), x); elseif (z <= 1.7e-266) tmp = Float64(Float64(Float64(y - z) * x) / t); elseif (z <= 9.5e+32) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = Float64(Float64(Float64(z - y) / z) * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.7e-7], N[((-x) * N[(y / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.7e-266], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 9.5e+32], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{y}{z}, x\right)\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-266}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+32}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\end{array}
\end{array}
if z < -2.70000000000000009e-7Initial program 68.0%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6479.5
Applied rewrites79.5%
Taylor expanded in y around inf
Applied rewrites15.5%
Taylor expanded in y around 0
Applied rewrites79.5%
if -2.70000000000000009e-7 < z < 1.69999999999999997e-266Initial program 95.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.6
Applied rewrites96.6%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6490.2
Applied rewrites90.2%
if 1.69999999999999997e-266 < z < 9.50000000000000006e32Initial program 91.2%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6475.9
Applied rewrites75.9%
if 9.50000000000000006e32 < z Initial program 74.1%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6471.7
Applied rewrites71.7%
Taylor expanded in y around inf
Applied rewrites16.1%
Taylor expanded in z around 0
Applied rewrites71.7%
Final simplification79.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (- x) (/ y z) x)))
(if (<= z -2.7e-7)
t_1
(if (<= z 1.7e-266)
(/ (* (- y z) x) t)
(if (<= z 9.5e+32) (* (/ x (- t z)) y) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = fma(-x, (y / z), x);
double tmp;
if (z <= -2.7e-7) {
tmp = t_1;
} else if (z <= 1.7e-266) {
tmp = ((y - z) * x) / t;
} else if (z <= 9.5e+32) {
tmp = (x / (t - z)) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(-x), Float64(y / z), x) tmp = 0.0 if (z <= -2.7e-7) tmp = t_1; elseif (z <= 1.7e-266) tmp = Float64(Float64(Float64(y - z) * x) / t); elseif (z <= 9.5e+32) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-x) * N[(y / z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -2.7e-7], t$95$1, If[LessEqual[z, 1.7e-266], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 9.5e+32], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(-x, \frac{y}{z}, x\right)\\
\mathbf{if}\;z \leq -2.7 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-266}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{+32}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.70000000000000009e-7 or 9.50000000000000006e32 < z Initial program 70.7%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6476.0
Applied rewrites76.0%
Taylor expanded in y around inf
Applied rewrites15.8%
Taylor expanded in y around 0
Applied rewrites76.0%
if -2.70000000000000009e-7 < z < 1.69999999999999997e-266Initial program 95.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.6
Applied rewrites96.6%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6490.2
Applied rewrites90.2%
if 1.69999999999999997e-266 < z < 9.50000000000000006e32Initial program 91.2%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6475.9
Applied rewrites75.9%
Final simplification79.3%
(FPCore (x y z t) :precision binary64 (if (<= z -2.9e+171) (* (/ z (- t z)) (- x)) (if (<= z 2.2e+181) (* (/ x (- t z)) (- y z)) (- x (* (/ x z) (- y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.9e+171) {
tmp = (z / (t - z)) * -x;
} else if (z <= 2.2e+181) {
tmp = (x / (t - z)) * (y - z);
} else {
tmp = x - ((x / z) * (y - 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 (z <= (-2.9d+171)) then
tmp = (z / (t - z)) * -x
else if (z <= 2.2d+181) then
tmp = (x / (t - z)) * (y - z)
else
tmp = x - ((x / z) * (y - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.9e+171) {
tmp = (z / (t - z)) * -x;
} else if (z <= 2.2e+181) {
tmp = (x / (t - z)) * (y - z);
} else {
tmp = x - ((x / z) * (y - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.9e+171: tmp = (z / (t - z)) * -x elif z <= 2.2e+181: tmp = (x / (t - z)) * (y - z) else: tmp = x - ((x / z) * (y - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.9e+171) tmp = Float64(Float64(z / Float64(t - z)) * Float64(-x)); elseif (z <= 2.2e+181) tmp = Float64(Float64(x / Float64(t - z)) * Float64(y - z)); else tmp = Float64(x - Float64(Float64(x / z) * Float64(y - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.9e+171) tmp = (z / (t - z)) * -x; elseif (z <= 2.2e+181) tmp = (x / (t - z)) * (y - z); else tmp = x - ((x / z) * (y - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.9e+171], N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[z, 2.2e+181], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(x / z), $MachinePrecision] * N[(y - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+171}:\\
\;\;\;\;\frac{z}{t - z} \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+181}:\\
\;\;\;\;\frac{x}{t - z} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{x}{z} \cdot \left(y - t\right)\\
\end{array}
\end{array}
if z < -2.89999999999999985e171Initial program 66.3%
Taylor expanded in y around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6499.8
Applied rewrites99.8%
if -2.89999999999999985e171 < z < 2.2000000000000001e181Initial program 87.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
if 2.2000000000000001e181 < z Initial program 58.5%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
*-commutativeN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6492.2
Applied rewrites92.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.1e+34) (not (<= z 1.9e+38))) (* (/ z (- t z)) (- x)) (/ (* y x) (- t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.1e+34) || !(z <= 1.9e+38)) {
tmp = (z / (t - z)) * -x;
} else {
tmp = (y * x) / (t - z);
}
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 ((z <= (-5.1d+34)) .or. (.not. (z <= 1.9d+38))) then
tmp = (z / (t - z)) * -x
else
tmp = (y * x) / (t - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.1e+34) || !(z <= 1.9e+38)) {
tmp = (z / (t - z)) * -x;
} else {
tmp = (y * x) / (t - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.1e+34) or not (z <= 1.9e+38): tmp = (z / (t - z)) * -x else: tmp = (y * x) / (t - z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.1e+34) || !(z <= 1.9e+38)) tmp = Float64(Float64(z / Float64(t - z)) * Float64(-x)); else tmp = Float64(Float64(y * x) / Float64(t - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.1e+34) || ~((z <= 1.9e+38))) tmp = (z / (t - z)) * -x; else tmp = (y * x) / (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.1e+34], N[Not[LessEqual[z, 1.9e+38]], $MachinePrecision]], N[(N[(z / N[(t - z), $MachinePrecision]), $MachinePrecision] * (-x)), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.1 \cdot 10^{+34} \lor \neg \left(z \leq 1.9 \cdot 10^{+38}\right):\\
\;\;\;\;\frac{z}{t - z} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{t - z}\\
\end{array}
\end{array}
if z < -5.10000000000000036e34 or 1.8999999999999999e38 < z Initial program 69.0%
Taylor expanded in y around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6483.7
Applied rewrites83.7%
if -5.10000000000000036e34 < z < 1.8999999999999999e38Initial program 92.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f6492.8
Applied rewrites92.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6477.7
Applied rewrites77.7%
Final simplification80.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.7e-7) (not (<= z 9.5e+32))) (fma (- x) (/ y z) x) (/ (* (- y z) x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.7e-7) || !(z <= 9.5e+32)) {
tmp = fma(-x, (y / z), x);
} else {
tmp = ((y - z) * x) / t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.7e-7) || !(z <= 9.5e+32)) tmp = fma(Float64(-x), Float64(y / z), x); else tmp = Float64(Float64(Float64(y - z) * x) / t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.7e-7], N[Not[LessEqual[z, 9.5e+32]], $MachinePrecision]], N[((-x) * N[(y / z), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-7} \lor \neg \left(z \leq 9.5 \cdot 10^{+32}\right):\\
\;\;\;\;\mathsf{fma}\left(-x, \frac{y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\end{array}
\end{array}
if z < -2.70000000000000009e-7 or 9.50000000000000006e32 < z Initial program 70.7%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6476.0
Applied rewrites76.0%
Taylor expanded in y around inf
Applied rewrites15.8%
Taylor expanded in y around 0
Applied rewrites76.0%
if -2.70000000000000009e-7 < z < 9.50000000000000006e32Initial program 92.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6478.5
Applied rewrites78.5%
Final simplification77.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.2e+35) (not (<= z 1.22e+114))) (* 1.0 x) (/ (* (- y z) x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e+35) || !(z <= 1.22e+114)) {
tmp = 1.0 * x;
} else {
tmp = ((y - z) * x) / 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 ((z <= (-5.2d+35)) .or. (.not. (z <= 1.22d+114))) then
tmp = 1.0d0 * x
else
tmp = ((y - z) * x) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.2e+35) || !(z <= 1.22e+114)) {
tmp = 1.0 * x;
} else {
tmp = ((y - z) * x) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.2e+35) or not (z <= 1.22e+114): tmp = 1.0 * x else: tmp = ((y - z) * x) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.2e+35) || !(z <= 1.22e+114)) tmp = Float64(1.0 * x); else tmp = Float64(Float64(Float64(y - z) * x) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.2e+35) || ~((z <= 1.22e+114))) tmp = 1.0 * x; else tmp = ((y - z) * x) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.2e+35], N[Not[LessEqual[z, 1.22e+114]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+35} \lor \neg \left(z \leq 1.22 \cdot 10^{+114}\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\end{array}
\end{array}
if z < -5.20000000000000013e35 or 1.21999999999999999e114 < z Initial program 65.1%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6481.7
Applied rewrites81.7%
Taylor expanded in y around 0
Applied rewrites73.0%
if -5.20000000000000013e35 < z < 1.21999999999999999e114Initial program 92.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.4
Applied rewrites95.4%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6472.5
Applied rewrites72.5%
Final simplification72.7%
(FPCore (x y z t) :precision binary64 (if (<= z -2.7e-7) (- x (/ (* x y) z)) (if (<= z 1.22e+114) (/ (* (- y z) x) t) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.7e-7) {
tmp = x - ((x * y) / z);
} else if (z <= 1.22e+114) {
tmp = ((y - z) * x) / t;
} else {
tmp = 1.0 * x;
}
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 (z <= (-2.7d-7)) then
tmp = x - ((x * y) / z)
else if (z <= 1.22d+114) then
tmp = ((y - z) * x) / t
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.7e-7) {
tmp = x - ((x * y) / z);
} else if (z <= 1.22e+114) {
tmp = ((y - z) * x) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.7e-7: tmp = x - ((x * y) / z) elif z <= 1.22e+114: tmp = ((y - z) * x) / t else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.7e-7) tmp = Float64(x - Float64(Float64(x * y) / z)); elseif (z <= 1.22e+114) tmp = Float64(Float64(Float64(y - z) * x) / t); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.7e-7) tmp = x - ((x * y) / z); elseif (z <= 1.22e+114) tmp = ((y - z) * x) / t; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.7e-7], N[(x - N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.22e+114], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-7}:\\
\;\;\;\;x - \frac{x \cdot y}{z}\\
\mathbf{elif}\;z \leq 1.22 \cdot 10^{+114}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -2.70000000000000009e-7Initial program 68.0%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6479.5
Applied rewrites79.5%
Taylor expanded in y around 0
Applied rewrites73.7%
if -2.70000000000000009e-7 < z < 1.21999999999999999e114Initial program 92.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6495.2
Applied rewrites95.2%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6474.6
Applied rewrites74.6%
if 1.21999999999999999e114 < z Initial program 65.7%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6480.8
Applied rewrites80.8%
Taylor expanded in y around 0
Applied rewrites70.8%
Final simplification73.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.6e+34) (not (<= z 9e+32))) (* 1.0 x) (* (/ y t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.6e+34) || !(z <= 9e+32)) {
tmp = 1.0 * x;
} else {
tmp = (y / t) * x;
}
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 ((z <= (-4.6d+34)) .or. (.not. (z <= 9d+32))) then
tmp = 1.0d0 * x
else
tmp = (y / t) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.6e+34) || !(z <= 9e+32)) {
tmp = 1.0 * x;
} else {
tmp = (y / t) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.6e+34) or not (z <= 9e+32): tmp = 1.0 * x else: tmp = (y / t) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.6e+34) || !(z <= 9e+32)) tmp = Float64(1.0 * x); else tmp = Float64(Float64(y / t) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.6e+34) || ~((z <= 9e+32))) tmp = 1.0 * x; else tmp = (y / t) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.6e+34], N[Not[LessEqual[z, 9e+32]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{+34} \lor \neg \left(z \leq 9 \cdot 10^{+32}\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\end{array}
\end{array}
if z < -4.5999999999999996e34 or 9.0000000000000007e32 < z Initial program 69.2%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6477.2
Applied rewrites77.2%
Taylor expanded in y around 0
Applied rewrites66.6%
if -4.5999999999999996e34 < z < 9.0000000000000007e32Initial program 92.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6494.8
Applied rewrites94.8%
Taylor expanded in z around 0
lower-/.f6467.4
Applied rewrites67.4%
Final simplification67.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.3e+34) (not (<= z 8.8e+32))) (* 1.0 x) (/ (* y x) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.3e+34) || !(z <= 8.8e+32)) {
tmp = 1.0 * x;
} else {
tmp = (y * x) / 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 ((z <= (-3.3d+34)) .or. (.not. (z <= 8.8d+32))) then
tmp = 1.0d0 * x
else
tmp = (y * x) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.3e+34) || !(z <= 8.8e+32)) {
tmp = 1.0 * x;
} else {
tmp = (y * x) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.3e+34) or not (z <= 8.8e+32): tmp = 1.0 * x else: tmp = (y * x) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.3e+34) || !(z <= 8.8e+32)) tmp = Float64(1.0 * x); else tmp = Float64(Float64(y * x) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.3e+34) || ~((z <= 8.8e+32))) tmp = 1.0 * x; else tmp = (y * x) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.3e+34], N[Not[LessEqual[z, 8.8e+32]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+34} \lor \neg \left(z \leq 8.8 \cdot 10^{+32}\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{t}\\
\end{array}
\end{array}
if z < -3.29999999999999988e34 or 8.80000000000000004e32 < z Initial program 69.2%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6477.2
Applied rewrites77.2%
Taylor expanded in y around 0
Applied rewrites66.6%
if -3.29999999999999988e34 < z < 8.80000000000000004e32Initial program 92.7%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.4
Applied rewrites65.4%
Final simplification65.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.4e+34) (not (<= z 9e+32))) (* 1.0 x) (* (/ x t) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.4e+34) || !(z <= 9e+32)) {
tmp = 1.0 * x;
} else {
tmp = (x / t) * y;
}
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 ((z <= (-4.4d+34)) .or. (.not. (z <= 9d+32))) then
tmp = 1.0d0 * x
else
tmp = (x / t) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.4e+34) || !(z <= 9e+32)) {
tmp = 1.0 * x;
} else {
tmp = (x / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.4e+34) or not (z <= 9e+32): tmp = 1.0 * x else: tmp = (x / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.4e+34) || !(z <= 9e+32)) tmp = Float64(1.0 * x); else tmp = Float64(Float64(x / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.4e+34) || ~((z <= 9e+32))) tmp = 1.0 * x; else tmp = (x / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.4e+34], N[Not[LessEqual[z, 9e+32]], $MachinePrecision]], N[(1.0 * x), $MachinePrecision], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+34} \lor \neg \left(z \leq 9 \cdot 10^{+32}\right):\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\end{array}
\end{array}
if z < -4.4000000000000005e34 or 9.0000000000000007e32 < z Initial program 69.2%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6477.2
Applied rewrites77.2%
Taylor expanded in y around 0
Applied rewrites66.6%
if -4.4000000000000005e34 < z < 9.0000000000000007e32Initial program 92.7%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.4
Applied rewrites65.4%
Applied rewrites62.6%
Final simplification64.3%
(FPCore (x y z t) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t) {
return 1.0 * x;
}
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 = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t) {
return 1.0 * x;
}
def code(x, y, z, t): return 1.0 * x
function code(x, y, z, t) return Float64(1.0 * x) end
function tmp = code(x, y, z, t) tmp = 1.0 * x; end
code[x_, y_, z_, t_] := N[(1.0 * x), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 82.3%
Taylor expanded in t around 0
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-lft-identityN/A
lower--.f6449.6
Applied rewrites49.6%
Taylor expanded in y around 0
Applied rewrites34.7%
(FPCore (x y z t) :precision binary64 (/ x (/ (- t z) (- y z))))
double code(double x, double y, double z, double t) {
return x / ((t - z) / (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 = x / ((t - z) / (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
def code(x, y, z, t): return x / ((t - z) / (y - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(t - z) / Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x / ((t - z) / (y - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{t - z}{y - z}}
\end{array}
herbie shell --seed 2024337
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (/ x (/ (- t z) (- y z))))
(/ (* x (- y z)) (- t z)))