
(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 13 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.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.3
Applied rewrites96.3%
(FPCore (x y z t) :precision binary64 (if (<= (/ (* (- y z) x) (- t z)) 5e+236) (* x 1.0) (* z (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((((y - z) * x) / (t - z)) <= 5e+236) {
tmp = x * 1.0;
} else {
tmp = z * (x / 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 ((((y - z) * x) / (t - z)) <= 5d+236) then
tmp = x * 1.0d0
else
tmp = z * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((((y - z) * x) / (t - z)) <= 5e+236) {
tmp = x * 1.0;
} else {
tmp = z * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (((y - z) * x) / (t - z)) <= 5e+236: tmp = x * 1.0 else: tmp = z * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(Float64(y - z) * x) / Float64(t - z)) <= 5e+236) tmp = Float64(x * 1.0); else tmp = Float64(z * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((((y - z) * x) / (t - z)) <= 5e+236) tmp = x * 1.0; else tmp = z * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], 5e+236], N[(x * 1.0), $MachinePrecision], N[(z * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\left(y - z\right) \cdot x}{t - z} \leq 5 \cdot 10^{+236}:\\
\;\;\;\;x \cdot 1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 4.9999999999999997e236Initial program 88.4%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6497.0
Applied rewrites97.0%
Taylor expanded in z around inf
Applied rewrites33.6%
if 4.9999999999999997e236 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 39.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.8
Applied rewrites90.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
frac-2negN/A
*-lft-identityN/A
associate-*l/N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites96.7%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6448.9
Applied rewrites48.9%
Taylor expanded in z around inf
Applied rewrites50.4%
Final simplification35.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma x (/ t z) x)) (t_2 (* z (/ x (- z t)))))
(if (<= z -1.35e+191)
t_1
(if (<= z -3.3e-62)
t_2
(if (<= z 1.15e-71) (* x (/ y t)) (if (<= z 1.6e+184) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = fma(x, (t / z), x);
double t_2 = z * (x / (z - t));
double tmp;
if (z <= -1.35e+191) {
tmp = t_1;
} else if (z <= -3.3e-62) {
tmp = t_2;
} else if (z <= 1.15e-71) {
tmp = x * (y / t);
} else if (z <= 1.6e+184) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(x, Float64(t / z), x) t_2 = Float64(z * Float64(x / Float64(z - t))) tmp = 0.0 if (z <= -1.35e+191) tmp = t_1; elseif (z <= -3.3e-62) tmp = t_2; elseif (z <= 1.15e-71) tmp = Float64(x * Float64(y / t)); elseif (z <= 1.6e+184) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.35e+191], t$95$1, If[LessEqual[z, -3.3e-62], t$95$2, If[LessEqual[z, 1.15e-71], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e+184], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, \frac{t}{z}, x\right)\\
t_2 := z \cdot \frac{x}{z - t}\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+191}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{-62}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-71}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+184}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.34999999999999998e191 or 1.59999999999999991e184 < z Initial program 55.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
frac-2negN/A
*-lft-identityN/A
associate-*l/N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites70.4%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6462.5
Applied rewrites62.5%
Taylor expanded in z around inf
Applied rewrites82.9%
if -1.34999999999999998e191 < z < -3.30000000000000004e-62 or 1.1499999999999999e-71 < z < 1.59999999999999991e184Initial program 87.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.5
Applied rewrites99.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
frac-2negN/A
*-lft-identityN/A
associate-*l/N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites90.1%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6460.1
Applied rewrites60.1%
if -3.30000000000000004e-62 < z < 1.1499999999999999e-71Initial program 92.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
Taylor expanded in z around 0
lower-/.f6467.7
Applied rewrites67.7%
Final simplification67.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma x (/ y (- z)) x)))
(if (<= z -1.18e+23)
t_1
(if (<= z -1.1e-89)
(/ (* (- y z) x) t)
(if (<= z 8e+21) (* x (/ y (- t z))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = fma(x, (y / -z), x);
double tmp;
if (z <= -1.18e+23) {
tmp = t_1;
} else if (z <= -1.1e-89) {
tmp = ((y - z) * x) / t;
} else if (z <= 8e+21) {
tmp = x * (y / (t - z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(x, Float64(y / Float64(-z)), x) tmp = 0.0 if (z <= -1.18e+23) tmp = t_1; elseif (z <= -1.1e-89) tmp = Float64(Float64(Float64(y - z) * x) / t); elseif (z <= 8e+21) tmp = Float64(x * Float64(y / Float64(t - z))); 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, -1.18e+23], t$95$1, If[LessEqual[z, -1.1e-89], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 8e+21], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $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 -1.18 \cdot 10^{+23}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-89}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+21}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.18e23 or 8e21 < z Initial program 68.9%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6476.1
Applied rewrites76.1%
Applied rewrites70.6%
Applied rewrites79.5%
if -1.18e23 < z < -1.10000000000000006e-89Initial program 99.7%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6478.5
Applied rewrites78.5%
if -1.10000000000000006e-89 < z < 8e21Initial program 92.3%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6476.2
Applied rewrites76.2%
Final simplification77.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ y (- t z)))))
(if (<= y -2.4e+18)
t_1
(if (<= y -2.4e-146)
(/ (* (- y z) x) t)
(if (<= y 3.1e+33) (* z (/ x (- z t))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y / (t - z));
double tmp;
if (y <= -2.4e+18) {
tmp = t_1;
} else if (y <= -2.4e-146) {
tmp = ((y - z) * x) / t;
} else if (y <= 3.1e+33) {
tmp = z * (x / (z - t));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (y / (t - z))
if (y <= (-2.4d+18)) then
tmp = t_1
else if (y <= (-2.4d-146)) then
tmp = ((y - z) * x) / t
else if (y <= 3.1d+33) then
tmp = z * (x / (z - t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (y / (t - z));
double tmp;
if (y <= -2.4e+18) {
tmp = t_1;
} else if (y <= -2.4e-146) {
tmp = ((y - z) * x) / t;
} else if (y <= 3.1e+33) {
tmp = z * (x / (z - t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y / (t - z)) tmp = 0 if y <= -2.4e+18: tmp = t_1 elif y <= -2.4e-146: tmp = ((y - z) * x) / t elif y <= 3.1e+33: tmp = z * (x / (z - t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y / Float64(t - z))) tmp = 0.0 if (y <= -2.4e+18) tmp = t_1; elseif (y <= -2.4e-146) tmp = Float64(Float64(Float64(y - z) * x) / t); elseif (y <= 3.1e+33) tmp = Float64(z * Float64(x / Float64(z - t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y / (t - z)); tmp = 0.0; if (y <= -2.4e+18) tmp = t_1; elseif (y <= -2.4e-146) tmp = ((y - z) * x) / t; elseif (y <= 3.1e+33) tmp = z * (x / (z - t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.4e+18], t$95$1, If[LessEqual[y, -2.4e-146], N[(N[(N[(y - z), $MachinePrecision] * x), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[y, 3.1e+33], N[(z * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{t - z}\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.4 \cdot 10^{-146}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+33}:\\
\;\;\;\;z \cdot \frac{x}{z - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.4e18 or 3.1e33 < y Initial program 81.6%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6475.8
Applied rewrites75.8%
if -2.4e18 < y < -2.4000000000000002e-146Initial program 94.5%
Taylor expanded in t around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6465.8
Applied rewrites65.8%
if -2.4000000000000002e-146 < y < 3.1e33Initial program 79.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6497.6
Applied rewrites97.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
frac-2negN/A
*-lft-identityN/A
associate-*l/N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites88.0%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6481.7
Applied rewrites81.7%
Final simplification76.7%
(FPCore (x y z t) :precision binary64 (if (<= z -2.4e+213) (* x (/ z (- z t))) (if (<= z 3.1e+182) (* (- y z) (/ x (- t z))) (fma x (/ y (- z)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.4e+213) {
tmp = x * (z / (z - t));
} else if (z <= 3.1e+182) {
tmp = (y - z) * (x / (t - z));
} else {
tmp = fma(x, (y / -z), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -2.4e+213) tmp = Float64(x * Float64(z / Float64(z - t))); elseif (z <= 3.1e+182) tmp = Float64(Float64(y - z) * Float64(x / Float64(t - z))); else tmp = fma(x, Float64(y / Float64(-z)), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.4e+213], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.1e+182], N[(N[(y - z), $MachinePrecision] * N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / (-z)), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+213}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+182}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{-z}, x\right)\\
\end{array}
\end{array}
if z < -2.4e213Initial program 54.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
sub-negN/A
mul-1-negN/A
distribute-lft-inN/A
mul-1-negN/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
sub-negN/A
lower-/.f64N/A
lower--.f6497.2
Applied rewrites97.2%
if -2.4e213 < z < 3.09999999999999996e182Initial program 88.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.9
Applied rewrites90.9%
if 3.09999999999999996e182 < z Initial program 59.0%
Taylor expanded in t around 0
mul-1-negN/A
neg-sub0N/A
associate-/l*N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-/l*N/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6485.3
Applied rewrites85.3%
Applied rewrites85.6%
Applied rewrites88.8%
Final simplification91.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ y (- t z))))) (if (<= y -2e+59) t_1 (if (<= y 9.6e+35) (* x (/ z (- z t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y / (t - z));
double tmp;
if (y <= -2e+59) {
tmp = t_1;
} else if (y <= 9.6e+35) {
tmp = x * (z / (z - t));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (y / (t - z))
if (y <= (-2d+59)) then
tmp = t_1
else if (y <= 9.6d+35) then
tmp = x * (z / (z - t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (y / (t - z));
double tmp;
if (y <= -2e+59) {
tmp = t_1;
} else if (y <= 9.6e+35) {
tmp = x * (z / (z - t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y / (t - z)) tmp = 0 if y <= -2e+59: tmp = t_1 elif y <= 9.6e+35: tmp = x * (z / (z - t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y / Float64(t - z))) tmp = 0.0 if (y <= -2e+59) tmp = t_1; elseif (y <= 9.6e+35) tmp = Float64(x * Float64(z / Float64(z - t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y / (t - z)); tmp = 0.0; if (y <= -2e+59) tmp = t_1; elseif (y <= 9.6e+35) tmp = x * (z / (z - t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e+59], t$95$1, If[LessEqual[y, 9.6e+35], N[(x * N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{t - z}\\
\mathbf{if}\;y \leq -2 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 9.6 \cdot 10^{+35}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.99999999999999994e59 or 9.60000000000000058e35 < y Initial program 81.9%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6479.1
Applied rewrites79.1%
if -1.99999999999999994e59 < y < 9.60000000000000058e35Initial program 82.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6497.6
Applied rewrites97.6%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
sub-negN/A
mul-1-negN/A
distribute-lft-inN/A
mul-1-negN/A
neg-mul-1N/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
sub-negN/A
lower-/.f64N/A
lower--.f6481.0
Applied rewrites81.0%
Final simplification80.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ y (- t z))))) (if (<= y -3e-104) t_1 (if (<= y 3.1e+33) (* z (/ x (- z t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y / (t - z));
double tmp;
if (y <= -3e-104) {
tmp = t_1;
} else if (y <= 3.1e+33) {
tmp = z * (x / (z - t));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (y / (t - z))
if (y <= (-3d-104)) then
tmp = t_1
else if (y <= 3.1d+33) then
tmp = z * (x / (z - t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (y / (t - z));
double tmp;
if (y <= -3e-104) {
tmp = t_1;
} else if (y <= 3.1e+33) {
tmp = z * (x / (z - t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y / (t - z)) tmp = 0 if y <= -3e-104: tmp = t_1 elif y <= 3.1e+33: tmp = z * (x / (z - t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y / Float64(t - z))) tmp = 0.0 if (y <= -3e-104) tmp = t_1; elseif (y <= 3.1e+33) tmp = Float64(z * Float64(x / Float64(z - t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y / (t - z)); tmp = 0.0; if (y <= -3e-104) tmp = t_1; elseif (y <= 3.1e+33) tmp = z * (x / (z - t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3e-104], t$95$1, If[LessEqual[y, 3.1e+33], N[(z * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{t - z}\\
\mathbf{if}\;y \leq -3 \cdot 10^{-104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+33}:\\
\;\;\;\;z \cdot \frac{x}{z - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.0000000000000002e-104 or 3.1e33 < y Initial program 84.4%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6471.2
Applied rewrites71.2%
if -3.0000000000000002e-104 < y < 3.1e33Initial program 79.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6497.8
Applied rewrites97.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
frac-2negN/A
*-lft-identityN/A
associate-*l/N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites88.1%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6479.6
Applied rewrites79.6%
(FPCore (x y z t) :precision binary64 (if (<= z -3.5e+47) (* x 1.0) (if (<= z 1.8e+22) (* x (/ y t)) (fma x (/ t z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.5e+47) {
tmp = x * 1.0;
} else if (z <= 1.8e+22) {
tmp = x * (y / t);
} else {
tmp = fma(x, (t / z), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -3.5e+47) tmp = Float64(x * 1.0); elseif (z <= 1.8e+22) tmp = Float64(x * Float64(y / t)); else tmp = fma(x, Float64(t / z), x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.5e+47], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 1.8e+22], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+47}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+22}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t}{z}, x\right)\\
\end{array}
\end{array}
if z < -3.50000000000000015e47Initial program 63.2%
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.4%
if -3.50000000000000015e47 < z < 1.8e22Initial program 93.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.5
Applied rewrites93.5%
Taylor expanded in z around 0
lower-/.f6457.0
Applied rewrites57.0%
if 1.8e22 < z Initial program 72.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
frac-2negN/A
*-lft-identityN/A
associate-*l/N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
associate-*r*N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
remove-double-negN/A
sub-negN/A
lift--.f64N/A
lower-*.f64N/A
Applied rewrites82.1%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6464.5
Applied rewrites64.5%
Taylor expanded in z around inf
Applied rewrites57.8%
Final simplification59.6%
(FPCore (x y z t) :precision binary64 (if (<= z -3.5e+47) (* x 1.0) (if (<= z 1.8e+22) (* x (/ y t)) (* x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.5e+47) {
tmp = x * 1.0;
} else if (z <= 1.8e+22) {
tmp = x * (y / t);
} else {
tmp = x * 1.0;
}
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.5d+47)) then
tmp = x * 1.0d0
else if (z <= 1.8d+22) then
tmp = x * (y / t)
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.5e+47) {
tmp = x * 1.0;
} else if (z <= 1.8e+22) {
tmp = x * (y / t);
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.5e+47: tmp = x * 1.0 elif z <= 1.8e+22: tmp = x * (y / t) else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.5e+47) tmp = Float64(x * 1.0); elseif (z <= 1.8e+22) tmp = Float64(x * Float64(y / t)); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.5e+47) tmp = x * 1.0; elseif (z <= 1.8e+22) tmp = x * (y / t); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.5e+47], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 1.8e+22], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+47}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+22}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -3.50000000000000015e47 or 1.8e22 < z Initial program 68.1%
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 rewrites62.6%
if -3.50000000000000015e47 < z < 1.8e22Initial program 93.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.5
Applied rewrites93.5%
Taylor expanded in z around 0
lower-/.f6457.0
Applied rewrites57.0%
Final simplification59.4%
(FPCore (x y z t) :precision binary64 (if (<= z -8.5e+44) (* x 1.0) (if (<= z 8.4e+21) (/ (* y x) t) (* x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.5e+44) {
tmp = x * 1.0;
} else if (z <= 8.4e+21) {
tmp = (y * x) / t;
} else {
tmp = x * 1.0;
}
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 <= (-8.5d+44)) then
tmp = x * 1.0d0
else if (z <= 8.4d+21) then
tmp = (y * x) / t
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -8.5e+44) {
tmp = x * 1.0;
} else if (z <= 8.4e+21) {
tmp = (y * x) / t;
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -8.5e+44: tmp = x * 1.0 elif z <= 8.4e+21: tmp = (y * x) / t else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -8.5e+44) tmp = Float64(x * 1.0); elseif (z <= 8.4e+21) tmp = Float64(Float64(y * x) / t); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -8.5e+44) tmp = x * 1.0; elseif (z <= 8.4e+21) tmp = (y * x) / t; else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -8.5e+44], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 8.4e+21], N[(N[(y * x), $MachinePrecision] / t), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+44}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 8.4 \cdot 10^{+21}:\\
\;\;\;\;\frac{y \cdot x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -8.5e44 or 8.4e21 < z Initial program 68.1%
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 rewrites62.6%
if -8.5e44 < z < 8.4e21Initial program 93.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6455.8
Applied rewrites55.8%
Final simplification58.8%
(FPCore (x y z t) :precision binary64 (if (<= z -3.5e+47) (* x 1.0) (if (<= z 1.8e+22) (* y (/ x t)) (* x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.5e+47) {
tmp = x * 1.0;
} else if (z <= 1.8e+22) {
tmp = y * (x / t);
} else {
tmp = x * 1.0;
}
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.5d+47)) then
tmp = x * 1.0d0
else if (z <= 1.8d+22) then
tmp = y * (x / t)
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.5e+47) {
tmp = x * 1.0;
} else if (z <= 1.8e+22) {
tmp = y * (x / t);
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.5e+47: tmp = x * 1.0 elif z <= 1.8e+22: tmp = y * (x / t) else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.5e+47) tmp = Float64(x * 1.0); elseif (z <= 1.8e+22) tmp = Float64(y * Float64(x / t)); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.5e+47) tmp = x * 1.0; elseif (z <= 1.8e+22) tmp = y * (x / t); else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.5e+47], N[(x * 1.0), $MachinePrecision], If[LessEqual[z, 1.8e+22], N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.5 \cdot 10^{+47}:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+22}:\\
\;\;\;\;y \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
\end{array}
if z < -3.50000000000000015e47 or 1.8e22 < z Initial program 68.1%
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 rewrites62.6%
if -3.50000000000000015e47 < z < 1.8e22Initial program 93.9%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6455.8
Applied rewrites55.8%
Applied rewrites54.2%
Final simplification57.9%
(FPCore (x y z t) :precision binary64 (* x 1.0))
double code(double x, double y, double z, double t) {
return x * 1.0;
}
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 * 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return x * 1.0;
}
def code(x, y, z, t): return x * 1.0
function code(x, y, z, t) return Float64(x * 1.0) end
function tmp = code(x, y, z, t) tmp = x * 1.0; end
code[x_, y_, z_, t_] := N[(x * 1.0), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 1
\end{array}
Initial program 82.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6496.3
Applied rewrites96.3%
Taylor expanded in z around inf
Applied rewrites33.9%
Final simplification33.9%
(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 2024220
(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)))