
(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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\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)) (- 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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (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 / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((a - t) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a - t}{z - t}}
\end{array}
Initial program 88.2%
associate-/l*99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y) (+ (/ a t) -1.0))) (t_2 (+ x (/ (* y z) (- a t)))))
(if (<= t -1.28e+66)
(+ x y)
(if (<= t 7.5e-34)
t_2
(if (<= t 1.4e-28)
t_1
(if (<= t 5.5e+102)
t_2
(if (<= t 5e+118) t_1 (if (<= t 7e+155) t_2 (+ x y)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -y / ((a / t) + -1.0);
double t_2 = x + ((y * z) / (a - t));
double tmp;
if (t <= -1.28e+66) {
tmp = x + y;
} else if (t <= 7.5e-34) {
tmp = t_2;
} else if (t <= 1.4e-28) {
tmp = t_1;
} else if (t <= 5.5e+102) {
tmp = t_2;
} else if (t <= 5e+118) {
tmp = t_1;
} else if (t <= 7e+155) {
tmp = t_2;
} else {
tmp = x + y;
}
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 = -y / ((a / t) + (-1.0d0))
t_2 = x + ((y * z) / (a - t))
if (t <= (-1.28d+66)) then
tmp = x + y
else if (t <= 7.5d-34) then
tmp = t_2
else if (t <= 1.4d-28) then
tmp = t_1
else if (t <= 5.5d+102) then
tmp = t_2
else if (t <= 5d+118) then
tmp = t_1
else if (t <= 7d+155) then
tmp = t_2
else
tmp = x + y
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) + -1.0);
double t_2 = x + ((y * z) / (a - t));
double tmp;
if (t <= -1.28e+66) {
tmp = x + y;
} else if (t <= 7.5e-34) {
tmp = t_2;
} else if (t <= 1.4e-28) {
tmp = t_1;
} else if (t <= 5.5e+102) {
tmp = t_2;
} else if (t <= 5e+118) {
tmp = t_1;
} else if (t <= 7e+155) {
tmp = t_2;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -y / ((a / t) + -1.0) t_2 = x + ((y * z) / (a - t)) tmp = 0 if t <= -1.28e+66: tmp = x + y elif t <= 7.5e-34: tmp = t_2 elif t <= 1.4e-28: tmp = t_1 elif t <= 5.5e+102: tmp = t_2 elif t <= 5e+118: tmp = t_1 elif t <= 7e+155: tmp = t_2 else: tmp = x + y return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-y) / Float64(Float64(a / t) + -1.0)) t_2 = Float64(x + Float64(Float64(y * z) / Float64(a - t))) tmp = 0.0 if (t <= -1.28e+66) tmp = Float64(x + y); elseif (t <= 7.5e-34) tmp = t_2; elseif (t <= 1.4e-28) tmp = t_1; elseif (t <= 5.5e+102) tmp = t_2; elseif (t <= 5e+118) tmp = t_1; elseif (t <= 7e+155) tmp = t_2; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -y / ((a / t) + -1.0); t_2 = x + ((y * z) / (a - t)); tmp = 0.0; if (t <= -1.28e+66) tmp = x + y; elseif (t <= 7.5e-34) tmp = t_2; elseif (t <= 1.4e-28) tmp = t_1; elseif (t <= 5.5e+102) tmp = t_2; elseif (t <= 5e+118) tmp = t_1; elseif (t <= 7e+155) tmp = t_2; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-y) / N[(N[(a / t), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.28e+66], N[(x + y), $MachinePrecision], If[LessEqual[t, 7.5e-34], t$95$2, If[LessEqual[t, 1.4e-28], t$95$1, If[LessEqual[t, 5.5e+102], t$95$2, If[LessEqual[t, 5e+118], t$95$1, If[LessEqual[t, 7e+155], t$95$2, N[(x + y), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-y}{\frac{a}{t} + -1}\\
t_2 := x + \frac{y \cdot z}{a - t}\\
\mathbf{if}\;t \leq -1.28 \cdot 10^{+66}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{-34}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{-28}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{+102}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+155}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.28000000000000003e66 or 6.99999999999999969e155 < t Initial program 72.9%
+-commutative72.9%
associate-*l/95.4%
fma-def95.4%
Simplified95.4%
Taylor expanded in t around inf 88.5%
+-commutative88.5%
Simplified88.5%
if -1.28000000000000003e66 < t < 7.5000000000000004e-34 or 1.3999999999999999e-28 < t < 5.49999999999999981e102 or 4.99999999999999972e118 < t < 6.99999999999999969e155Initial program 96.8%
associate-/l*98.8%
Simplified98.8%
Taylor expanded in z around inf 88.4%
if 7.5000000000000004e-34 < t < 1.3999999999999999e-28 or 5.49999999999999981e102 < t < 4.99999999999999972e118Initial program 91.7%
+-commutative91.7%
associate-*l/91.8%
fma-def91.8%
Simplified91.8%
Taylor expanded in z around 0 91.7%
mul-1-neg91.7%
unsub-neg91.7%
*-commutative91.7%
associate-/l*99.9%
div-sub99.9%
sub-neg99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
sub-neg99.9%
metadata-eval99.9%
associate-*r/99.9%
neg-mul-199.9%
+-commutative99.9%
Simplified99.9%
Final simplification88.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y) (+ (/ a t) -1.0))) (t_2 (+ x (/ (* y z) a))))
(if (<= t -7.4e+33)
(+ x y)
(if (<= t 4.8e-55)
(+ x (/ y (/ a z)))
(if (<= t 4.8e-24)
t_1
(if (<= t 1.65e+102)
t_2
(if (<= t 6e+118) t_1 (if (<= t 3.4e+142) t_2 (+ x y)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -y / ((a / t) + -1.0);
double t_2 = x + ((y * z) / a);
double tmp;
if (t <= -7.4e+33) {
tmp = x + y;
} else if (t <= 4.8e-55) {
tmp = x + (y / (a / z));
} else if (t <= 4.8e-24) {
tmp = t_1;
} else if (t <= 1.65e+102) {
tmp = t_2;
} else if (t <= 6e+118) {
tmp = t_1;
} else if (t <= 3.4e+142) {
tmp = t_2;
} else {
tmp = x + y;
}
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 = -y / ((a / t) + (-1.0d0))
t_2 = x + ((y * z) / a)
if (t <= (-7.4d+33)) then
tmp = x + y
else if (t <= 4.8d-55) then
tmp = x + (y / (a / z))
else if (t <= 4.8d-24) then
tmp = t_1
else if (t <= 1.65d+102) then
tmp = t_2
else if (t <= 6d+118) then
tmp = t_1
else if (t <= 3.4d+142) then
tmp = t_2
else
tmp = x + y
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) + -1.0);
double t_2 = x + ((y * z) / a);
double tmp;
if (t <= -7.4e+33) {
tmp = x + y;
} else if (t <= 4.8e-55) {
tmp = x + (y / (a / z));
} else if (t <= 4.8e-24) {
tmp = t_1;
} else if (t <= 1.65e+102) {
tmp = t_2;
} else if (t <= 6e+118) {
tmp = t_1;
} else if (t <= 3.4e+142) {
tmp = t_2;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -y / ((a / t) + -1.0) t_2 = x + ((y * z) / a) tmp = 0 if t <= -7.4e+33: tmp = x + y elif t <= 4.8e-55: tmp = x + (y / (a / z)) elif t <= 4.8e-24: tmp = t_1 elif t <= 1.65e+102: tmp = t_2 elif t <= 6e+118: tmp = t_1 elif t <= 3.4e+142: tmp = t_2 else: tmp = x + y return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-y) / Float64(Float64(a / t) + -1.0)) t_2 = Float64(x + Float64(Float64(y * z) / a)) tmp = 0.0 if (t <= -7.4e+33) tmp = Float64(x + y); elseif (t <= 4.8e-55) tmp = Float64(x + Float64(y / Float64(a / z))); elseif (t <= 4.8e-24) tmp = t_1; elseif (t <= 1.65e+102) tmp = t_2; elseif (t <= 6e+118) tmp = t_1; elseif (t <= 3.4e+142) tmp = t_2; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -y / ((a / t) + -1.0); t_2 = x + ((y * z) / a); tmp = 0.0; if (t <= -7.4e+33) tmp = x + y; elseif (t <= 4.8e-55) tmp = x + (y / (a / z)); elseif (t <= 4.8e-24) tmp = t_1; elseif (t <= 1.65e+102) tmp = t_2; elseif (t <= 6e+118) tmp = t_1; elseif (t <= 3.4e+142) tmp = t_2; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-y) / N[(N[(a / t), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -7.4e+33], N[(x + y), $MachinePrecision], If[LessEqual[t, 4.8e-55], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.8e-24], t$95$1, If[LessEqual[t, 1.65e+102], t$95$2, If[LessEqual[t, 6e+118], t$95$1, If[LessEqual[t, 3.4e+142], t$95$2, N[(x + y), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-y}{\frac{a}{t} + -1}\\
t_2 := x + \frac{y \cdot z}{a}\\
\mathbf{if}\;t \leq -7.4 \cdot 10^{+33}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{-55}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{-24}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.65 \cdot 10^{+102}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+142}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -7.3999999999999997e33 or 3.3999999999999998e142 < t Initial program 75.1%
+-commutative75.1%
associate-*l/95.4%
fma-def95.3%
Simplified95.3%
Taylor expanded in t around inf 85.6%
+-commutative85.6%
Simplified85.6%
if -7.3999999999999997e33 < t < 4.79999999999999983e-55Initial program 97.5%
+-commutative97.5%
associate-*l/97.2%
fma-def97.2%
Simplified97.2%
Taylor expanded in t around 0 85.1%
+-commutative85.1%
associate-/l*86.0%
Simplified86.0%
if 4.79999999999999983e-55 < t < 4.7999999999999996e-24 or 1.64999999999999999e102 < t < 6e118Initial program 93.9%
+-commutative93.9%
associate-*l/94.0%
fma-def94.0%
Simplified94.0%
Taylor expanded in z around 0 74.7%
mul-1-neg74.7%
unsub-neg74.7%
*-commutative74.7%
associate-/l*80.6%
div-sub80.6%
sub-neg80.6%
*-inverses80.6%
metadata-eval80.6%
Simplified80.6%
Taylor expanded in x around 0 80.6%
sub-neg80.6%
metadata-eval80.6%
associate-*r/80.6%
neg-mul-180.6%
+-commutative80.6%
Simplified80.6%
if 4.7999999999999996e-24 < t < 1.64999999999999999e102 or 6e118 < t < 3.3999999999999998e142Initial program 92.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t around 0 69.4%
Final simplification83.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* y z) a))))
(if (<= t -3.1e+34)
(+ x y)
(if (<= t 4.8e-55)
t_1
(if (<= t 1.08e-23)
(* y (- 1.0 (/ z t)))
(if (<= t 6e+99) t_1 (+ x y)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y * z) / a);
double tmp;
if (t <= -3.1e+34) {
tmp = x + y;
} else if (t <= 4.8e-55) {
tmp = t_1;
} else if (t <= 1.08e-23) {
tmp = y * (1.0 - (z / t));
} else if (t <= 6e+99) {
tmp = t_1;
} else {
tmp = x + y;
}
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)
if (t <= (-3.1d+34)) then
tmp = x + y
else if (t <= 4.8d-55) then
tmp = t_1
else if (t <= 1.08d-23) then
tmp = y * (1.0d0 - (z / t))
else if (t <= 6d+99) then
tmp = t_1
else
tmp = x + y
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);
double tmp;
if (t <= -3.1e+34) {
tmp = x + y;
} else if (t <= 4.8e-55) {
tmp = t_1;
} else if (t <= 1.08e-23) {
tmp = y * (1.0 - (z / t));
} else if (t <= 6e+99) {
tmp = t_1;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y * z) / a) tmp = 0 if t <= -3.1e+34: tmp = x + y elif t <= 4.8e-55: tmp = t_1 elif t <= 1.08e-23: tmp = y * (1.0 - (z / t)) elif t <= 6e+99: tmp = t_1 else: tmp = x + y return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y * z) / a)) tmp = 0.0 if (t <= -3.1e+34) tmp = Float64(x + y); elseif (t <= 4.8e-55) tmp = t_1; elseif (t <= 1.08e-23) tmp = Float64(y * Float64(1.0 - Float64(z / t))); elseif (t <= 6e+99) tmp = t_1; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y * z) / a); tmp = 0.0; if (t <= -3.1e+34) tmp = x + y; elseif (t <= 4.8e-55) tmp = t_1; elseif (t <= 1.08e-23) tmp = y * (1.0 - (z / t)); elseif (t <= 6e+99) tmp = t_1; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.1e+34], N[(x + y), $MachinePrecision], If[LessEqual[t, 4.8e-55], t$95$1, If[LessEqual[t, 1.08e-23], N[(y * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6e+99], t$95$1, N[(x + y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot z}{a}\\
\mathbf{if}\;t \leq -3.1 \cdot 10^{+34}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{-55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.08 \cdot 10^{-23}:\\
\;\;\;\;y \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+99}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -3.09999999999999977e34 or 6.00000000000000029e99 < t Initial program 76.3%
+-commutative76.3%
associate-*l/95.7%
fma-def95.7%
Simplified95.7%
Taylor expanded in t around inf 82.0%
+-commutative82.0%
Simplified82.0%
if -3.09999999999999977e34 < t < 4.79999999999999983e-55 or 1.08000000000000003e-23 < t < 6.00000000000000029e99Initial program 96.5%
associate-/l*98.6%
Simplified98.6%
Taylor expanded in t around 0 81.8%
if 4.79999999999999983e-55 < t < 1.08000000000000003e-23Initial program 100.0%
+-commutative100.0%
associate-*l/90.1%
fma-def90.1%
Simplified90.1%
Taylor expanded in a around 0 67.4%
mul-1-neg67.4%
unsub-neg67.4%
associate-/l*67.4%
Simplified67.4%
Taylor expanded in y around inf 67.4%
Final simplification81.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.4e+41) (not (<= z 2.3e+39))) (+ x (/ (* y z) (- a t))) (- x (/ t (/ (- a t) y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.4e+41) || !(z <= 2.3e+39)) {
tmp = x + ((y * z) / (a - t));
} else {
tmp = x - (t / ((a - t) / y));
}
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.4d+41)) .or. (.not. (z <= 2.3d+39))) then
tmp = x + ((y * z) / (a - t))
else
tmp = x - (t / ((a - t) / y))
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.4e+41) || !(z <= 2.3e+39)) {
tmp = x + ((y * z) / (a - t));
} else {
tmp = x - (t / ((a - t) / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.4e+41) or not (z <= 2.3e+39): tmp = x + ((y * z) / (a - t)) else: tmp = x - (t / ((a - t) / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.4e+41) || !(z <= 2.3e+39)) tmp = Float64(x + Float64(Float64(y * z) / Float64(a - t))); else tmp = Float64(x - Float64(t / Float64(Float64(a - t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.4e+41) || ~((z <= 2.3e+39))) tmp = x + ((y * z) / (a - t)); else tmp = x - (t / ((a - t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.4e+41], N[Not[LessEqual[z, 2.3e+39]], $MachinePrecision]], N[(x + N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+41} \lor \neg \left(z \leq 2.3 \cdot 10^{+39}\right):\\
\;\;\;\;x + \frac{y \cdot z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{t}{\frac{a - t}{y}}\\
\end{array}
\end{array}
if z < -1.4e41 or 2.30000000000000012e39 < z Initial program 92.0%
associate-/l*98.2%
Simplified98.2%
Taylor expanded in z around inf 82.5%
if -1.4e41 < z < 2.30000000000000012e39Initial program 85.4%
associate-/l*99.9%
Simplified99.9%
clear-num99.9%
inv-pow99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 81.5%
mul-1-neg81.5%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in x around 0 81.5%
mul-1-neg81.5%
unsub-neg81.5%
associate-/l*92.9%
Simplified92.9%
Final simplification88.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.8e+40) (not (<= z 4.9e+38))) (+ x (/ (* y z) (- a t))) (- x (/ y (+ (/ a t) -1.0)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.8e+40) || !(z <= 4.9e+38)) {
tmp = x + ((y * z) / (a - t));
} else {
tmp = x - (y / ((a / t) + -1.0));
}
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 <= (-4.8d+40)) .or. (.not. (z <= 4.9d+38))) then
tmp = x + ((y * z) / (a - t))
else
tmp = x - (y / ((a / t) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.8e+40) || !(z <= 4.9e+38)) {
tmp = x + ((y * z) / (a - t));
} else {
tmp = x - (y / ((a / t) + -1.0));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.8e+40) or not (z <= 4.9e+38): tmp = x + ((y * z) / (a - t)) else: tmp = x - (y / ((a / t) + -1.0)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.8e+40) || !(z <= 4.9e+38)) tmp = Float64(x + Float64(Float64(y * z) / Float64(a - t))); else tmp = Float64(x - Float64(y / Float64(Float64(a / t) + -1.0))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.8e+40) || ~((z <= 4.9e+38))) tmp = x + ((y * z) / (a - t)); else tmp = x - (y / ((a / t) + -1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.8e+40], N[Not[LessEqual[z, 4.9e+38]], $MachinePrecision]], N[(x + N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(N[(a / t), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+40} \lor \neg \left(z \leq 4.9 \cdot 10^{+38}\right):\\
\;\;\;\;x + \frac{y \cdot z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a}{t} + -1}\\
\end{array}
\end{array}
if z < -4.8e40 or 4.90000000000000002e38 < z Initial program 92.0%
associate-/l*98.2%
Simplified98.2%
Taylor expanded in z around inf 82.5%
if -4.8e40 < z < 4.90000000000000002e38Initial program 85.4%
+-commutative85.4%
associate-*l/97.3%
fma-def97.3%
Simplified97.3%
Taylor expanded in z around 0 81.5%
mul-1-neg81.5%
unsub-neg81.5%
*-commutative81.5%
associate-/l*95.4%
div-sub95.4%
sub-neg95.4%
*-inverses95.4%
metadata-eval95.4%
Simplified95.4%
Final simplification90.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.0061) (not (<= a 1.7e+93))) (+ x (/ y (/ a z))) (+ x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.0061) || !(a <= 1.7e+93)) {
tmp = x + (y / (a / z));
} else {
tmp = x + y;
}
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 <= (-0.0061d0)) .or. (.not. (a <= 1.7d+93))) then
tmp = x + (y / (a / z))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.0061) || !(a <= 1.7e+93)) {
tmp = x + (y / (a / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -0.0061) or not (a <= 1.7e+93): tmp = x + (y / (a / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.0061) || !(a <= 1.7e+93)) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -0.0061) || ~((a <= 1.7e+93))) tmp = x + (y / (a / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.0061], N[Not[LessEqual[a, 1.7e+93]], $MachinePrecision]], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.0061 \lor \neg \left(a \leq 1.7 \cdot 10^{+93}\right):\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if a < -0.00610000000000000039 or 1.7e93 < a Initial program 89.5%
+-commutative89.5%
associate-*l/98.2%
fma-def98.1%
Simplified98.1%
Taylor expanded in t around 0 79.9%
+-commutative79.9%
associate-/l*82.8%
Simplified82.8%
if -0.00610000000000000039 < a < 1.7e93Initial program 86.9%
+-commutative86.9%
associate-*l/95.0%
fma-def95.0%
Simplified95.0%
Taylor expanded in t around inf 71.9%
+-commutative71.9%
Simplified71.9%
Final simplification77.3%
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / (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 + ((z - t) * (y / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / (a - t)));
}
def code(x, y, z, t, a): return x + ((z - t) * (y / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \frac{y}{a - t}
\end{array}
Initial program 88.2%
associate-/l*99.2%
Simplified99.2%
associate-/r/96.6%
Applied egg-rr96.6%
Final simplification96.6%
(FPCore (x y z t a) :precision binary64 (+ x y))
double code(double x, double y, double z, double t, double a) {
return x + y;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x + y;
}
def code(x, y, z, t, a): return x + y
function code(x, y, z, t, a) return Float64(x + y) end
function tmp = code(x, y, z, t, a) tmp = x + y; end
code[x_, y_, z_, t_, a_] := N[(x + y), $MachinePrecision]
\begin{array}{l}
\\
x + y
\end{array}
Initial program 88.2%
+-commutative88.2%
associate-*l/96.6%
fma-def96.6%
Simplified96.6%
Taylor expanded in t around inf 66.3%
+-commutative66.3%
Simplified66.3%
Final simplification66.3%
(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 88.2%
+-commutative88.2%
associate-*l/96.6%
fma-def96.6%
Simplified96.6%
Taylor expanded in y around 0 52.9%
Final simplification52.9%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (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 / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((a - t) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a - t}{z - t}}
\end{array}
herbie shell --seed 2023322
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(+ x (/ y (/ (- a t) (- z t))))
(+ x (/ (* y (- z t)) (- a t))))