
(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 14 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 (* x (/ (- z y) (- z t))))
double code(double x, double y, double z, double t) {
return x * ((z - 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 * ((z - y) / (z - t))
end function
public static double code(double x, double y, double z, double t) {
return x * ((z - y) / (z - t));
}
def code(x, y, z, t): return x * ((z - y) / (z - t))
function code(x, y, z, t) return Float64(x * Float64(Float64(z - y) / Float64(z - t))) end
function tmp = code(x, y, z, t) tmp = x * ((z - y) / (z - t)); end
code[x_, y_, z_, t_] := N[(x * N[(N[(z - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{z - y}{z - t}
\end{array}
Initial program 83.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
Final simplification96.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z (- z t)) x)))
(if (<= z -7.6e+158)
(* (/ (- z y) z) x)
(if (<= z -7.8e-8) t_1 (if (<= z 3.5e-92) (/ (* x y) (- t z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (z / (z - t)) * x;
double tmp;
if (z <= -7.6e+158) {
tmp = ((z - y) / z) * x;
} else if (z <= -7.8e-8) {
tmp = t_1;
} else if (z <= 3.5e-92) {
tmp = (x * y) / (t - z);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (z / (z - t)) * x
if (z <= (-7.6d+158)) then
tmp = ((z - y) / z) * x
else if (z <= (-7.8d-8)) then
tmp = t_1
else if (z <= 3.5d-92) then
tmp = (x * y) / (t - z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z / (z - t)) * x;
double tmp;
if (z <= -7.6e+158) {
tmp = ((z - y) / z) * x;
} else if (z <= -7.8e-8) {
tmp = t_1;
} else if (z <= 3.5e-92) {
tmp = (x * y) / (t - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / (z - t)) * x tmp = 0 if z <= -7.6e+158: tmp = ((z - y) / z) * x elif z <= -7.8e-8: tmp = t_1 elif z <= 3.5e-92: tmp = (x * y) / (t - z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / Float64(z - t)) * x) tmp = 0.0 if (z <= -7.6e+158) tmp = Float64(Float64(Float64(z - y) / z) * x); elseif (z <= -7.8e-8) tmp = t_1; elseif (z <= 3.5e-92) tmp = Float64(Float64(x * y) / Float64(t - z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / (z - t)) * x; tmp = 0.0; if (z <= -7.6e+158) tmp = ((z - y) / z) * x; elseif (z <= -7.8e-8) tmp = t_1; elseif (z <= 3.5e-92) tmp = (x * y) / (t - z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -7.6e+158], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -7.8e-8], t$95$1, If[LessEqual[z, 3.5e-92], N[(N[(x * y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{z - t} \cdot x\\
\mathbf{if}\;z \leq -7.6 \cdot 10^{+158}:\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\mathbf{elif}\;z \leq -7.8 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-92}:\\
\;\;\;\;\frac{x \cdot y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.5999999999999997e158Initial program 58.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
associate-*r/N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
div-addN/A
neg-mul-1N/A
remove-double-negN/A
*-inversesN/A
associate-*r/N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6496.8
Applied rewrites96.8%
Taylor expanded in t around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lower-neg.f6496.8
Applied rewrites96.8%
if -7.5999999999999997e158 < z < -7.7999999999999997e-8 or 3.5e-92 < z Initial program 83.5%
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.f6479.7
Applied rewrites79.7%
if -7.7999999999999997e-8 < z < 3.5e-92Initial program 92.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6482.0
Applied rewrites82.0%
Final simplification82.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z (- z t)) x)))
(if (<= z -7.6e+158)
(fma (/ y (- z)) x x)
(if (<= z -7.8e-8) t_1 (if (<= z 3.5e-92) (/ (* x y) (- t z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (z / (z - t)) * x;
double tmp;
if (z <= -7.6e+158) {
tmp = fma((y / -z), x, x);
} else if (z <= -7.8e-8) {
tmp = t_1;
} else if (z <= 3.5e-92) {
tmp = (x * y) / (t - z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(z / Float64(z - t)) * x) tmp = 0.0 if (z <= -7.6e+158) tmp = fma(Float64(y / Float64(-z)), x, x); elseif (z <= -7.8e-8) tmp = t_1; elseif (z <= 3.5e-92) tmp = Float64(Float64(x * y) / Float64(t - z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -7.6e+158], N[(N[(y / (-z)), $MachinePrecision] * x + x), $MachinePrecision], If[LessEqual[z, -7.8e-8], t$95$1, If[LessEqual[z, 3.5e-92], N[(N[(x * y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{z - t} \cdot x\\
\mathbf{if}\;z \leq -7.6 \cdot 10^{+158}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-z}, x, x\right)\\
\mathbf{elif}\;z \leq -7.8 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-92}:\\
\;\;\;\;\frac{x \cdot y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.5999999999999997e158Initial program 58.1%
Taylor expanded in t around 0
associate-/l*N/A
associate-*r*N/A
sub-negN/A
mul-1-negN/A
div-addN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-frac-negN/A
*-inversesN/A
metadata-evalN/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6496.8
Applied rewrites96.8%
if -7.5999999999999997e158 < z < -7.7999999999999997e-8 or 3.5e-92 < z Initial program 83.5%
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.f6479.7
Applied rewrites79.7%
if -7.7999999999999997e-8 < z < 3.5e-92Initial program 92.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6482.0
Applied rewrites82.0%
Final simplification82.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma (/ y (- z)) x x)))
(if (<= z -4.4e-5)
t_1
(if (<= z 1.7e-254)
(/ (* x y) (- t z))
(if (<= z 370000000000.0) (* (/ (- y z) t) x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = fma((y / -z), x, x);
double tmp;
if (z <= -4.4e-5) {
tmp = t_1;
} else if (z <= 1.7e-254) {
tmp = (x * y) / (t - z);
} else if (z <= 370000000000.0) {
tmp = ((y - z) / t) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(y / Float64(-z)), x, x) tmp = 0.0 if (z <= -4.4e-5) tmp = t_1; elseif (z <= 1.7e-254) tmp = Float64(Float64(x * y) / Float64(t - z)); elseif (z <= 370000000000.0) tmp = Float64(Float64(Float64(y - z) / t) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / (-z)), $MachinePrecision] * x + x), $MachinePrecision]}, If[LessEqual[z, -4.4e-5], t$95$1, If[LessEqual[z, 1.7e-254], N[(N[(x * y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 370000000000.0], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{-z}, x, x\right)\\
\mathbf{if}\;z \leq -4.4 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-254}:\\
\;\;\;\;\frac{x \cdot y}{t - z}\\
\mathbf{elif}\;z \leq 370000000000:\\
\;\;\;\;\frac{y - z}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.3999999999999999e-5 or 3.7e11 < z Initial program 75.2%
Taylor expanded in t around 0
associate-/l*N/A
associate-*r*N/A
sub-negN/A
mul-1-negN/A
div-addN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-frac-negN/A
*-inversesN/A
metadata-evalN/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6478.0
Applied rewrites78.0%
if -4.3999999999999999e-5 < z < 1.69999999999999996e-254Initial program 95.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6485.1
Applied rewrites85.1%
if 1.69999999999999996e-254 < z < 3.7e11Initial program 88.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6494.4
Applied rewrites94.4%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6476.7
Applied rewrites76.7%
Final simplification79.7%
(FPCore (x y z t) :precision binary64 (if (<= z -1.55e+120) (* (/ (- z y) z) x) (if (<= z 7.5e+109) (* (/ x (- z t)) (- z y)) (* (/ z (- z t)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.55e+120) {
tmp = ((z - y) / z) * x;
} else if (z <= 7.5e+109) {
tmp = (x / (z - t)) * (z - y);
} else {
tmp = (z / (z - 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 <= (-1.55d+120)) then
tmp = ((z - y) / z) * x
else if (z <= 7.5d+109) then
tmp = (x / (z - t)) * (z - y)
else
tmp = (z / (z - t)) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.55e+120) {
tmp = ((z - y) / z) * x;
} else if (z <= 7.5e+109) {
tmp = (x / (z - t)) * (z - y);
} else {
tmp = (z / (z - t)) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.55e+120: tmp = ((z - y) / z) * x elif z <= 7.5e+109: tmp = (x / (z - t)) * (z - y) else: tmp = (z / (z - t)) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.55e+120) tmp = Float64(Float64(Float64(z - y) / z) * x); elseif (z <= 7.5e+109) tmp = Float64(Float64(x / Float64(z - t)) * Float64(z - y)); else tmp = Float64(Float64(z / Float64(z - t)) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.55e+120) tmp = ((z - y) / z) * x; elseif (z <= 7.5e+109) tmp = (x / (z - t)) * (z - y); else tmp = (z / (z - t)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.55e+120], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 7.5e+109], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+120}:\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+109}:\\
\;\;\;\;\frac{x}{z - t} \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\end{array}
\end{array}
if z < -1.54999999999999987e120Initial program 61.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
associate-*r/N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
div-addN/A
neg-mul-1N/A
remove-double-negN/A
*-inversesN/A
associate-*r/N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6495.0
Applied rewrites95.0%
Taylor expanded in t around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lower-neg.f6495.0
Applied rewrites95.0%
if -1.54999999999999987e120 < z < 7.50000000000000018e109Initial program 93.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.8
Applied rewrites90.8%
if 7.50000000000000018e109 < z Initial program 70.4%
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.f6492.2
Applied rewrites92.2%
Final simplification91.8%
(FPCore (x y z t) :precision binary64 (if (<= t -1.6e+68) (* (/ (- y z) t) x) (if (<= t 1.5e+56) (fma (/ y (- z)) x x) (* (/ x t) (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.6e+68) {
tmp = ((y - z) / t) * x;
} else if (t <= 1.5e+56) {
tmp = fma((y / -z), x, x);
} else {
tmp = (x / t) * (y - z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= -1.6e+68) tmp = Float64(Float64(Float64(y - z) / t) * x); elseif (t <= 1.5e+56) tmp = fma(Float64(y / Float64(-z)), x, x); else tmp = Float64(Float64(x / t) * Float64(y - z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.6e+68], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 1.5e+56], N[(N[(y / (-z)), $MachinePrecision] * x + x), $MachinePrecision], N[(N[(x / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{+68}:\\
\;\;\;\;\frac{y - z}{t} \cdot x\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{+56}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-z}, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if t < -1.59999999999999997e68Initial program 83.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.2
Applied rewrites96.2%
Taylor expanded in t around inf
lower-/.f64N/A
lower--.f6479.9
Applied rewrites79.9%
if -1.59999999999999997e68 < t < 1.50000000000000003e56Initial program 84.6%
Taylor expanded in t around 0
associate-/l*N/A
associate-*r*N/A
sub-negN/A
mul-1-negN/A
div-addN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-frac-negN/A
*-inversesN/A
metadata-evalN/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6477.7
Applied rewrites77.7%
if 1.50000000000000003e56 < t Initial program 80.7%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6469.9
Applied rewrites69.9%
Applied rewrites76.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma (/ y (- z)) x x))) (if (<= z -4.5e-5) t_1 (if (<= z 1.6e-34) (/ (* x (- y z)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma((y / -z), x, x);
double tmp;
if (z <= -4.5e-5) {
tmp = t_1;
} else if (z <= 1.6e-34) {
tmp = (x * (y - z)) / t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(Float64(y / Float64(-z)), x, x) tmp = 0.0 if (z <= -4.5e-5) tmp = t_1; elseif (z <= 1.6e-34) tmp = Float64(Float64(x * Float64(y - z)) / t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / (-z)), $MachinePrecision] * x + x), $MachinePrecision]}, If[LessEqual[z, -4.5e-5], t$95$1, If[LessEqual[z, 1.6e-34], N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{-z}, x, x\right)\\
\mathbf{if}\;z \leq -4.5 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-34}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.50000000000000028e-5 or 1.60000000000000001e-34 < z Initial program 76.4%
Taylor expanded in t around 0
associate-/l*N/A
associate-*r*N/A
sub-negN/A
mul-1-negN/A
div-addN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-frac-negN/A
*-inversesN/A
metadata-evalN/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6476.4
Applied rewrites76.4%
if -4.50000000000000028e-5 < z < 1.60000000000000001e-34Initial program 93.0%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6478.8
Applied rewrites78.8%
Final simplification77.4%
(FPCore (x y z t) :precision binary64 (if (<= z -2.7e+101) (* 1.0 x) (if (<= z 14200000000.0) (/ (* x (- y z)) t) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.7e+101) {
tmp = 1.0 * x;
} else if (z <= 14200000000.0) {
tmp = (x * (y - z)) / 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+101)) then
tmp = 1.0d0 * x
else if (z <= 14200000000.0d0) then
tmp = (x * (y - z)) / 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+101) {
tmp = 1.0 * x;
} else if (z <= 14200000000.0) {
tmp = (x * (y - z)) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.7e+101: tmp = 1.0 * x elif z <= 14200000000.0: tmp = (x * (y - z)) / t else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.7e+101) tmp = Float64(1.0 * x); elseif (z <= 14200000000.0) tmp = Float64(Float64(x * Float64(y - z)) / 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+101) tmp = 1.0 * x; elseif (z <= 14200000000.0) tmp = (x * (y - z)) / t; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.7e+101], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 14200000000.0], N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+101}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 14200000000:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -2.70000000000000006e101 or 1.42e10 < z Initial program 71.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites68.8%
if -2.70000000000000006e101 < z < 1.42e10Initial program 94.2%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6473.9
Applied rewrites73.9%
Final simplification71.5%
(FPCore (x y z t) :precision binary64 (if (<= z -0.01) (* 1.0 x) (if (<= z 5.5e+102) (* (/ y (- t z)) x) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.01) {
tmp = 1.0 * x;
} else if (z <= 5.5e+102) {
tmp = (y / (t - z)) * x;
} 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 <= (-0.01d0)) then
tmp = 1.0d0 * x
else if (z <= 5.5d+102) then
tmp = (y / (t - z)) * x
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 <= -0.01) {
tmp = 1.0 * x;
} else if (z <= 5.5e+102) {
tmp = (y / (t - z)) * x;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.01: tmp = 1.0 * x elif z <= 5.5e+102: tmp = (y / (t - z)) * x else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.01) tmp = Float64(1.0 * x); elseif (z <= 5.5e+102) tmp = Float64(Float64(y / Float64(t - z)) * x); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.01) tmp = 1.0 * x; elseif (z <= 5.5e+102) tmp = (y / (t - z)) * x; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.01], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 5.5e+102], N[(N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.01:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+102}:\\
\;\;\;\;\frac{y}{t - z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -0.0100000000000000002 or 5.49999999999999981e102 < z Initial program 71.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites71.7%
if -0.0100000000000000002 < z < 5.49999999999999981e102Initial program 92.3%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6471.1
Applied rewrites71.1%
(FPCore (x y z t) :precision binary64 (if (<= z -0.01) (* 1.0 x) (if (<= z 9.8e+33) (* (/ x (- t z)) y) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.01) {
tmp = 1.0 * x;
} else if (z <= 9.8e+33) {
tmp = (x / (t - z)) * y;
} 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 <= (-0.01d0)) then
tmp = 1.0d0 * x
else if (z <= 9.8d+33) then
tmp = (x / (t - z)) * y
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 <= -0.01) {
tmp = 1.0 * x;
} else if (z <= 9.8e+33) {
tmp = (x / (t - z)) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.01: tmp = 1.0 * x elif z <= 9.8e+33: tmp = (x / (t - z)) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.01) tmp = Float64(1.0 * x); elseif (z <= 9.8e+33) tmp = Float64(Float64(x / Float64(t - z)) * y); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.01) tmp = 1.0 * x; elseif (z <= 9.8e+33) tmp = (x / (t - z)) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.01], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 9.8e+33], N[(N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.01:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{+33}:\\
\;\;\;\;\frac{x}{t - z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -0.0100000000000000002 or 9.80000000000000027e33 < z Initial program 74.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites66.7%
if -0.0100000000000000002 < z < 9.80000000000000027e33Initial program 93.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.0
Applied rewrites93.0%
Taylor expanded in y around inf
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6475.3
Applied rewrites75.3%
(FPCore (x y z t) :precision binary64 (if (<= z -0.00016) (* 1.0 x) (if (<= z 8.6e+33) (* (/ y t) x) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00016) {
tmp = 1.0 * x;
} else if (z <= 8.6e+33) {
tmp = (y / t) * x;
} 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 <= (-0.00016d0)) then
tmp = 1.0d0 * x
else if (z <= 8.6d+33) then
tmp = (y / t) * x
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 <= -0.00016) {
tmp = 1.0 * x;
} else if (z <= 8.6e+33) {
tmp = (y / t) * x;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.00016: tmp = 1.0 * x elif z <= 8.6e+33: tmp = (y / t) * x else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.00016) tmp = Float64(1.0 * x); elseif (z <= 8.6e+33) tmp = Float64(Float64(y / t) * x); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.00016) tmp = 1.0 * x; elseif (z <= 8.6e+33) tmp = (y / t) * x; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.00016], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 8.6e+33], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00016:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+33}:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -1.60000000000000013e-4 or 8.60000000000000057e33 < z Initial program 74.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites66.7%
if -1.60000000000000013e-4 < z < 8.60000000000000057e33Initial program 93.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.0
Applied rewrites93.0%
Taylor expanded in z around 0
lower-/.f6468.5
Applied rewrites68.5%
(FPCore (x y z t) :precision binary64 (if (<= z -0.00016) (* 1.0 x) (if (<= z 5.2e+33) (/ (* x y) t) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00016) {
tmp = 1.0 * x;
} else if (z <= 5.2e+33) {
tmp = (x * y) / 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 <= (-0.00016d0)) then
tmp = 1.0d0 * x
else if (z <= 5.2d+33) then
tmp = (x * y) / 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 <= -0.00016) {
tmp = 1.0 * x;
} else if (z <= 5.2e+33) {
tmp = (x * y) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.00016: tmp = 1.0 * x elif z <= 5.2e+33: tmp = (x * y) / t else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.00016) tmp = Float64(1.0 * x); elseif (z <= 5.2e+33) tmp = Float64(Float64(x * y) / t); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.00016) tmp = 1.0 * x; elseif (z <= 5.2e+33) tmp = (x * y) / t; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.00016], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 5.2e+33], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00016:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+33}:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -1.60000000000000013e-4 or 5.1999999999999995e33 < z Initial program 74.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites66.7%
if -1.60000000000000013e-4 < z < 5.1999999999999995e33Initial program 93.1%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6466.9
Applied rewrites66.9%
Final simplification66.8%
(FPCore (x y z t) :precision binary64 (if (<= z -0.00016) (* 1.0 x) (if (<= z 8.6e+33) (* (/ x t) y) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00016) {
tmp = 1.0 * x;
} else if (z <= 8.6e+33) {
tmp = (x / t) * y;
} 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 <= (-0.00016d0)) then
tmp = 1.0d0 * x
else if (z <= 8.6d+33) then
tmp = (x / t) * y
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 <= -0.00016) {
tmp = 1.0 * x;
} else if (z <= 8.6e+33) {
tmp = (x / t) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.00016: tmp = 1.0 * x elif z <= 8.6e+33: tmp = (x / t) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.00016) tmp = Float64(1.0 * x); elseif (z <= 8.6e+33) tmp = Float64(Float64(x / t) * y); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.00016) tmp = 1.0 * x; elseif (z <= 8.6e+33) tmp = (x / t) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.00016], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 8.6e+33], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00016:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+33}:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if z < -1.60000000000000013e-4 or 8.60000000000000057e33 < z Initial program 74.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites66.7%
if -1.60000000000000013e-4 < z < 8.60000000000000057e33Initial program 93.1%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6466.9
Applied rewrites66.9%
Applied rewrites66.6%
(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 83.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
Taylor expanded in z around inf
Applied rewrites40.2%
(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 2024298
(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)))