
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * t) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (((y - z) * t) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ (- y z) (- a z)) t x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (a - z)), t, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(a - z)), t, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{a - z}, t, x\right)
\end{array}
Initial program 85.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6498.3
Applied rewrites98.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ t (- a z)) (- y z))) (t_2 (/ (* t (- y z)) (- a z))))
(if (<= t_2 -2e+61)
t_1
(if (<= t_2 1e+79) (fma (/ z (- a z)) (- t) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t / (a - z)) * (y - z);
double t_2 = (t * (y - z)) / (a - z);
double tmp;
if (t_2 <= -2e+61) {
tmp = t_1;
} else if (t_2 <= 1e+79) {
tmp = fma((z / (a - z)), -t, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t / Float64(a - z)) * Float64(y - z)) t_2 = Float64(Float64(t * Float64(y - z)) / Float64(a - z)) tmp = 0.0 if (t_2 <= -2e+61) tmp = t_1; elseif (t_2 <= 1e+79) tmp = fma(Float64(z / Float64(a - z)), Float64(-t), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+61], t$95$1, If[LessEqual[t$95$2, 1e+79], N[(N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision] * (-t) + x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{a - z} \cdot \left(y - z\right)\\
t_2 := \frac{t \cdot \left(y - z\right)}{a - z}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+79}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{a - z}, -t, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -1.9999999999999999e61 or 9.99999999999999967e78 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) Initial program 67.3%
Taylor expanded in x around 0
associate-/l*N/A
div-subN/A
distribute-lft-out--N/A
associate-/l*N/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-*r/N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6487.1
Applied rewrites87.1%
if -1.9999999999999999e61 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < 9.99999999999999967e78Initial program 98.7%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f6488.0
Applied rewrites88.0%
Final simplification87.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- 1.0 (/ y z)) t x)))
(if (<= z -1.9e-37)
t_1
(if (<= z 11500000000000.0) (fma (- y z) (/ t a) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((1.0 - (y / z)), t, x);
double tmp;
if (z <= -1.9e-37) {
tmp = t_1;
} else if (z <= 11500000000000.0) {
tmp = fma((y - z), (t / a), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(1.0 - Float64(y / z)), t, x) tmp = 0.0 if (z <= -1.9e-37) tmp = t_1; elseif (z <= 11500000000000.0) tmp = fma(Float64(y - z), Float64(t / a), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]}, If[LessEqual[z, -1.9e-37], t$95$1, If[LessEqual[z, 11500000000000.0], N[(N[(y - z), $MachinePrecision] * N[(t / a), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - \frac{y}{z}, t, x\right)\\
\mathbf{if}\;z \leq -1.9 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 11500000000000:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.9000000000000002e-37 or 1.15e13 < z Initial program 79.4%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6487.3
Applied rewrites87.3%
if -1.9000000000000002e-37 < z < 1.15e13Initial program 92.2%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6485.8
Applied rewrites85.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- 1.0 (/ y z)) t x)))
(if (<= z -3.3e-37)
t_1
(if (<= z 11500000000000.0) (fma (/ t a) y x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((1.0 - (y / z)), t, x);
double tmp;
if (z <= -3.3e-37) {
tmp = t_1;
} else if (z <= 11500000000000.0) {
tmp = fma((t / a), y, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(1.0 - Float64(y / z)), t, x) tmp = 0.0 if (z <= -3.3e-37) tmp = t_1; elseif (z <= 11500000000000.0) tmp = fma(Float64(t / a), y, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] * t + x), $MachinePrecision]}, If[LessEqual[z, -3.3e-37], t$95$1, If[LessEqual[z, 11500000000000.0], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(1 - \frac{y}{z}, t, x\right)\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{-37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 11500000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.29999999999999982e-37 or 1.15e13 < z Initial program 79.4%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6487.3
Applied rewrites87.3%
if -3.29999999999999982e-37 < z < 1.15e13Initial program 92.2%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
Taylor expanded in a around 0
associate-*r/N/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--.f6445.9
Applied rewrites45.9%
Taylor expanded in z around 0
+-commutativeN/A
remove-double-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-outN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
neg-mul-1N/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f6480.3
Applied rewrites80.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.5e+73) (+ x t) (if (<= z 64000000000000.0) (fma (/ t a) y x) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e+73) {
tmp = x + t;
} else if (z <= 64000000000000.0) {
tmp = fma((t / a), y, x);
} else {
tmp = x + t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.5e+73) tmp = Float64(x + t); elseif (z <= 64000000000000.0) tmp = fma(Float64(t / a), y, x); else tmp = Float64(x + t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.5e+73], N[(x + t), $MachinePrecision], If[LessEqual[z, 64000000000000.0], N[(N[(t / a), $MachinePrecision] * y + x), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+73}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 64000000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -5.5000000000000003e73 or 6.4e13 < z Initial program 75.0%
Taylor expanded in z around inf
lower-+.f6483.0
Applied rewrites83.0%
if -5.5000000000000003e73 < z < 6.4e13Initial program 93.0%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6497.1
Applied rewrites97.1%
Taylor expanded in a around 0
associate-*r/N/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--.f6452.4
Applied rewrites52.4%
Taylor expanded in z around 0
+-commutativeN/A
remove-double-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-outN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
neg-mul-1N/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f6473.7
Applied rewrites73.7%
Final simplification77.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.5e+73) (+ x t) (if (<= z 64000000000000.0) (fma (/ y a) t x) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.5e+73) {
tmp = x + t;
} else if (z <= 64000000000000.0) {
tmp = fma((y / a), t, x);
} else {
tmp = x + t;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.5e+73) tmp = Float64(x + t); elseif (z <= 64000000000000.0) tmp = fma(Float64(y / a), t, x); else tmp = Float64(x + t); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.5e+73], N[(x + t), $MachinePrecision], If[LessEqual[z, 64000000000000.0], N[(N[(y / a), $MachinePrecision] * t + x), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+73}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 64000000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{a}, t, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -5.5000000000000003e73 or 6.4e13 < z Initial program 75.0%
Taylor expanded in z around inf
lower-+.f6483.0
Applied rewrites83.0%
if -5.5000000000000003e73 < z < 6.4e13Initial program 93.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6470.1
Applied rewrites70.1%
Final simplification75.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.1e-253) (+ x t) (if (<= z 9.2e-40) (* (/ t a) y) (+ x t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.1e-253) {
tmp = x + t;
} else if (z <= 9.2e-40) {
tmp = (t / a) * y;
} else {
tmp = x + t;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-3.1d-253)) then
tmp = x + t
else if (z <= 9.2d-40) then
tmp = (t / a) * y
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.1e-253) {
tmp = x + t;
} else if (z <= 9.2e-40) {
tmp = (t / a) * y;
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.1e-253: tmp = x + t elif z <= 9.2e-40: tmp = (t / a) * y else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.1e-253) tmp = Float64(x + t); elseif (z <= 9.2e-40) tmp = Float64(Float64(t / a) * y); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.1e-253) tmp = x + t; elseif (z <= 9.2e-40) tmp = (t / a) * y; else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.1e-253], N[(x + t), $MachinePrecision], If[LessEqual[z, 9.2e-40], N[(N[(t / a), $MachinePrecision] * y), $MachinePrecision], N[(x + t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{-253}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-40}:\\
\;\;\;\;\frac{t}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -3.09999999999999996e-253 or 9.2e-40 < z Initial program 82.3%
Taylor expanded in z around inf
lower-+.f6468.6
Applied rewrites68.6%
if -3.09999999999999996e-253 < z < 9.2e-40Initial program 94.4%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.9
Applied rewrites93.9%
Taylor expanded in a around 0
associate-*r/N/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--.f6439.7
Applied rewrites39.7%
Taylor expanded in z around 0
+-commutativeN/A
remove-double-negN/A
*-commutativeN/A
associate-/l*N/A
distribute-rgt-neg-outN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
neg-mul-1N/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f6485.5
Applied rewrites85.5%
Taylor expanded in x around 0
Applied rewrites52.8%
Final simplification64.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (/ y a) t))) (if (<= t -3.8e+193) t_1 (if (<= t 2.9e+226) (+ x t) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * t;
double tmp;
if (t <= -3.8e+193) {
tmp = t_1;
} else if (t <= 2.9e+226) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y / a) * t
if (t <= (-3.8d+193)) then
tmp = t_1
else if (t <= 2.9d+226) then
tmp = x + t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * t;
double tmp;
if (t <= -3.8e+193) {
tmp = t_1;
} else if (t <= 2.9e+226) {
tmp = x + t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * t tmp = 0 if t <= -3.8e+193: tmp = t_1 elif t <= 2.9e+226: tmp = x + t else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * t) tmp = 0.0 if (t <= -3.8e+193) tmp = t_1; elseif (t <= 2.9e+226) tmp = Float64(x + t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * t; tmp = 0.0; if (t <= -3.8e+193) tmp = t_1; elseif (t <= 2.9e+226) tmp = x + t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -3.8e+193], t$95$1, If[LessEqual[t, 2.9e+226], N[(x + t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot t\\
\mathbf{if}\;t \leq -3.8 \cdot 10^{+193}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{+226}:\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.79999999999999972e193 or 2.89999999999999974e226 < t Initial program 65.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6499.3
Applied rewrites99.3%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6471.0
Applied rewrites71.0%
Taylor expanded in y around inf
Applied rewrites43.2%
Applied rewrites58.5%
if -3.79999999999999972e193 < t < 2.89999999999999974e226Initial program 89.6%
Taylor expanded in z around inf
lower-+.f6465.0
Applied rewrites65.0%
Final simplification63.9%
(FPCore (x y z t a) :precision binary64 (+ x t))
double code(double x, double y, double z, double t, double a) {
return x + t;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + t
end function
public static double code(double x, double y, double z, double t, double a) {
return x + t;
}
def code(x, y, z, t, a): return x + t
function code(x, y, z, t, a) return Float64(x + t) end
function tmp = code(x, y, z, t, a) tmp = x + t; end
code[x_, y_, z_, t_, a_] := N[(x + t), $MachinePrecision]
\begin{array}{l}
\\
x + t
\end{array}
Initial program 85.5%
Taylor expanded in z around inf
lower-+.f6458.5
Applied rewrites58.5%
Final simplification58.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y z) (- a z)) t))))
(if (< t -1.0682974490174067e-39)
t_1
(if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((y - z) / (a - z)) * t)
if (t < (-1.0682974490174067d-39)) then
tmp = t_1
else if (t < 3.9110949887586375d-141) then
tmp = x + (((y - z) * t) / (a - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - z) / (a - z)) * t) tmp = 0 if t < -1.0682974490174067e-39: tmp = t_1 elif t < 3.9110949887586375e-141: tmp = x + (((y - z) * t) / (a - z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) / Float64(a - z)) * t)) tmp = 0.0 if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - z) / (a - z)) * t); tmp = 0.0; if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = x + (((y - z) * t) / (a - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.0682974490174067e-39], t$95$1, If[Less[t, 3.9110949887586375e-141], N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - z}{a - z} \cdot t\\
\mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024296
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (if (< t -10682974490174067/10000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 312887599100691/80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t)))))
(+ x (/ (* (- y z) t) (- a z))))