
(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 (* z (- x t))))
(if (<= z -1.45e+43)
t_1
(if (<= z -6.4e-38) (* y (- t x)) (if (<= z 1.45e-20) (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 <= -1.45e+43) {
tmp = t_1;
} else if (z <= -6.4e-38) {
tmp = y * (t - x);
} else if (z <= 1.45e-20) {
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 <= -1.45e+43) tmp = t_1; elseif (z <= -6.4e-38) tmp = Float64(y * Float64(t - x)); elseif (z <= 1.45e-20) 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, -1.45e+43], t$95$1, If[LessEqual[z, -6.4e-38], N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e-20], 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 -1.45 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6.4 \cdot 10^{-38}:\\
\;\;\;\;y \cdot \left(t - x\right)\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-20}:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.4500000000000001e43 or 1.45e-20 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6483.1
Simplified83.1%
if -1.4500000000000001e43 < z < -6.39999999999999955e-38Initial program 99.8%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6467.0
Simplified67.0%
if -6.39999999999999955e-38 < z < 1.45e-20Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6495.1
Simplified95.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6471.3
Simplified71.3%
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6471.3
Applied egg-rr71.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -9.2e+20)
t_1
(if (<= y 6.6e-131) (fma x z x) (if (<= y 8.6e+97) (* (- y z) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t - x);
double tmp;
if (y <= -9.2e+20) {
tmp = t_1;
} else if (y <= 6.6e-131) {
tmp = fma(x, z, x);
} else if (y <= 8.6e+97) {
tmp = (y - z) * t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(y * Float64(t - x)) tmp = 0.0 if (y <= -9.2e+20) tmp = t_1; elseif (y <= 6.6e-131) tmp = fma(x, z, x); elseif (y <= 8.6e+97) tmp = Float64(Float64(y - z) * t); 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, -9.2e+20], t$95$1, If[LessEqual[y, 6.6e-131], N[(x * z + x), $MachinePrecision], If[LessEqual[y, 8.6e+97], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t - x\right)\\
\mathbf{if}\;y \leq -9.2 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{-131}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;y \leq 8.6 \cdot 10^{+97}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -9.2e20 or 8.5999999999999996e97 < y Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6486.9
Simplified86.9%
if -9.2e20 < y < 6.6000000000000004e-131Initial program 100.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6464.3
Simplified64.3%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6463.6
Simplified63.6%
if 6.6000000000000004e-131 < y < 8.5999999999999996e97Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6462.5
Simplified62.5%
Final simplification73.2%
(FPCore (x y z t) :precision binary64 (if (<= z -4.2e+191) (* x z) (if (<= z -2.5e+40) (- (* z t)) (if (<= z 7.6e+61) (fma y t x) (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.2e+191) {
tmp = x * z;
} else if (z <= -2.5e+40) {
tmp = -(z * t);
} else if (z <= 7.6e+61) {
tmp = fma(y, t, x);
} else {
tmp = x * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -4.2e+191) tmp = Float64(x * z); elseif (z <= -2.5e+40) tmp = Float64(-Float64(z * t)); elseif (z <= 7.6e+61) tmp = fma(y, t, x); else tmp = Float64(x * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.2e+191], N[(x * z), $MachinePrecision], If[LessEqual[z, -2.5e+40], (-N[(z * t), $MachinePrecision]), If[LessEqual[z, 7.6e+61], N[(y * t + x), $MachinePrecision], N[(x * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+191}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{+40}:\\
\;\;\;\;-z \cdot t\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -4.2000000000000001e191 or 7.5999999999999999e61 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6492.1
Simplified92.1%
Taylor expanded in x around inf
lower-*.f6459.5
Simplified59.5%
if -4.2000000000000001e191 < z < -2.50000000000000002e40Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6463.0
Simplified63.0%
Taylor expanded in y around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6455.9
Simplified55.9%
if -2.50000000000000002e40 < z < 7.5999999999999999e61Initial program 99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6490.0
Simplified90.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6464.0
Simplified64.0%
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6464.1
Applied egg-rr64.1%
Final simplification61.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -1.6e+43) t_1 (if (<= z 7.2e+61) (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 <= -1.6e+43) {
tmp = t_1;
} else if (z <= 7.2e+61) {
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 <= -1.6e+43) tmp = t_1; elseif (z <= 7.2e+61) 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, -1.6e+43], t$95$1, If[LessEqual[z, 7.2e+61], 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 -1.6 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(y, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.60000000000000007e43 or 7.20000000000000021e61 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6487.7
Simplified87.7%
if -1.60000000000000007e43 < z < 7.20000000000000021e61Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6490.0
Simplified90.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) t))) (if (<= t -61000000000.0) t_1 (if (<= t 2.55e+32) (fma x (- z y) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -61000000000.0) {
tmp = t_1;
} else if (t <= 2.55e+32) {
tmp = fma(x, (z - y), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) tmp = 0.0 if (t <= -61000000000.0) tmp = t_1; elseif (t <= 2.55e+32) tmp = fma(x, Float64(z - y), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -61000000000.0], t$95$1, If[LessEqual[t, 2.55e+32], N[(x * N[(z - y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -61000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.55 \cdot 10^{+32}:\\
\;\;\;\;\mathsf{fma}\left(x, z - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.1e10 or 2.55000000000000002e32 < t Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6486.9
Simplified86.9%
if -6.1e10 < t < 2.55000000000000002e32Initial program 100.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6483.8
Simplified83.8%
Final simplification85.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) t))) (if (<= t -8600000000.0) t_1 (if (<= t 2.8e-74) (fma x z x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double tmp;
if (t <= -8600000000.0) {
tmp = t_1;
} else if (t <= 2.8e-74) {
tmp = fma(x, z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) tmp = 0.0 if (t <= -8600000000.0) tmp = t_1; elseif (t <= 2.8e-74) tmp = fma(x, z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -8600000000.0], t$95$1, If[LessEqual[t, 2.8e-74], N[(x * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
\mathbf{if}\;t \leq -8600000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{-74}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -8.6e9 or 2.79999999999999988e-74 < t Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6479.6
Simplified79.6%
if -8.6e9 < t < 2.79999999999999988e-74Initial program 100.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6488.8
Simplified88.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6457.3
Simplified57.3%
Final simplification69.1%
(FPCore (x y z t) :precision binary64 (if (<= z -2.5e+42) (* x z) (if (<= z 1.02e+62) (fma y t x) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.5e+42) {
tmp = x * z;
} else if (z <= 1.02e+62) {
tmp = fma(y, t, x);
} else {
tmp = x * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -2.5e+42) tmp = Float64(x * z); elseif (z <= 1.02e+62) tmp = fma(y, t, x); else tmp = Float64(x * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.5e+42], N[(x * z), $MachinePrecision], If[LessEqual[z, 1.02e+62], N[(y * t + x), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+42}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{fma}\left(y, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -2.50000000000000003e42 or 1.02000000000000002e62 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6486.9
Simplified86.9%
Taylor expanded in x around inf
lower-*.f6447.0
Simplified47.0%
if -2.50000000000000003e42 < z < 1.02000000000000002e62Initial program 99.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6490.0
Simplified90.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6464.0
Simplified64.0%
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6464.1
Applied egg-rr64.1%
(FPCore (x y z t) :precision binary64 (if (<= t -25000.0) (* y t) (if (<= t 7e+35) (fma x z x) (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -25000.0) {
tmp = y * t;
} else if (t <= 7e+35) {
tmp = fma(x, z, x);
} else {
tmp = y * t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= -25000.0) tmp = Float64(y * t); elseif (t <= 7e+35) tmp = fma(x, z, x); else tmp = Float64(y * t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, -25000.0], N[(y * t), $MachinePrecision], If[LessEqual[t, 7e+35], N[(x * z + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -25000:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if t < -25000 or 7.0000000000000001e35 < t Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6486.2
Simplified86.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6452.4
Simplified52.4%
if -25000 < t < 7.0000000000000001e35Initial program 100.0%
Taylor expanded in x around inf
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
lower-fma.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6483.8
Simplified83.8%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6453.7
Simplified53.7%
(FPCore (x y z t) :precision binary64 (if (<= z -7.4e+40) (* x z) (if (<= z 1.85e+62) (* y t) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.4e+40) {
tmp = x * z;
} else if (z <= 1.85e+62) {
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 <= (-7.4d+40)) then
tmp = x * z
else if (z <= 1.85d+62) 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 <= -7.4e+40) {
tmp = x * z;
} else if (z <= 1.85e+62) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.4e+40: tmp = x * z elif z <= 1.85e+62: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.4e+40) tmp = Float64(x * z); elseif (z <= 1.85e+62) 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 <= -7.4e+40) tmp = x * z; elseif (z <= 1.85e+62) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.4e+40], N[(x * z), $MachinePrecision], If[LessEqual[z, 1.85e+62], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{+40}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+62}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -7.4e40 or 1.85000000000000007e62 < z Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6486.9
Simplified86.9%
Taylor expanded in x around inf
lower-*.f6447.0
Simplified47.0%
if -7.4e40 < z < 1.85000000000000007e62Initial program 99.9%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6445.4
Simplified45.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6437.2
Simplified37.2%
(FPCore (x y z t) :precision binary64 (* x z))
double code(double x, double y, double z, double t) {
return x * 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 * z
end function
public static double code(double x, double y, double z, double t) {
return x * z;
}
def code(x, y, z, t): return x * z
function code(x, y, z, t) return Float64(x * z) end
function tmp = code(x, y, z, t) tmp = x * z; end
code[x_, y_, z_, t_] := N[(x * z), $MachinePrecision]
\begin{array}{l}
\\
x \cdot z
\end{array}
Initial program 100.0%
Taylor expanded in z around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
sub-negN/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
remove-double-negN/A
lower--.f6442.9
Simplified42.9%
Taylor expanded in x around inf
lower-*.f6421.9
Simplified21.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 2024207
(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))))