
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\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 t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))) (t_2 (+ x (* z (/ y (- a t))))))
(if (<= t_1 -2000000000000.0)
t_2
(if (<= t_1 1e-10)
(+ x (* y (/ (- z t) a)))
(if (<= t_1 1.0) (+ y x) t_2)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double t_2 = x + (z * (y / (a - t)));
double tmp;
if (t_1 <= -2000000000000.0) {
tmp = t_2;
} else if (t_1 <= 1e-10) {
tmp = x + (y * ((z - t) / a));
} else if (t_1 <= 1.0) {
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 = (z - t) / (a - t)
t_2 = x + (z * (y / (a - t)))
if (t_1 <= (-2000000000000.0d0)) then
tmp = t_2
else if (t_1 <= 1d-10) then
tmp = x + (y * ((z - t) / a))
else if (t_1 <= 1.0d0) 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 = (z - t) / (a - t);
double t_2 = x + (z * (y / (a - t)));
double tmp;
if (t_1 <= -2000000000000.0) {
tmp = t_2;
} else if (t_1 <= 1e-10) {
tmp = x + (y * ((z - t) / a));
} else if (t_1 <= 1.0) {
tmp = y + x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) t_2 = x + (z * (y / (a - t))) tmp = 0 if t_1 <= -2000000000000.0: tmp = t_2 elif t_1 <= 1e-10: tmp = x + (y * ((z - t) / a)) elif t_1 <= 1.0: tmp = y + x else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) t_2 = Float64(x + Float64(z * Float64(y / Float64(a - t)))) tmp = 0.0 if (t_1 <= -2000000000000.0) tmp = t_2; elseif (t_1 <= 1e-10) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); elseif (t_1 <= 1.0) tmp = Float64(y + x); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (a - t); t_2 = x + (z * (y / (a - t))); tmp = 0.0; if (t_1 <= -2000000000000.0) tmp = t_2; elseif (t_1 <= 1e-10) tmp = x + (y * ((z - t) / a)); elseif (t_1 <= 1.0) tmp = y + x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2000000000000.0], t$95$2, If[LessEqual[t$95$1, 1e-10], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1.0], N[(y + x), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
t_2 := x + z \cdot \frac{y}{a - t}\\
\mathbf{if}\;t_1 \leq -2000000000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 10^{-10}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{elif}\;t_1 \leq 1:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -2e12 or 1 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 94.3%
Taylor expanded in z around inf 93.6%
div-inv93.6%
*-commutative93.6%
associate-*l*99.0%
div-inv99.1%
Applied egg-rr99.1%
if -2e12 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1.00000000000000004e-10Initial program 99.9%
Taylor expanded in a around inf 98.9%
if 1.00000000000000004e-10 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1Initial program 100.0%
Taylor expanded in t around inf 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.3%
(FPCore (x y z t a) :precision binary64 (fma y (/ (- z t) (- a t)) x))
double code(double x, double y, double z, double t, double a) {
return fma(y, ((z - t) / (a - t)), x);
}
function code(x, y, z, t, a) return fma(y, Float64(Float64(z - t) / Float64(a - t)), x) end
code[x_, y_, z_, t_, a_] := N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)
\end{array}
Initial program 98.1%
+-commutative98.1%
fma-def98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))))
(if (<= t_1 -2e+126)
(* y t_1)
(if (<= t_1 -5e-60)
(+ x (/ y (/ a z)))
(if (<= t_1 -1e-247)
(+ x (/ y (/ (- a) t)))
(if (<= t_1 1e-10)
(+ x (* y (/ z a)))
(if (<= t_1 1000.0) (+ y x) (+ x (* z (/ y a))))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -2e+126) {
tmp = y * t_1;
} else if (t_1 <= -5e-60) {
tmp = x + (y / (a / z));
} else if (t_1 <= -1e-247) {
tmp = x + (y / (-a / t));
} else if (t_1 <= 1e-10) {
tmp = x + (y * (z / a));
} else if (t_1 <= 1000.0) {
tmp = y + x;
} else {
tmp = x + (z * (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) :: t_1
real(8) :: tmp
t_1 = (z - t) / (a - t)
if (t_1 <= (-2d+126)) then
tmp = y * t_1
else if (t_1 <= (-5d-60)) then
tmp = x + (y / (a / z))
else if (t_1 <= (-1d-247)) then
tmp = x + (y / (-a / t))
else if (t_1 <= 1d-10) then
tmp = x + (y * (z / a))
else if (t_1 <= 1000.0d0) then
tmp = y + x
else
tmp = x + (z * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -2e+126) {
tmp = y * t_1;
} else if (t_1 <= -5e-60) {
tmp = x + (y / (a / z));
} else if (t_1 <= -1e-247) {
tmp = x + (y / (-a / t));
} else if (t_1 <= 1e-10) {
tmp = x + (y * (z / a));
} else if (t_1 <= 1000.0) {
tmp = y + x;
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) tmp = 0 if t_1 <= -2e+126: tmp = y * t_1 elif t_1 <= -5e-60: tmp = x + (y / (a / z)) elif t_1 <= -1e-247: tmp = x + (y / (-a / t)) elif t_1 <= 1e-10: tmp = x + (y * (z / a)) elif t_1 <= 1000.0: tmp = y + x else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= -2e+126) tmp = Float64(y * t_1); elseif (t_1 <= -5e-60) tmp = Float64(x + Float64(y / Float64(a / z))); elseif (t_1 <= -1e-247) tmp = Float64(x + Float64(y / Float64(Float64(-a) / t))); elseif (t_1 <= 1e-10) tmp = Float64(x + Float64(y * Float64(z / a))); elseif (t_1 <= 1000.0) tmp = Float64(y + x); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (a - t); tmp = 0.0; if (t_1 <= -2e+126) tmp = y * t_1; elseif (t_1 <= -5e-60) tmp = x + (y / (a / z)); elseif (t_1 <= -1e-247) tmp = x + (y / (-a / t)); elseif (t_1 <= 1e-10) tmp = x + (y * (z / a)); elseif (t_1 <= 1000.0) tmp = y + x; else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+126], N[(y * t$95$1), $MachinePrecision], If[LessEqual[t$95$1, -5e-60], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -1e-247], N[(x + N[(y / N[((-a) / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e-10], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1000.0], N[(y + x), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+126}:\\
\;\;\;\;y \cdot t_1\\
\mathbf{elif}\;t_1 \leq -5 \cdot 10^{-60}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{elif}\;t_1 \leq -1 \cdot 10^{-247}:\\
\;\;\;\;x + \frac{y}{\frac{-a}{t}}\\
\mathbf{elif}\;t_1 \leq 10^{-10}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{elif}\;t_1 \leq 1000:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -1.99999999999999985e126Initial program 96.6%
associate-*r/93.5%
Simplified93.5%
associate-/l*96.7%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 76.2%
div-sub76.2%
Simplified76.2%
if -1.99999999999999985e126 < (/.f64 (-.f64 z t) (-.f64 a t)) < -5.0000000000000001e-60Initial program 99.8%
Taylor expanded in t around 0 73.7%
+-commutative73.7%
associate-/l*77.0%
Simplified77.0%
if -5.0000000000000001e-60 < (/.f64 (-.f64 z t) (-.f64 a t)) < -1e-247Initial program 99.9%
associate-*r/95.7%
Simplified95.7%
associate-/l*99.9%
associate-/r/95.8%
Applied egg-rr95.8%
Taylor expanded in a around inf 95.7%
+-commutative95.7%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 99.2%
associate-*r/99.2%
neg-mul-199.2%
Simplified99.2%
if -1e-247 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1.00000000000000004e-10Initial program 99.9%
Taylor expanded in t around 0 90.0%
if 1.00000000000000004e-10 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1e3Initial program 100.0%
Taylor expanded in t around inf 99.0%
+-commutative99.0%
Simplified99.0%
if 1e3 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 89.6%
Taylor expanded in t around 0 67.8%
+-commutative67.8%
associate-/l*64.0%
Simplified64.0%
associate-/r/70.3%
Applied egg-rr70.3%
Final simplification88.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- z t) (- a t))))
(if (<= t_1 -2e+126)
(* y t_1)
(if (<= t_1 1e-10)
(+ x (* y (/ (- z t) a)))
(if (<= t_1 1000.0) (+ y x) (+ x (* z (/ y a))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -2e+126) {
tmp = y * t_1;
} else if (t_1 <= 1e-10) {
tmp = x + (y * ((z - t) / a));
} else if (t_1 <= 1000.0) {
tmp = y + x;
} else {
tmp = x + (z * (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) :: t_1
real(8) :: tmp
t_1 = (z - t) / (a - t)
if (t_1 <= (-2d+126)) then
tmp = y * t_1
else if (t_1 <= 1d-10) then
tmp = x + (y * ((z - t) / a))
else if (t_1 <= 1000.0d0) then
tmp = y + x
else
tmp = x + (z * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -2e+126) {
tmp = y * t_1;
} else if (t_1 <= 1e-10) {
tmp = x + (y * ((z - t) / a));
} else if (t_1 <= 1000.0) {
tmp = y + x;
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) tmp = 0 if t_1 <= -2e+126: tmp = y * t_1 elif t_1 <= 1e-10: tmp = x + (y * ((z - t) / a)) elif t_1 <= 1000.0: tmp = y + x else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= -2e+126) tmp = Float64(y * t_1); elseif (t_1 <= 1e-10) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); elseif (t_1 <= 1000.0) tmp = Float64(y + x); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (a - t); tmp = 0.0; if (t_1 <= -2e+126) tmp = y * t_1; elseif (t_1 <= 1e-10) tmp = x + (y * ((z - t) / a)); elseif (t_1 <= 1000.0) tmp = y + x; else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+126], N[(y * t$95$1), $MachinePrecision], If[LessEqual[t$95$1, 1e-10], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1000.0], N[(y + x), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+126}:\\
\;\;\;\;y \cdot t_1\\
\mathbf{elif}\;t_1 \leq 10^{-10}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{elif}\;t_1 \leq 1000:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -1.99999999999999985e126Initial program 96.6%
associate-*r/93.5%
Simplified93.5%
associate-/l*96.7%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 76.2%
div-sub76.2%
Simplified76.2%
if -1.99999999999999985e126 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1.00000000000000004e-10Initial program 99.9%
Taylor expanded in a around inf 94.2%
if 1.00000000000000004e-10 < (/.f64 (-.f64 z t) (-.f64 a t)) < 1e3Initial program 100.0%
Taylor expanded in t around inf 99.0%
+-commutative99.0%
Simplified99.0%
if 1e3 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 89.6%
Taylor expanded in t around 0 67.8%
+-commutative67.8%
associate-/l*64.0%
Simplified64.0%
associate-/r/70.3%
Applied egg-rr70.3%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8e+92) (not (<= t 3.1e+16))) (+ y x) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8e+92) || !(t <= 3.1e+16)) {
tmp = y + x;
} else {
tmp = x + (y * (z / 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 ((t <= (-8d+92)) .or. (.not. (t <= 3.1d+16))) then
tmp = y + x
else
tmp = x + (y * (z / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8e+92) || !(t <= 3.1e+16)) {
tmp = y + x;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -8e+92) or not (t <= 3.1e+16): tmp = y + x else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8e+92) || !(t <= 3.1e+16)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -8e+92) || ~((t <= 3.1e+16))) tmp = y + x; else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8e+92], N[Not[LessEqual[t, 3.1e+16]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+92} \lor \neg \left(t \leq 3.1 \cdot 10^{+16}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -8.0000000000000003e92 or 3.1e16 < t Initial program 100.0%
Taylor expanded in t around inf 83.9%
+-commutative83.9%
Simplified83.9%
if -8.0000000000000003e92 < t < 3.1e16Initial program 96.9%
Taylor expanded in t around 0 76.5%
Final simplification79.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -8e+92) (not (<= t 5.8e+14))) (+ y x) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -8e+92) || !(t <= 5.8e+14)) {
tmp = y + x;
} else {
tmp = x + (z * (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 ((t <= (-8d+92)) .or. (.not. (t <= 5.8d+14))) then
tmp = y + x
else
tmp = x + (z * (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 ((t <= -8e+92) || !(t <= 5.8e+14)) {
tmp = y + x;
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -8e+92) or not (t <= 5.8e+14): tmp = y + x else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -8e+92) || !(t <= 5.8e+14)) tmp = Float64(y + x); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -8e+92) || ~((t <= 5.8e+14))) tmp = y + x; else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -8e+92], N[Not[LessEqual[t, 5.8e+14]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+92} \lor \neg \left(t \leq 5.8 \cdot 10^{+14}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -8.0000000000000003e92 or 5.8e14 < t Initial program 100.0%
Taylor expanded in t around inf 83.9%
+-commutative83.9%
Simplified83.9%
if -8.0000000000000003e92 < t < 5.8e14Initial program 96.9%
Taylor expanded in t around 0 76.3%
+-commutative76.3%
associate-/l*75.9%
Simplified75.9%
associate-/r/77.8%
Applied egg-rr77.8%
Final simplification80.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -7.2e+24) x (if (<= a 1.02e+117) (+ y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -7.2e+24) {
tmp = x;
} else if (a <= 1.02e+117) {
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 <= (-7.2d+24)) then
tmp = x
else if (a <= 1.02d+117) 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 <= -7.2e+24) {
tmp = x;
} else if (a <= 1.02e+117) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -7.2e+24: tmp = x elif a <= 1.02e+117: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -7.2e+24) tmp = x; elseif (a <= 1.02e+117) 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 <= -7.2e+24) tmp = x; elseif (a <= 1.02e+117) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -7.2e+24], x, If[LessEqual[a, 1.02e+117], N[(y + x), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.2 \cdot 10^{+24}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.02 \cdot 10^{+117}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -7.19999999999999966e24 or 1.02e117 < a Initial program 99.9%
Taylor expanded in x around inf 65.5%
if -7.19999999999999966e24 < a < 1.02e117Initial program 97.0%
Taylor expanded in t around inf 63.3%
+-commutative63.3%
Simplified63.3%
Final simplification64.1%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Initial program 98.1%
Final simplification98.1%
(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 98.1%
Taylor expanded in x around inf 48.9%
Final simplification48.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ (- z t) (- a t))))))
(if (< y -8.508084860551241e-17)
t_1
(if (< y 2.894426862792089e-49)
(+ x (* (* y (- z t)) (/ 1.0 (- a t))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - 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 = x + (y * ((z - t) / (a - t)))
if (y < (-8.508084860551241d-17)) then
tmp = t_1
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) * (1.0d0 / (a - 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 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * ((z - t) / (a - t))) tmp = 0 if y < -8.508084860551241e-17: tmp = t_1 elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) * (1.0 / (a - t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) * Float64(1.0 / Float64(a - t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * ((z - t) / (a - t))); tmp = 0.0; if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) * (1.0 / (a - t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -8.508084860551241e-17], t$95$1, If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;y < -8.508084860551241 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2024019
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))