
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
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 - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
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 - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) 1e+96) (fma (/ z t) (- y x) x) (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= 1e+96) {
tmp = fma((z / t), (y - x), x);
} else {
tmp = ((y - x) * z) / t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= 1e+96) tmp = fma(Float64(z / t), Float64(y - x), x); else tmp = Float64(Float64(Float64(y - x) * z) / t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], 1e+96], N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq 10^{+96}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(y - x\right) \cdot z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < 1.00000000000000005e96Initial program 98.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6498.6
Applied rewrites98.6%
if 1.00000000000000005e96 < (/.f64 z t) Initial program 86.9%
Taylor expanded in z around inf
div-subN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6497.2
Applied rewrites97.2%
Applied rewrites100.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -2000000.0) (not (<= (/ z t) 2e+44))) (* (/ (- y x) t) z) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2000000.0) || !((z / t) <= 2e+44)) {
tmp = ((y - x) / t) * z;
} else {
tmp = x + ((y * z) / 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 (((z / t) <= (-2000000.0d0)) .or. (.not. ((z / t) <= 2d+44))) then
tmp = ((y - x) / t) * z
else
tmp = x + ((y * z) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2000000.0) || !((z / t) <= 2e+44)) {
tmp = ((y - x) / t) * z;
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -2000000.0) or not ((z / t) <= 2e+44): tmp = ((y - x) / t) * z else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -2000000.0) || !(Float64(z / t) <= 2e+44)) tmp = Float64(Float64(Float64(y - x) / t) * z); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -2000000.0) || ~(((z / t) <= 2e+44))) tmp = ((y - x) / t) * z; else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -2000000.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 2e+44]], $MachinePrecision]], N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2000000 \lor \neg \left(\frac{z}{t} \leq 2 \cdot 10^{+44}\right):\\
\;\;\;\;\frac{y - x}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if (/.f64 z t) < -2e6 or 2.0000000000000002e44 < (/.f64 z t) Initial program 94.8%
Taylor expanded in z around inf
div-subN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6496.5
Applied rewrites96.5%
if -2e6 < (/.f64 z t) < 2.0000000000000002e44Initial program 99.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6493.9
Applied rewrites93.9%
Taylor expanded in x around 0
lower-*.f6492.0
Applied rewrites92.0%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -2000000.0) (not (<= (/ z t) 1e-8))) (* (/ (- y x) t) z) (fma z (/ y t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -2000000.0) || !((z / t) <= 1e-8)) {
tmp = ((y - x) / t) * z;
} else {
tmp = fma(z, (y / t), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -2000000.0) || !(Float64(z / t) <= 1e-8)) tmp = Float64(Float64(Float64(y - x) / t) * z); else tmp = fma(z, Float64(y / t), x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -2000000.0], N[Not[LessEqual[N[(z / t), $MachinePrecision], 1e-8]], $MachinePrecision]], N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -2000000 \lor \neg \left(\frac{z}{t} \leq 10^{-8}\right):\\
\;\;\;\;\frac{y - x}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{t}, x\right)\\
\end{array}
\end{array}
if (/.f64 z t) < -2e6 or 1e-8 < (/.f64 z t) Initial program 95.0%
Taylor expanded in z around inf
div-subN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6494.7
Applied rewrites94.7%
if -2e6 < (/.f64 z t) < 1e-8Initial program 99.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6491.9
Applied rewrites91.9%
Taylor expanded in x around 0
lower-/.f6493.1
Applied rewrites93.1%
Final simplification94.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ z t) -5e-96) (not (<= (/ z t) 5e-19))) (* (/ y t) z) (* 1.0 x)))
double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e-96) || !((z / t) <= 5e-19)) {
tmp = (y / t) * z;
} else {
tmp = 1.0 * 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 / t) <= (-5d-96)) .or. (.not. ((z / t) <= 5d-19))) then
tmp = (y / t) * z
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((z / t) <= -5e-96) || !((z / t) <= 5e-19)) {
tmp = (y / t) * z;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z / t) <= -5e-96) or not ((z / t) <= 5e-19): tmp = (y / t) * z else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(z / t) <= -5e-96) || !(Float64(z / t) <= 5e-19)) tmp = Float64(Float64(y / t) * z); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z / t) <= -5e-96) || ~(((z / t) <= 5e-19))) tmp = (y / t) * z; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(z / t), $MachinePrecision], -5e-96], N[Not[LessEqual[N[(z / t), $MachinePrecision], 5e-19]], $MachinePrecision]], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{-96} \lor \neg \left(\frac{z}{t} \leq 5 \cdot 10^{-19}\right):\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
\end{array}
if (/.f64 z t) < -4.99999999999999995e-96 or 5.0000000000000004e-19 < (/.f64 z t) Initial program 95.5%
Taylor expanded in x around 0
associate-*l/N/A
lower-*.f64N/A
lower-/.f6455.4
Applied rewrites55.4%
if -4.99999999999999995e-96 < (/.f64 z t) < 5.0000000000000004e-19Initial program 99.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f6482.1
Applied rewrites82.1%
Taylor expanded in z around 0
Applied rewrites82.1%
Final simplification65.9%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) -5e-96) (* (/ z t) y) (if (<= (/ z t) 5e-19) (* 1.0 x) (* (/ y t) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -5e-96) {
tmp = (z / t) * y;
} else if ((z / t) <= 5e-19) {
tmp = 1.0 * x;
} else {
tmp = (y / 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 ((z / t) <= (-5d-96)) then
tmp = (z / t) * y
else if ((z / t) <= 5d-19) then
tmp = 1.0d0 * x
else
tmp = (y / t) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= -5e-96) {
tmp = (z / t) * y;
} else if ((z / t) <= 5e-19) {
tmp = 1.0 * x;
} else {
tmp = (y / t) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z / t) <= -5e-96: tmp = (z / t) * y elif (z / t) <= 5e-19: tmp = 1.0 * x else: tmp = (y / t) * z return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= -5e-96) tmp = Float64(Float64(z / t) * y); elseif (Float64(z / t) <= 5e-19) tmp = Float64(1.0 * x); else tmp = Float64(Float64(y / t) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z / t) <= -5e-96) tmp = (z / t) * y; elseif ((z / t) <= 5e-19) tmp = 1.0 * x; else tmp = (y / t) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], -5e-96], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[N[(z / t), $MachinePrecision], 5e-19], N[(1.0 * x), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq -5 \cdot 10^{-96}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\mathbf{elif}\;\frac{z}{t} \leq 5 \cdot 10^{-19}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\end{array}
\end{array}
if (/.f64 z t) < -4.99999999999999995e-96Initial program 97.7%
Taylor expanded in x around 0
associate-*l/N/A
lower-*.f64N/A
lower-/.f6458.3
Applied rewrites58.3%
Applied rewrites62.2%
if -4.99999999999999995e-96 < (/.f64 z t) < 5.0000000000000004e-19Initial program 99.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f6482.1
Applied rewrites82.1%
Taylor expanded in z around 0
Applied rewrites82.1%
if 5.0000000000000004e-19 < (/.f64 z t) Initial program 92.3%
Taylor expanded in x around 0
associate-*l/N/A
lower-*.f64N/A
lower-/.f6451.1
Applied rewrites51.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ z t) 2e+44) (fma z (/ y t) x) (* (/ (- x) t) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z / t) <= 2e+44) {
tmp = fma(z, (y / t), x);
} else {
tmp = (-x / t) * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z / t) <= 2e+44) tmp = fma(z, Float64(y / t), x); else tmp = Float64(Float64(Float64(-x) / t) * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z / t), $MachinePrecision], 2e+44], N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision], N[(N[((-x) / t), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{z}{t} \leq 2 \cdot 10^{+44}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-x}{t} \cdot z\\
\end{array}
\end{array}
if (/.f64 z t) < 2.0000000000000002e44Initial program 98.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6492.5
Applied rewrites92.5%
Taylor expanded in x around 0
lower-/.f6479.2
Applied rewrites79.2%
if 2.0000000000000002e44 < (/.f64 z t) Initial program 90.8%
Taylor expanded in z around inf
div-subN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6498.0
Applied rewrites98.0%
Taylor expanded in x around inf
Applied rewrites59.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.5e-175) (not (<= z 6.5e-143))) (fma z (/ (- y x) t) x) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.5e-175) || !(z <= 6.5e-143)) {
tmp = fma(z, ((y - x) / t), x);
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.5e-175) || !(z <= 6.5e-143)) tmp = fma(z, Float64(Float64(y - x) / t), x); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.5e-175], N[Not[LessEqual[z, 6.5e-143]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-175} \lor \neg \left(z \leq 6.5 \cdot 10^{-143}\right):\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y - x}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if z < -8.5000000000000005e-175 or 6.4999999999999999e-143 < z Initial program 96.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
if -8.5000000000000005e-175 < z < 6.4999999999999999e-143Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
lower-*.f6496.0
Applied rewrites96.0%
Final simplification97.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.4e+44) (not (<= x 2.55e-12))) (* (- 1.0 (/ z t)) x) (fma z (/ y t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.4e+44) || !(x <= 2.55e-12)) {
tmp = (1.0 - (z / t)) * x;
} else {
tmp = fma(z, (y / t), x);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.4e+44) || !(x <= 2.55e-12)) tmp = Float64(Float64(1.0 - Float64(z / t)) * x); else tmp = fma(z, Float64(y / t), x); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.4e+44], N[Not[LessEqual[x, 2.55e-12]], $MachinePrecision]], N[(N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+44} \lor \neg \left(x \leq 2.55 \cdot 10^{-12}\right):\\
\;\;\;\;\left(1 - \frac{z}{t}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{t}, x\right)\\
\end{array}
\end{array}
if x < -4.39999999999999991e44 or 2.54999999999999984e-12 < x Initial program 99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f6488.4
Applied rewrites88.4%
if -4.39999999999999991e44 < x < 2.54999999999999984e-12Initial program 94.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6496.4
Applied rewrites96.4%
Taylor expanded in x around 0
lower-/.f6482.3
Applied rewrites82.3%
Final simplification85.1%
(FPCore (x y z t) :precision binary64 (if (<= x 7.6e+208) (fma z (/ y t) x) (* (/ (- z) t) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 7.6e+208) {
tmp = fma(z, (y / t), x);
} else {
tmp = (-z / t) * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= 7.6e+208) tmp = fma(z, Float64(y / t), x); else tmp = Float64(Float64(Float64(-z) / t) * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, 7.6e+208], N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision], N[(N[((-z) / t), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.6 \cdot 10^{+208}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-z}{t} \cdot x\\
\end{array}
\end{array}
if x < 7.6000000000000004e208Initial program 96.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6493.5
Applied rewrites93.5%
Taylor expanded in x around 0
lower-/.f6474.9
Applied rewrites74.9%
if 7.6000000000000004e208 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f6494.8
Applied rewrites94.8%
Taylor expanded in z around inf
Applied rewrites73.0%
(FPCore (x y z t) :precision binary64 (fma z (/ y t) x))
double code(double x, double y, double z, double t) {
return fma(z, (y / t), x);
}
function code(x, y, z, t) return fma(z, Float64(y / t), x) end
code[x_, y_, z_, t_] := N[(z * N[(y / t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \frac{y}{t}, x\right)
\end{array}
Initial program 96.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6493.6
Applied rewrites93.6%
Taylor expanded in x around 0
lower-/.f6472.8
Applied rewrites72.8%
(FPCore (x y z t) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t) {
return 1.0 * 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 = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t) {
return 1.0 * x;
}
def code(x, y, z, t): return 1.0 * x
function code(x, y, z, t) return Float64(1.0 * x) end
function tmp = code(x, y, z, t) tmp = 1.0 * x; end
code[x_, y_, z_, t_] := N[(1.0 * x), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 96.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f6463.0
Applied rewrites63.0%
Taylor expanded in z around 0
Applied rewrites35.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y x) (/ z t))) (t_2 (+ x (/ (- y x) (/ t z)))))
(if (< t_1 -1013646692435.8867)
t_2
(if (< t_1 0.0) (+ x (/ (* (- y x) z) t)) t_2))))
double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double t_2 = x + ((y - x) / (t / z));
double tmp;
if (t_1 < -1013646692435.8867) {
tmp = t_2;
} else if (t_1 < 0.0) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (y - x) * (z / t)
t_2 = x + ((y - x) / (t / z))
if (t_1 < (-1013646692435.8867d0)) then
tmp = t_2
else if (t_1 < 0.0d0) then
tmp = x + (((y - x) * z) / t)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y - x) * (z / t);
double t_2 = x + ((y - x) / (t / z));
double tmp;
if (t_1 < -1013646692435.8867) {
tmp = t_2;
} else if (t_1 < 0.0) {
tmp = x + (((y - x) * z) / t);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - x) * (z / t) t_2 = x + ((y - x) / (t / z)) tmp = 0 if t_1 < -1013646692435.8867: tmp = t_2 elif t_1 < 0.0: tmp = x + (((y - x) * z) / t) else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - x) * Float64(z / t)) t_2 = Float64(x + Float64(Float64(y - x) / Float64(t / z))) tmp = 0.0 if (t_1 < -1013646692435.8867) tmp = t_2; elseif (t_1 < 0.0) tmp = Float64(x + Float64(Float64(Float64(y - x) * z) / t)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - x) * (z / t); t_2 = x + ((y - x) / (t / z)); tmp = 0.0; if (t_1 < -1013646692435.8867) tmp = t_2; elseif (t_1 < 0.0) tmp = x + (((y - x) * z) / t); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$1, -1013646692435.8867], t$95$2, If[Less[t$95$1, 0.0], N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - x\right) \cdot \frac{z}{t}\\
t_2 := x + \frac{y - x}{\frac{t}{z}}\\
\mathbf{if}\;t\_1 < -1013646692435.8867:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 < 0:\\
\;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2024339
(FPCore (x y z t)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
:precision binary64
:alt
(! :herbie-platform default (if (< (* (- y x) (/ z t)) -10136466924358867/10000) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) 0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z))))))
(+ x (* (- y x) (/ z t))))