
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
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) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
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) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t z) (- a z))) (t_2 (+ x (* t (/ y (- a z))))))
(if (<= t_1 -1e+16)
t_2
(if (<= t_1 0.02)
(- x (* y (/ (- z t) a)))
(if (<= t_1 20000000000.0) (+ x (* y (- 1.0 (/ t z)))) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) / (a - z);
double t_2 = x + (t * (y / (a - z)));
double tmp;
if (t_1 <= -1e+16) {
tmp = t_2;
} else if (t_1 <= 0.02) {
tmp = x - (y * ((z - t) / a));
} else if (t_1 <= 20000000000.0) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (t - z) / (a - z)
t_2 = x + (t * (y / (a - z)))
if (t_1 <= (-1d+16)) then
tmp = t_2
else if (t_1 <= 0.02d0) then
tmp = x - (y * ((z - t) / a))
else if (t_1 <= 20000000000.0d0) then
tmp = x + (y * (1.0d0 - (t / z)))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) / (a - z);
double t_2 = x + (t * (y / (a - z)));
double tmp;
if (t_1 <= -1e+16) {
tmp = t_2;
} else if (t_1 <= 0.02) {
tmp = x - (y * ((z - t) / a));
} else if (t_1 <= 20000000000.0) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t - z) / (a - z) t_2 = x + (t * (y / (a - z))) tmp = 0 if t_1 <= -1e+16: tmp = t_2 elif t_1 <= 0.02: tmp = x - (y * ((z - t) / a)) elif t_1 <= 20000000000.0: tmp = x + (y * (1.0 - (t / z))) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t - z) / Float64(a - z)) t_2 = Float64(x + Float64(t * Float64(y / Float64(a - z)))) tmp = 0.0 if (t_1 <= -1e+16) tmp = t_2; elseif (t_1 <= 0.02) tmp = Float64(x - Float64(y * Float64(Float64(z - t) / a))); elseif (t_1 <= 20000000000.0) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t - z) / (a - z); t_2 = x + (t * (y / (a - z))); tmp = 0.0; if (t_1 <= -1e+16) tmp = t_2; elseif (t_1 <= 0.02) tmp = x - (y * ((z - t) / a)); elseif (t_1 <= 20000000000.0) tmp = x + (y * (1.0 - (t / z))); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+16], t$95$2, If[LessEqual[t$95$1, 0.02], N[(x - N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 20000000000.0], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - z}{a - z}\\
t_2 := x + t \cdot \frac{y}{a - z}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+16}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.02:\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\
\mathbf{elif}\;t\_1 \leq 20000000000:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -1e16 or 2e10 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 93.2%
associate-*r/89.6%
Simplified89.6%
Taylor expanded in t around inf 89.6%
mul-1-neg89.6%
associate-/l*98.6%
distribute-rgt-neg-in98.6%
distribute-neg-frac298.6%
neg-sub098.6%
sub-neg98.6%
+-commutative98.6%
associate--r+98.6%
neg-sub098.6%
remove-double-neg98.6%
Simplified98.6%
if -1e16 < (/.f64 (-.f64 z t) (-.f64 z a)) < 0.0200000000000000004Initial program 98.5%
+-commutative98.5%
fma-define98.6%
Simplified98.6%
Taylor expanded in a around inf 95.4%
+-commutative95.4%
mul-1-neg95.4%
associate-/l*98.5%
distribute-rgt-neg-in98.5%
distribute-frac-neg98.5%
neg-sub098.5%
sub-neg98.5%
+-commutative98.5%
associate--r+98.5%
neg-sub098.5%
remove-double-neg98.5%
Simplified98.5%
if 0.0200000000000000004 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2e10Initial program 100.0%
associate-*r/71.2%
Simplified71.2%
Taylor expanded in a around 0 71.2%
associate-/l*100.0%
div-sub100.0%
*-inverses100.0%
Simplified100.0%
Final simplification99.1%
(FPCore (x y z t a) :precision binary64 (fma y (/ (- t z) (- a z)) x))
double code(double x, double y, double z, double t, double a) {
return fma(y, ((t - z) / (a - z)), x);
}
function code(x, y, z, t, a) return fma(y, Float64(Float64(t - z) / Float64(a - z)), x) end
code[x_, y_, z_, t_, a_] := N[(y * N[(N[(t - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{t - z}{a - z}, x\right)
\end{array}
Initial program 97.6%
+-commutative97.6%
fma-define97.6%
Simplified97.6%
Final simplification97.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t z) (- a z))) (t_2 (/ (* y t) (- a z))))
(if (<= t_1 -4e+124)
t_2
(if (<= t_1 -1e+15)
(- x (* y (/ t z)))
(if (<= t_1 0.02)
(+ x (* t (/ y a)))
(if (<= t_1 1e+94) (+ y x) t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) / (a - z);
double t_2 = (y * t) / (a - z);
double tmp;
if (t_1 <= -4e+124) {
tmp = t_2;
} else if (t_1 <= -1e+15) {
tmp = x - (y * (t / z));
} else if (t_1 <= 0.02) {
tmp = x + (t * (y / a));
} else if (t_1 <= 1e+94) {
tmp = y + x;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (t - z) / (a - z)
t_2 = (y * t) / (a - z)
if (t_1 <= (-4d+124)) then
tmp = t_2
else if (t_1 <= (-1d+15)) then
tmp = x - (y * (t / z))
else if (t_1 <= 0.02d0) then
tmp = x + (t * (y / a))
else if (t_1 <= 1d+94) then
tmp = y + x
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) / (a - z);
double t_2 = (y * t) / (a - z);
double tmp;
if (t_1 <= -4e+124) {
tmp = t_2;
} else if (t_1 <= -1e+15) {
tmp = x - (y * (t / z));
} else if (t_1 <= 0.02) {
tmp = x + (t * (y / a));
} else if (t_1 <= 1e+94) {
tmp = y + x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t - z) / (a - z) t_2 = (y * t) / (a - z) tmp = 0 if t_1 <= -4e+124: tmp = t_2 elif t_1 <= -1e+15: tmp = x - (y * (t / z)) elif t_1 <= 0.02: tmp = x + (t * (y / a)) elif t_1 <= 1e+94: tmp = y + x else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t - z) / Float64(a - z)) t_2 = Float64(Float64(y * t) / Float64(a - z)) tmp = 0.0 if (t_1 <= -4e+124) tmp = t_2; elseif (t_1 <= -1e+15) tmp = Float64(x - Float64(y * Float64(t / z))); elseif (t_1 <= 0.02) tmp = Float64(x + Float64(t * Float64(y / a))); elseif (t_1 <= 1e+94) tmp = Float64(y + x); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t - z) / (a - z); t_2 = (y * t) / (a - z); tmp = 0.0; if (t_1 <= -4e+124) tmp = t_2; elseif (t_1 <= -1e+15) tmp = x - (y * (t / z)); elseif (t_1 <= 0.02) tmp = x + (t * (y / a)); elseif (t_1 <= 1e+94) tmp = y + x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+124], t$95$2, If[LessEqual[t$95$1, -1e+15], N[(x - N[(y * N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.02], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+94], N[(y + x), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - z}{a - z}\\
t_2 := \frac{y \cdot t}{a - z}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+124}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -1 \cdot 10^{+15}:\\
\;\;\;\;x - y \cdot \frac{t}{z}\\
\mathbf{elif}\;t\_1 \leq 0.02:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{+94}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < -3.99999999999999979e124 or 1e94 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 87.8%
+-commutative87.8%
fma-define87.8%
Simplified87.8%
Taylor expanded in y around inf 83.0%
associate--l+83.0%
div-sub83.0%
Simplified83.0%
Taylor expanded in t around inf 85.1%
associate-*r/85.1%
mul-1-neg85.1%
*-commutative85.1%
Simplified85.1%
if -3.99999999999999979e124 < (/.f64 (-.f64 z t) (-.f64 z a)) < -1e15Initial program 99.9%
associate-*r/81.9%
Simplified81.9%
Taylor expanded in t around inf 82.0%
associate-*r/82.0%
mul-1-neg82.0%
distribute-lft-neg-out82.0%
*-commutative82.0%
Simplified82.0%
Taylor expanded in z around inf 68.5%
mul-1-neg68.5%
associate-/l*77.7%
distribute-rgt-neg-in77.7%
Simplified77.7%
*-commutative77.7%
distribute-neg-frac77.7%
associate-*l/68.5%
Applied egg-rr68.5%
Taylor expanded in x around 0 68.5%
mul-1-neg68.5%
associate-*l/81.9%
distribute-lft-neg-in81.9%
cancel-sign-sub-inv81.9%
*-commutative81.9%
Simplified81.9%
if -1e15 < (/.f64 (-.f64 z t) (-.f64 z a)) < 0.0200000000000000004Initial program 98.5%
+-commutative98.5%
fma-define98.5%
Simplified98.5%
Taylor expanded in z around 0 84.7%
+-commutative84.7%
associate-/l*87.0%
Simplified87.0%
if 0.0200000000000000004 < (/.f64 (-.f64 z t) (-.f64 z a)) < 1e94Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 93.9%
+-commutative93.9%
Simplified93.9%
Final simplification89.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t z) (- a z))))
(if (or (<= t_1 0.02) (not (<= t_1 20000000000.0)))
(+ x (* t (/ y (- a z))))
(+ x (* y (- 1.0 (/ t z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) / (a - z);
double tmp;
if ((t_1 <= 0.02) || !(t_1 <= 20000000000.0)) {
tmp = x + (t * (y / (a - z)));
} else {
tmp = x + (y * (1.0 - (t / z)));
}
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 = (t - z) / (a - z)
if ((t_1 <= 0.02d0) .or. (.not. (t_1 <= 20000000000.0d0))) then
tmp = x + (t * (y / (a - z)))
else
tmp = x + (y * (1.0d0 - (t / z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) / (a - z);
double tmp;
if ((t_1 <= 0.02) || !(t_1 <= 20000000000.0)) {
tmp = x + (t * (y / (a - z)));
} else {
tmp = x + (y * (1.0 - (t / z)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t - z) / (a - z) tmp = 0 if (t_1 <= 0.02) or not (t_1 <= 20000000000.0): tmp = x + (t * (y / (a - z))) else: tmp = x + (y * (1.0 - (t / z))) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t - z) / Float64(a - z)) tmp = 0.0 if ((t_1 <= 0.02) || !(t_1 <= 20000000000.0)) tmp = Float64(x + Float64(t * Float64(y / Float64(a - z)))); else tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t - z) / (a - z); tmp = 0.0; if ((t_1 <= 0.02) || ~((t_1 <= 20000000000.0))) tmp = x + (t * (y / (a - z))); else tmp = x + (y * (1.0 - (t / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, 0.02], N[Not[LessEqual[t$95$1, 20000000000.0]], $MachinePrecision]], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - z}{a - z}\\
\mathbf{if}\;t\_1 \leq 0.02 \lor \neg \left(t\_1 \leq 20000000000\right):\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 0.0200000000000000004 or 2e10 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 96.1%
associate-*r/92.8%
Simplified92.8%
Taylor expanded in t around inf 87.0%
mul-1-neg87.0%
associate-/l*91.7%
distribute-rgt-neg-in91.7%
distribute-neg-frac291.7%
neg-sub091.7%
sub-neg91.7%
+-commutative91.7%
associate--r+91.7%
neg-sub091.7%
remove-double-neg91.7%
Simplified91.7%
if 0.0200000000000000004 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2e10Initial program 100.0%
associate-*r/71.2%
Simplified71.2%
Taylor expanded in a around 0 71.2%
associate-/l*100.0%
div-sub100.0%
*-inverses100.0%
Simplified100.0%
Final simplification94.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- t z) (- a z))))
(if (or (<= t_1 0.02) (not (<= t_1 20000000000.0)))
(+ x (* t (/ y (- a z))))
(+ y x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) / (a - z);
double tmp;
if ((t_1 <= 0.02) || !(t_1 <= 20000000000.0)) {
tmp = x + (t * (y / (a - z)));
} else {
tmp = y + x;
}
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 = (t - z) / (a - z)
if ((t_1 <= 0.02d0) .or. (.not. (t_1 <= 20000000000.0d0))) then
tmp = x + (t * (y / (a - z)))
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (t - z) / (a - z);
double tmp;
if ((t_1 <= 0.02) || !(t_1 <= 20000000000.0)) {
tmp = x + (t * (y / (a - z)));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t - z) / (a - z) tmp = 0 if (t_1 <= 0.02) or not (t_1 <= 20000000000.0): tmp = x + (t * (y / (a - z))) else: tmp = y + x return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t - z) / Float64(a - z)) tmp = 0.0 if ((t_1 <= 0.02) || !(t_1 <= 20000000000.0)) tmp = Float64(x + Float64(t * Float64(y / Float64(a - z)))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t - z) / (a - z); tmp = 0.0; if ((t_1 <= 0.02) || ~((t_1 <= 20000000000.0))) tmp = x + (t * (y / (a - z))); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, 0.02], N[Not[LessEqual[t$95$1, 20000000000.0]], $MachinePrecision]], N[(x + N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - z}{a - z}\\
\mathbf{if}\;t\_1 \leq 0.02 \lor \neg \left(t\_1 \leq 20000000000\right):\\
\;\;\;\;x + t \cdot \frac{y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 0.0200000000000000004 or 2e10 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 96.1%
associate-*r/92.8%
Simplified92.8%
Taylor expanded in t around inf 87.0%
mul-1-neg87.0%
associate-/l*91.7%
distribute-rgt-neg-in91.7%
distribute-neg-frac291.7%
neg-sub091.7%
sub-neg91.7%
+-commutative91.7%
associate--r+91.7%
neg-sub091.7%
remove-double-neg91.7%
Simplified91.7%
if 0.0200000000000000004 < (/.f64 (-.f64 z t) (-.f64 z a)) < 2e10Initial program 100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 98.8%
+-commutative98.8%
Simplified98.8%
Final simplification94.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.82e+21) (not (<= z 4.1e+34))) (+ y x) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.82e+21) || !(z <= 4.1e+34)) {
tmp = y + x;
} else {
tmp = x + (t * (y / a));
}
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 <= (-1.82d+21)) .or. (.not. (z <= 4.1d+34))) then
tmp = y + x
else
tmp = x + (t * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.82e+21) || !(z <= 4.1e+34)) {
tmp = y + x;
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.82e+21) or not (z <= 4.1e+34): tmp = y + x else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.82e+21) || !(z <= 4.1e+34)) tmp = Float64(y + x); else tmp = Float64(x + Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.82e+21) || ~((z <= 4.1e+34))) tmp = y + x; else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.82e+21], N[Not[LessEqual[z, 4.1e+34]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.82 \cdot 10^{+21} \lor \neg \left(z \leq 4.1 \cdot 10^{+34}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.82e21 or 4.0999999999999998e34 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 84.8%
+-commutative84.8%
Simplified84.8%
if -1.82e21 < z < 4.0999999999999998e34Initial program 95.1%
+-commutative95.1%
fma-define95.1%
Simplified95.1%
Taylor expanded in z around 0 80.9%
+-commutative80.9%
associate-/l*84.6%
Simplified84.6%
Final simplification84.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.95e+21) (not (<= z 3.85e+34))) (+ y x) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.95e+21) || !(z <= 3.85e+34)) {
tmp = y + x;
} else {
tmp = x + ((y * t) / a);
}
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 <= (-1.95d+21)) .or. (.not. (z <= 3.85d+34))) then
tmp = y + x
else
tmp = x + ((y * t) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.95e+21) || !(z <= 3.85e+34)) {
tmp = y + x;
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.95e+21) or not (z <= 3.85e+34): tmp = y + x else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.95e+21) || !(z <= 3.85e+34)) tmp = Float64(y + x); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.95e+21) || ~((z <= 3.85e+34))) tmp = y + x; else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.95e+21], N[Not[LessEqual[z, 3.85e+34]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+21} \lor \neg \left(z \leq 3.85 \cdot 10^{+34}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -1.95e21 or 3.8499999999999999e34 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 84.8%
+-commutative84.8%
Simplified84.8%
if -1.95e21 < z < 3.8499999999999999e34Initial program 95.1%
associate-*r/96.0%
Simplified96.0%
Taylor expanded in z around 0 80.9%
Final simplification82.9%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- t z) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((t - z) / (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 * ((t - z) / (a - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((t - z) / (a - z)));
}
def code(x, y, z, t, a): return x + (y * ((t - z) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(t - z) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((t - z) / (a - z))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{t - z}{a - z}
\end{array}
Initial program 97.6%
Final simplification97.6%
(FPCore (x y z t a) :precision binary64 (if (<= a 9.2e+48) (+ y x) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 9.2e+48) {
tmp = y + x;
} else {
tmp = x;
}
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 (a <= 9.2d+48) then
tmp = y + x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 9.2e+48) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= 9.2e+48: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= 9.2e+48) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= 9.2e+48) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 9.2e+48], N[(y + x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 9.2 \cdot 10^{+48}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < 9.2000000000000001e48Initial program 97.1%
+-commutative97.1%
fma-define97.2%
Simplified97.2%
Taylor expanded in z around inf 65.0%
+-commutative65.0%
Simplified65.0%
if 9.2000000000000001e48 < a Initial program 99.6%
+-commutative99.6%
fma-define99.6%
Simplified99.6%
Taylor expanded in y around 0 74.2%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 97.6%
+-commutative97.6%
fma-define97.6%
Simplified97.6%
Taylor expanded in y around 0 51.2%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- z a) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - 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 + (y / ((z - a) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((z - a) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((z - a) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
herbie shell --seed 2024111
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
:alt
(+ x (/ y (/ (- z a) (- z t))))
(+ x (* y (/ (- z t) (- z a)))))