
(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 10 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 85.3%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6497.3
Applied egg-rr97.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -4.1e+42)
(fma x (/ t z) x)
(if (<= z 2.55e+23)
(* x (/ y t))
(if (<= z 8.2e+101) (* y (/ x (- z))) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.1e+42) {
tmp = fma(x, (t / z), x);
} else if (z <= 2.55e+23) {
tmp = x * (y / t);
} else if (z <= 8.2e+101) {
tmp = y * (x / -z);
} else {
tmp = x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -4.1e+42) tmp = fma(x, Float64(t / z), x); elseif (z <= 2.55e+23) tmp = Float64(x * Float64(y / t)); elseif (z <= 8.2e+101) tmp = Float64(y * Float64(x / Float64(-z))); else tmp = x; end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.1e+42], N[(x * N[(t / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.55e+23], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.2e+101], N[(y * N[(x / (-z)), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+42}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t}{z}, x\right)\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{+23}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+101}:\\
\;\;\;\;y \cdot \frac{x}{-z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.1e42Initial program 72.2%
Taylor expanded in y around 0
mul-1-negN/A
neg-lowering-neg.f6458.5
Simplified58.5%
Taylor expanded in z around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6469.6
Simplified69.6%
if -4.1e42 < z < 2.5500000000000001e23Initial program 93.8%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6495.3
Applied egg-rr95.3%
Taylor expanded in z around 0
/-lowering-/.f6461.4
Simplified61.4%
if 2.5500000000000001e23 < z < 8.1999999999999999e101Initial program 84.4%
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
--lowering--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6473.3
Simplified73.3%
Taylor expanded in y around inf
mul-1-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
/-lowering-/.f64N/A
mul-1-negN/A
neg-lowering-neg.f6462.4
Simplified62.4%
if 8.1999999999999999e101 < z Initial program 71.2%
Taylor expanded in z around inf
Simplified56.7%
Final simplification62.2%
(FPCore (x y z t) :precision binary64 (if (<= z -5.7e+43) (fma x (/ t z) x) (if (<= z 3.6e+21) (* x (/ y t)) (if (<= z 7.5e+101) (/ (* y x) (- z)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.7e+43) {
tmp = fma(x, (t / z), x);
} else if (z <= 3.6e+21) {
tmp = x * (y / t);
} else if (z <= 7.5e+101) {
tmp = (y * x) / -z;
} else {
tmp = x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -5.7e+43) tmp = fma(x, Float64(t / z), x); elseif (z <= 3.6e+21) tmp = Float64(x * Float64(y / t)); elseif (z <= 7.5e+101) tmp = Float64(Float64(y * x) / Float64(-z)); else tmp = x; end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.7e+43], N[(x * N[(t / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 3.6e+21], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5e+101], N[(N[(y * x), $MachinePrecision] / (-z)), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.7 \cdot 10^{+43}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t}{z}, x\right)\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+21}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+101}:\\
\;\;\;\;\frac{y \cdot x}{-z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.6999999999999999e43Initial program 72.2%
Taylor expanded in y around 0
mul-1-negN/A
neg-lowering-neg.f6458.5
Simplified58.5%
Taylor expanded in z around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6469.6
Simplified69.6%
if -5.6999999999999999e43 < z < 3.6e21Initial program 93.8%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6495.3
Applied egg-rr95.3%
Taylor expanded in z around 0
/-lowering-/.f6461.4
Simplified61.4%
if 3.6e21 < z < 7.4999999999999995e101Initial program 84.4%
div-invN/A
*-commutativeN/A
flip3--N/A
clear-numN/A
*-lowering-*.f64N/A
clear-numN/A
flip3--N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f6484.2
Applied egg-rr84.2%
Taylor expanded in y around inf
Simplified63.0%
Taylor expanded in t around 0
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6452.3
Simplified52.3%
if 7.4999999999999995e101 < z Initial program 71.2%
Taylor expanded in z around inf
Simplified56.7%
Final simplification61.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ y (- t z))))) (if (<= y -3600.0) t_1 (if (<= y 7e+100) (* 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 <= -3600.0) {
tmp = t_1;
} else if (y <= 7e+100) {
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 <= (-3600.0d0)) then
tmp = t_1
else if (y <= 7d+100) 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 <= -3600.0) {
tmp = t_1;
} else if (y <= 7e+100) {
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 <= -3600.0: tmp = t_1 elif y <= 7e+100: 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 <= -3600.0) tmp = t_1; elseif (y <= 7e+100) 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 <= -3600.0) tmp = t_1; elseif (y <= 7e+100) 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, -3600.0], t$95$1, If[LessEqual[y, 7e+100], 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 -3600:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+100}:\\
\;\;\;\;x \cdot \frac{z}{z - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3600 or 6.99999999999999953e100 < y Initial program 85.8%
Taylor expanded in y around inf
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6484.9
Simplified84.9%
if -3600 < y < 6.99999999999999953e100Initial program 84.9%
Taylor expanded in y around 0
mul-1-negN/A
neg-lowering-neg.f6465.8
Simplified65.8%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
distribute-frac-negN/A
distribute-frac-neg2N/A
/-lowering-/.f64N/A
neg-sub0N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
--lowering--.f6478.3
Applied egg-rr78.3%
Final simplification81.0%
(FPCore (x y z t) :precision binary64 (if (<= z -1.45e+45) (fma x (/ t z) x) (if (<= z 7.5e+137) (* x (/ y (- t z))) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.45e+45) {
tmp = fma(x, (t / z), x);
} else if (z <= 7.5e+137) {
tmp = x * (y / (t - z));
} else {
tmp = x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -1.45e+45) tmp = fma(x, Float64(t / z), x); elseif (z <= 7.5e+137) tmp = Float64(x * Float64(y / Float64(t - z))); else tmp = x; end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.45e+45], N[(x * N[(t / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 7.5e+137], N[(x * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+45}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t}{z}, x\right)\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+137}:\\
\;\;\;\;x \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.4499999999999999e45Initial program 72.2%
Taylor expanded in y around 0
mul-1-negN/A
neg-lowering-neg.f6458.5
Simplified58.5%
Taylor expanded in z around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6469.6
Simplified69.6%
if -1.4499999999999999e45 < z < 7.50000000000000025e137Initial program 92.2%
Taylor expanded in y around inf
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f6473.4
Simplified73.4%
if 7.50000000000000025e137 < z Initial program 64.1%
Taylor expanded in z around inf
Simplified68.3%
(FPCore (x y z t) :precision binary64 (if (<= z -1.05e+43) (fma x (/ t z) x) (if (<= z 5.7e+72) (* x (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e+43) {
tmp = fma(x, (t / z), x);
} else if (z <= 5.7e+72) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -1.05e+43) tmp = fma(x, Float64(t / z), x); elseif (z <= 5.7e+72) tmp = Float64(x * Float64(y / t)); else tmp = x; end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.05e+43], N[(x * N[(t / z), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 5.7e+72], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+43}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{t}{z}, x\right)\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{+72}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.05000000000000001e43Initial program 72.2%
Taylor expanded in y around 0
mul-1-negN/A
neg-lowering-neg.f6458.5
Simplified58.5%
Taylor expanded in z around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6469.6
Simplified69.6%
if -1.05000000000000001e43 < z < 5.6999999999999997e72Initial program 93.5%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6495.6
Applied egg-rr95.6%
Taylor expanded in z around 0
/-lowering-/.f6459.9
Simplified59.9%
if 5.6999999999999997e72 < z Initial program 72.6%
Taylor expanded in z around inf
Simplified49.3%
Final simplification59.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.35e+43) x (if (<= z 1.15e+73) (* x (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.35e+43) {
tmp = x;
} else if (z <= 1.15e+73) {
tmp = x * (y / t);
} else {
tmp = 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.35d+43)) then
tmp = x
else if (z <= 1.15d+73) then
tmp = x * (y / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.35e+43) {
tmp = x;
} else if (z <= 1.15e+73) {
tmp = x * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.35e+43: tmp = x elif z <= 1.15e+73: tmp = x * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.35e+43) tmp = x; elseif (z <= 1.15e+73) tmp = Float64(x * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.35e+43) tmp = x; elseif (z <= 1.15e+73) tmp = x * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.35e+43], x, If[LessEqual[z, 1.15e+73], N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+43}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+73}:\\
\;\;\;\;x \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.3500000000000001e43 or 1.15e73 < z Initial program 72.4%
Taylor expanded in z around inf
Simplified58.9%
if -1.3500000000000001e43 < z < 1.15e73Initial program 93.5%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6495.6
Applied egg-rr95.6%
Taylor expanded in z around 0
/-lowering-/.f6459.9
Simplified59.9%
Final simplification59.5%
(FPCore (x y z t) :precision binary64 (if (<= z -5.8e+42) x (if (<= z 2.45e+76) (* y (/ x t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+42) {
tmp = x;
} else if (z <= 2.45e+76) {
tmp = y * (x / t);
} else {
tmp = 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 <= (-5.8d+42)) then
tmp = x
else if (z <= 2.45d+76) then
tmp = y * (x / t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+42) {
tmp = x;
} else if (z <= 2.45e+76) {
tmp = y * (x / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.8e+42: tmp = x elif z <= 2.45e+76: tmp = y * (x / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.8e+42) tmp = x; elseif (z <= 2.45e+76) tmp = Float64(y * Float64(x / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.8e+42) tmp = x; elseif (z <= 2.45e+76) tmp = y * (x / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.8e+42], x, If[LessEqual[z, 2.45e+76], N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+42}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{+76}:\\
\;\;\;\;y \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.79999999999999961e42 or 2.45000000000000013e76 < z Initial program 71.8%
Taylor expanded in z around inf
Simplified60.1%
if -5.79999999999999961e42 < z < 2.45000000000000013e76Initial program 93.6%
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6495.6
Applied egg-rr95.6%
Taylor expanded in z around 0
/-lowering-/.f6459.2
Simplified59.2%
*-commutativeN/A
clear-numN/A
associate-/r/N/A
associate-*r*N/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f6455.9
Applied egg-rr55.9%
Final simplification57.5%
(FPCore (x y z t) :precision binary64 (if (<= x 2.8e-270) (/ (* x (- z y)) z) (* (- y z) (/ x (- t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2.8e-270) {
tmp = (x * (z - y)) / z;
} else {
tmp = (y - z) * (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 (x <= 2.8d-270) then
tmp = (x * (z - y)) / z
else
tmp = (y - z) * (x / (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2.8e-270) {
tmp = (x * (z - y)) / z;
} else {
tmp = (y - z) * (x / (t - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 2.8e-270: tmp = (x * (z - y)) / z else: tmp = (y - z) * (x / (t - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 2.8e-270) tmp = Float64(Float64(x * Float64(z - y)) / z); else tmp = Float64(Float64(y - z) * Float64(x / Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 2.8e-270) tmp = (x * (z - y)) / z; else tmp = (y - z) * (x / (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 2.8e-270], N[(N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(x / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.8 \cdot 10^{-270}:\\
\;\;\;\;\frac{x \cdot \left(z - y\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x}{t - z}\\
\end{array}
\end{array}
if x < 2.7999999999999999e-270Initial program 84.7%
Taylor expanded in t around 0
mul-1-negN/A
neg-lowering-neg.f6443.8
Simplified43.8%
if 2.7999999999999999e-270 < x Initial program 85.9%
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6491.4
Applied egg-rr91.4%
Final simplification66.1%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return 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 = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 85.3%
Taylor expanded in z around inf
Simplified29.8%
(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 2024205
(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)))