
(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
(if (<= y -4.5e-10)
(* y t)
(if (<= y 5e-124)
(fma x z x)
(if (<= y 1.04e-22)
(* z (- t))
(if (<= y 3.7e+194) (* y t) (* y (- x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.5e-10) {
tmp = y * t;
} else if (y <= 5e-124) {
tmp = fma(x, z, x);
} else if (y <= 1.04e-22) {
tmp = z * -t;
} else if (y <= 3.7e+194) {
tmp = y * t;
} else {
tmp = y * -x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -4.5e-10) tmp = Float64(y * t); elseif (y <= 5e-124) tmp = fma(x, z, x); elseif (y <= 1.04e-22) tmp = Float64(z * Float64(-t)); elseif (y <= 3.7e+194) tmp = Float64(y * t); else tmp = Float64(y * Float64(-x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.5e-10], N[(y * t), $MachinePrecision], If[LessEqual[y, 5e-124], N[(x * z + x), $MachinePrecision], If[LessEqual[y, 1.04e-22], N[(z * (-t)), $MachinePrecision], If[LessEqual[y, 3.7e+194], N[(y * t), $MachinePrecision], N[(y * (-x)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-10}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-124}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;y \leq 1.04 \cdot 10^{-22}:\\
\;\;\;\;z \cdot \left(-t\right)\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{+194}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\end{array}
\end{array}
if y < -4.5e-10 or 1.04e-22 < y < 3.7000000000000003e194Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6463.0
Applied rewrites63.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6446.8
Applied rewrites46.8%
if -4.5e-10 < y < 5.0000000000000003e-124Initial program 100.0%
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6477.9
Applied rewrites77.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6472.6
Applied rewrites72.6%
if 5.0000000000000003e-124 < y < 1.04e-22Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6478.9
Applied rewrites78.9%
Taylor expanded in y around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6465.1
Applied rewrites65.1%
if 3.7000000000000003e194 < y Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6496.2
Applied rewrites96.2%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f6462.3
Applied rewrites62.3%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6462.3
Applied rewrites62.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- t x))))
(if (<= y -4.5e-10)
t_1
(if (<= y 5e-124) (fma x z x) (if (<= y 2e+114) (* (- 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 <= -4.5e-10) {
tmp = t_1;
} else if (y <= 5e-124) {
tmp = fma(x, z, x);
} else if (y <= 2e+114) {
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 <= -4.5e-10) tmp = t_1; elseif (y <= 5e-124) tmp = fma(x, z, x); elseif (y <= 2e+114) 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, -4.5e-10], t$95$1, If[LessEqual[y, 5e-124], N[(x * z + x), $MachinePrecision], If[LessEqual[y, 2e+114], 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 -4.5 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{-124}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+114}:\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -4.5e-10 or 2e114 < y Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f6484.3
Applied rewrites84.3%
if -4.5e-10 < y < 5.0000000000000003e-124Initial program 100.0%
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6477.9
Applied rewrites77.9%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6472.6
Applied rewrites72.6%
if 5.0000000000000003e-124 < y < 2e114Initial program 99.9%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6470.2
Applied rewrites70.2%
Final simplification77.4%
(FPCore (x y z t) :precision binary64 (if (<= y -4.5e-10) (* y t) (if (<= y 2.3e+27) (fma x z x) (if (<= y 3.7e+194) (* y t) (* y (- x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.5e-10) {
tmp = y * t;
} else if (y <= 2.3e+27) {
tmp = fma(x, z, x);
} else if (y <= 3.7e+194) {
tmp = y * t;
} else {
tmp = y * -x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -4.5e-10) tmp = Float64(y * t); elseif (y <= 2.3e+27) tmp = fma(x, z, x); elseif (y <= 3.7e+194) tmp = Float64(y * t); else tmp = Float64(y * Float64(-x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.5e-10], N[(y * t), $MachinePrecision], If[LessEqual[y, 2.3e+27], N[(x * z + x), $MachinePrecision], If[LessEqual[y, 3.7e+194], N[(y * t), $MachinePrecision], N[(y * (-x)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-10}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{+194}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-x\right)\\
\end{array}
\end{array}
if y < -4.5e-10 or 2.3000000000000001e27 < y < 3.7000000000000003e194Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6464.4
Applied rewrites64.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6448.1
Applied rewrites48.1%
if -4.5e-10 < y < 2.3000000000000001e27Initial program 100.0%
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6473.7
Applied rewrites73.7%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6463.4
Applied rewrites63.4%
if 3.7000000000000003e194 < y Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6496.2
Applied rewrites96.2%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f6462.3
Applied rewrites62.3%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6462.3
Applied rewrites62.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (fma y (- t x) x))) (if (<= y -2300000.0) t_1 (if (<= y 1.45e-22) (fma z (- x t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = fma(y, (t - x), x);
double tmp;
if (y <= -2300000.0) {
tmp = t_1;
} else if (y <= 1.45e-22) {
tmp = fma(z, (x - t), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = fma(y, Float64(t - x), x) tmp = 0.0 if (y <= -2300000.0) tmp = t_1; elseif (y <= 1.45e-22) 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] + x), $MachinePrecision]}, If[LessEqual[y, -2300000.0], t$95$1, If[LessEqual[y, 1.45e-22], N[(z * N[(x - t), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, t - x, x\right)\\
\mathbf{if}\;y \leq -2300000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-22}:\\
\;\;\;\;\mathsf{fma}\left(z, x - t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.3e6 or 1.4500000000000001e-22 < y Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6483.8
Applied rewrites83.8%
if -2.3e6 < y < 1.4500000000000001e-22Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/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--.f6492.3
Applied rewrites92.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* z (- x t)))) (if (<= z -1.1e+31) t_1 (if (<= z 5.1e+67) (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.1e+31) {
tmp = t_1;
} else if (z <= 5.1e+67) {
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.1e+31) tmp = t_1; elseif (z <= 5.1e+67) 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.1e+31], t$95$1, If[LessEqual[z, 5.1e+67], 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.1 \cdot 10^{+31}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(y, t - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.10000000000000005e31 or 5.1000000000000002e67 < 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.5
Applied rewrites83.5%
if -1.10000000000000005e31 < z < 5.1000000000000002e67Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
lower-fma.f64N/A
lower--.f6489.2
Applied rewrites89.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) t))) (if (<= t -2.1e+70) t_1 (if (<= t 1.15e-46) (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 <= -2.1e+70) {
tmp = t_1;
} else if (t <= 1.15e-46) {
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 <= -2.1e+70) tmp = t_1; elseif (t <= 1.15e-46) 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, -2.1e+70], t$95$1, If[LessEqual[t, 1.15e-46], 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 -2.1 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(x, z - y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.10000000000000008e70 or 1.15e-46 < t Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6478.1
Applied rewrites78.1%
if -2.10000000000000008e70 < t < 1.15e-46Initial 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--.f6480.9
Applied rewrites80.9%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- y z) t))) (if (<= t -2.4e-46) t_1 (if (<= t 8.8e-128) (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 <= -2.4e-46) {
tmp = t_1;
} else if (t <= 8.8e-128) {
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 <= -2.4e-46) tmp = t_1; elseif (t <= 8.8e-128) 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, -2.4e-46], t$95$1, If[LessEqual[t, 8.8e-128], 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 -2.4 \cdot 10^{-46}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.8 \cdot 10^{-128}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.40000000000000013e-46 or 8.80000000000000037e-128 < t Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6471.9
Applied rewrites71.9%
if -2.40000000000000013e-46 < t < 8.80000000000000037e-128Initial program 99.9%
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6498.4
Applied rewrites98.4%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6461.6
Applied rewrites61.6%
Final simplification68.3%
(FPCore (x y z t) :precision binary64 (if (<= y -4.5e-10) (* y t) (if (<= y 2.3e+27) (fma x z x) (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -4.5e-10) {
tmp = y * t;
} else if (y <= 2.3e+27) {
tmp = fma(x, z, x);
} else {
tmp = y * t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (y <= -4.5e-10) tmp = Float64(y * t); elseif (y <= 2.3e+27) tmp = fma(x, z, x); else tmp = Float64(y * t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[y, -4.5e-10], N[(y * t), $MachinePrecision], If[LessEqual[y, 2.3e+27], N[(x * z + x), $MachinePrecision], N[(y * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-10}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;y \leq 2.3 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -4.5e-10 or 2.3000000000000001e27 < y Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6460.3
Applied rewrites60.3%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6446.5
Applied rewrites46.5%
if -4.5e-10 < y < 2.3000000000000001e27Initial program 100.0%
lift--.f64N/A
lift--.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
+-commutativeN/A
lower-fma.f6473.7
Applied rewrites73.7%
Taylor expanded in y around 0
+-commutativeN/A
lower-fma.f6463.4
Applied rewrites63.4%
(FPCore (x y z t) :precision binary64 (if (<= z -1600000000000.0) (* x z) (if (<= z 5.4e+26) (* y t) (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1600000000000.0) {
tmp = x * z;
} else if (z <= 5.4e+26) {
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 <= (-1600000000000.0d0)) then
tmp = x * z
else if (z <= 5.4d+26) 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 <= -1600000000000.0) {
tmp = x * z;
} else if (z <= 5.4e+26) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1600000000000.0: tmp = x * z elif z <= 5.4e+26: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1600000000000.0) tmp = Float64(x * z); elseif (z <= 5.4e+26) 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 <= -1600000000000.0) tmp = x * z; elseif (z <= 5.4e+26) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1600000000000.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 5.4e+26], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1600000000000:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{+26}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1.6e12 or 5.4e26 < 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--.f6479.7
Applied rewrites79.7%
Taylor expanded in x around inf
lower-*.f6443.8
Applied rewrites43.8%
if -1.6e12 < z < 5.4e26Initial program 100.0%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f6447.4
Applied rewrites47.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f6439.7
Applied rewrites39.7%
(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--.f6441.7
Applied rewrites41.7%
Taylor expanded in x around inf
lower-*.f6421.4
Applied rewrites21.4%
(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 2024216
(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))))