
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - 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 + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - 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 + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - 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 + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Initial program 100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)) (t_2 (fma x (- z y) x)))
(if (<= t -2.6e+162)
t_1
(if (<= t -1.75e+62)
t_2
(if (<= t -100000000000.0) t_1 (if (<= t 5.2e-33) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double t_2 = fma(x, (z - y), x);
double tmp;
if (t <= -2.6e+162) {
tmp = t_1;
} else if (t <= -1.75e+62) {
tmp = t_2;
} else if (t <= -100000000000.0) {
tmp = t_1;
} else if (t <= 5.2e-33) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) t_2 = fma(x, Float64(z - y), x) tmp = 0.0 if (t <= -2.6e+162) tmp = t_1; elseif (t <= -1.75e+62) tmp = t_2; elseif (t <= -100000000000.0) tmp = t_1; elseif (t <= 5.2e-33) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(z - y), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -2.6e+162], t$95$1, If[LessEqual[t, -1.75e+62], t$95$2, If[LessEqual[t, -100000000000.0], t$95$1, If[LessEqual[t, 5.2e-33], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
t_2 := \mathsf{fma}\left(x, z - y, x\right)\\
\mathbf{if}\;t \leq -2.6 \cdot 10^{+162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.75 \cdot 10^{+62}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -100000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-33}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.6e162 or -1.74999999999999992e62 < t < -1e11 or 5.19999999999999988e-33 < t Initial program 100.0%
Taylor expanded in x around 0
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6486.0
Simplified86.0%
+-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6486.0
Applied egg-rr86.0%
if -2.6e162 < t < -1.74999999999999992e62 or -1e11 < t < 5.19999999999999988e-33Initial program 100.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6478.7
Simplified78.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- x t))))
(if (<= z -5.5e+62)
t_1
(if (<= z -2.75e-182)
(* y (- t x))
(if (<= z 560000000.0) (fma y t x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -5.5e+62) {
tmp = t_1;
} else if (z <= -2.75e-182) {
tmp = y * (t - x);
} else if (z <= 560000000.0) {
tmp = fma(y, t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -5.5e+62) tmp = t_1; elseif (z <= -2.75e-182) tmp = Float64(y * Float64(t - x)); elseif (z <= 560000000.0) tmp = fma(y, t, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e+62], t$95$1, If[LessEqual[z, -2.75e-182], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 560000000.0], N[(y * t + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.75 \cdot 10^{-182}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{elif}\;z \leq 560000000:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.4999999999999997e62 or 5.6e8 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6482.2
Simplified82.2%
if -5.4999999999999997e62 < z < -2.74999999999999996e-182Initial program 100.0%
*-commutativeN/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64100.0
Applied egg-rr100.0%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6474.4
Simplified74.4%
if -2.74999999999999996e-182 < z < 5.6e8Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6489.9
Simplified89.9%
Taylor expanded in t around inf
Simplified73.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -5000000000000.0)
t_1
(if (<= y 3.75e+34) (fma z (- x t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -5000000000000.0) {
tmp = t_1;
} else if (y <= 3.75e+34) {
tmp = fma(z, (x - t), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -5000000000000.0) tmp = t_1; elseif (y <= 3.75e+34) tmp = fma(z, Float64(x - t), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5000000000000.0], t$95$1, If[LessEqual[y, 3.75e+34], N[(z * N[(x - t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -5000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.75 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(z, x - t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5e12 or 3.74999999999999988e34 < y Initial program 100.0%
*-commutativeN/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.9
Applied egg-rr93.9%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6481.1
Simplified81.1%
if -5e12 < y < 3.74999999999999988e34Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6489.9
Simplified89.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -5.5e+62) t_1 (if (<= z 3000000000.0) (fma y (- t x) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = z * (x - t);
double tmp;
if (z <= -5.5e+62) {
tmp = t_1;
} else if (z <= 3000000000.0) {
tmp = fma(y, (t - x), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(z * Float64(x - t)) tmp = 0.0 if (z <= -5.5e+62) tmp = t_1; elseif (z <= 3000000000.0) tmp = fma(y, Float64(t - x), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e+62], t$95$1, If[LessEqual[z, 3000000000.0], N[(y * N[(t - x), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3000000000:\\
\;\;\;\;\mathsf{fma}\left(y, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.4999999999999997e62 or 3e9 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6482.2
Simplified82.2%
if -5.4999999999999997e62 < z < 3e9Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6486.9
Simplified86.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* y (- t x)))) (if (<= y -82.0) t_1 (if (<= y 3.7e+34) (fma x z x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -82.0) {
tmp = t_1;
} else if (y <= 3.7e+34) {
tmp = fma(x, z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -82.0) tmp = t_1; elseif (y <= 3.7e+34) tmp = fma(x, z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -82.0], t$95$1, If[LessEqual[y, 3.7e+34], N[(x * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -82:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -82 or 3.70000000000000009e34 < y Initial program 100.0%
*-commutativeN/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.9
Applied egg-rr93.9%
Taylor expanded in y around inf
*-lowering-*.f64N/A
--lowering--.f6480.4
Simplified80.4%
if -82 < y < 3.70000000000000009e34Initial program 100.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6459.1
Simplified59.1%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f6457.7
Simplified57.7%
(FPCore (x y z t) :precision binary64 (if (<= z -5.5e+62) (* x z) (if (<= z 540000000000.0) (fma y t x) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e+62) {
tmp = x * z;
} else if (z <= 540000000000.0) {
tmp = fma(y, t, x);
} else {
tmp = x * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -5.5e+62) tmp = Float64(x * z); elseif (z <= 540000000000.0) tmp = fma(y, t, x); else tmp = Float64(x * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.5e+62], N[(x * z), $MachinePrecision], If[LessEqual[z, 540000000000.0], N[(y * t + x), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 540000000000:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -5.4999999999999997e62 or 5.4e11 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6482.2
Simplified82.2%
Taylor expanded in x around inf
Simplified46.6%
if -5.4999999999999997e62 < z < 5.4e11Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6486.9
Simplified86.9%
Taylor expanded in t around inf
Simplified63.6%
Final simplification55.5%
(FPCore (x y z t) :precision binary64 (if (<= y -42.0) (* y t) (if (<= y 3.7e+34) (fma x z x) (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -42.0) {
tmp = y * t;
} else if (y <= 3.7e+34) {
tmp = fma(x, z, x);
} else {
tmp = y * t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -42.0) tmp = Float64(y * t); elseif (y <= 3.7e+34) tmp = fma(x, z, x); else tmp = Float64(y * t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -42.0], N[(y * t), $MachinePrecision], If[LessEqual[y, 3.7e+34], N[(x * z + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -42:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -42 or 3.70000000000000009e34 < y Initial program 100.0%
Taylor expanded in x around 0
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6457.5
Simplified57.5%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6446.5
Simplified46.5%
if -42 < y < 3.70000000000000009e34Initial program 100.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6459.1
Simplified59.1%
Taylor expanded in y around 0
+-commutativeN/A
accelerator-lowering-fma.f6457.7
Simplified57.7%
(FPCore (x y z t) :precision binary64 (if (<= z -5.5e+62) (* x z) (if (<= z 12000000000.0) (* y t) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e+62) {
tmp = x * z;
} else if (z <= 12000000000.0) {
tmp = y * t;
} else {
tmp = 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 (z <= (-5.5d+62)) then
tmp = x * z
else if (z <= 12000000000.0d0) then
tmp = y * t
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e+62) {
tmp = x * z;
} else if (z <= 12000000000.0) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.5e+62: tmp = x * z elif z <= 12000000000.0: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.5e+62) tmp = Float64(x * z); elseif (z <= 12000000000.0) tmp = Float64(y * t); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.5e+62) tmp = x * z; elseif (z <= 12000000000.0) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.5e+62], N[(x * z), $MachinePrecision], If[LessEqual[z, 12000000000.0], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+62}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 12000000000:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -5.4999999999999997e62 or 1.2e10 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
--lowering--.f6482.2
Simplified82.2%
Taylor expanded in x around inf
Simplified46.6%
if -5.4999999999999997e62 < z < 1.2e10Initial program 100.0%
Taylor expanded in x around 0
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6447.1
Simplified47.1%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6436.7
Simplified36.7%
Final simplification41.4%
(FPCore (x y z t) :precision binary64 (if (<= y -1.1e-20) (* y t) (if (<= y 6.8e-71) x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e-20) {
tmp = y * t;
} else if (y <= 6.8e-71) {
tmp = x;
} else {
tmp = 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 (y <= (-1.1d-20)) then
tmp = y * t
else if (y <= 6.8d-71) then
tmp = x
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e-20) {
tmp = y * t;
} else if (y <= 6.8e-71) {
tmp = x;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.1e-20: tmp = y * t elif y <= 6.8e-71: tmp = x else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.1e-20) tmp = Float64(y * t); elseif (y <= 6.8e-71) tmp = x; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.1e-20) tmp = y * t; elseif (y <= 6.8e-71) tmp = x; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.1e-20], N[(y * t), $MachinePrecision], If[LessEqual[y, 6.8e-71], x, N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-20}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-71}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.09999999999999995e-20 or 6.80000000000000007e-71 < y Initial program 100.0%
Taylor expanded in x around 0
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6456.8
Simplified56.8%
Taylor expanded in y around inf
*-commutativeN/A
*-lowering-*.f6442.2
Simplified42.2%
if -1.09999999999999995e-20 < y < 6.80000000000000007e-71Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6438.3
Simplified38.3%
Taylor expanded in y around 0
Simplified33.0%
(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 100.0%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6456.6
Simplified56.6%
Taylor expanded in y around 0
Simplified16.9%
(FPCore (x y z t) :precision binary64 (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (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 * (y - z)) + (-x * (y - z)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
def code(x, y, z, t): return x + ((t * (y - z)) + (-x * (y - z)))
function code(x, y, z, t) return Float64(x + Float64(Float64(t * Float64(y - z)) + Float64(Float64(-x) * Float64(y - z)))) end
function tmp = code(x, y, z, t) tmp = x + ((t * (y - z)) + (-x * (y - z))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] + N[((-x) * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right)
\end{array}
herbie shell --seed 2024195
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
(+ x (* (- y z) (- t x))))