
(FPCore (x y z t a) :precision binary64 (+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
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 = ((60.0d0 * (x - y)) / (z - t)) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
def code(x, y, z, t, a): return ((60.0 * (x - y)) / (z - t)) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = ((60.0 * (x - y)) / (z - t)) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
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 = ((60.0d0 * (x - y)) / (z - t)) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((60.0 * (x - y)) / (z - t)) + (a * 120.0);
}
def code(x, y, z, t, a): return ((60.0 * (x - y)) / (z - t)) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = ((60.0 * (x - y)) / (z - t)) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{60 \cdot \left(x - y\right)}{z - t} + a \cdot 120
\end{array}
(FPCore (x y z t a) :precision binary64 (+ (* (- x y) (/ 60.0 (- z t))) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return ((x - y) * (60.0 / (z - t))) + (a * 120.0);
}
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) * (60.0d0 / (z - t))) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x - y) * (60.0 / (z - t))) + (a * 120.0);
}
def code(x, y, z, t, a): return ((x - y) * (60.0 / (z - t))) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = ((x - y) * (60.0 / (z - t))) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x - y\right) \cdot \frac{60}{z - t} + a \cdot 120
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-/l*99.4%
Applied egg-rr99.4%
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.8e+61)
(+ (* a 120.0) (* 60.0 (/ (- y x) t)))
(if (<= t 8.6e-164)
(+ (* a 120.0) (/ (* x 60.0) z))
(if (<= t 3.2e-9)
(* 60.0 (/ (- x y) (- z t)))
(+ (* a 120.0) (* (- x y) (/ -60.0 t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.8e+61) {
tmp = (a * 120.0) + (60.0 * ((y - x) / t));
} else if (t <= 8.6e-164) {
tmp = (a * 120.0) + ((x * 60.0) / z);
} else if (t <= 3.2e-9) {
tmp = 60.0 * ((x - y) / (z - t));
} else {
tmp = (a * 120.0) + ((x - y) * (-60.0 / 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 (t <= (-2.8d+61)) then
tmp = (a * 120.0d0) + (60.0d0 * ((y - x) / t))
else if (t <= 8.6d-164) then
tmp = (a * 120.0d0) + ((x * 60.0d0) / z)
else if (t <= 3.2d-9) then
tmp = 60.0d0 * ((x - y) / (z - t))
else
tmp = (a * 120.0d0) + ((x - y) * ((-60.0d0) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.8e+61) {
tmp = (a * 120.0) + (60.0 * ((y - x) / t));
} else if (t <= 8.6e-164) {
tmp = (a * 120.0) + ((x * 60.0) / z);
} else if (t <= 3.2e-9) {
tmp = 60.0 * ((x - y) / (z - t));
} else {
tmp = (a * 120.0) + ((x - y) * (-60.0 / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.8e+61: tmp = (a * 120.0) + (60.0 * ((y - x) / t)) elif t <= 8.6e-164: tmp = (a * 120.0) + ((x * 60.0) / z) elif t <= 3.2e-9: tmp = 60.0 * ((x - y) / (z - t)) else: tmp = (a * 120.0) + ((x - y) * (-60.0 / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.8e+61) tmp = Float64(Float64(a * 120.0) + Float64(60.0 * Float64(Float64(y - x) / t))); elseif (t <= 8.6e-164) tmp = Float64(Float64(a * 120.0) + Float64(Float64(x * 60.0) / z)); elseif (t <= 3.2e-9) tmp = Float64(60.0 * Float64(Float64(x - y) / Float64(z - t))); else tmp = Float64(Float64(a * 120.0) + Float64(Float64(x - y) * Float64(-60.0 / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.8e+61) tmp = (a * 120.0) + (60.0 * ((y - x) / t)); elseif (t <= 8.6e-164) tmp = (a * 120.0) + ((x * 60.0) / z); elseif (t <= 3.2e-9) tmp = 60.0 * ((x - y) / (z - t)); else tmp = (a * 120.0) + ((x - y) * (-60.0 / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.8e+61], N[(N[(a * 120.0), $MachinePrecision] + N[(60.0 * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.6e-164], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(x * 60.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.2e-9], N[(60.0 * N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(x - y), $MachinePrecision] * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+61}:\\
\;\;\;\;a \cdot 120 + 60 \cdot \frac{y - x}{t}\\
\mathbf{elif}\;t \leq 8.6 \cdot 10^{-164}:\\
\;\;\;\;a \cdot 120 + \frac{x \cdot 60}{z}\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-9}:\\
\;\;\;\;60 \cdot \frac{x - y}{z - t}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120 + \left(x - y\right) \cdot \frac{-60}{t}\\
\end{array}
\end{array}
if t < -2.8000000000000001e61Initial program 99.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 97.9%
associate-*r/97.9%
neg-mul-197.9%
neg-sub097.9%
sub-neg97.9%
+-commutative97.9%
associate--r+97.9%
neg-sub097.9%
remove-double-neg97.9%
Simplified97.9%
if -2.8000000000000001e61 < t < 8.5999999999999996e-164Initial program 98.8%
associate-/l*98.9%
Simplified98.9%
Taylor expanded in x around inf 75.6%
associate-*r/75.6%
Simplified75.6%
Taylor expanded in z around inf 70.8%
if 8.5999999999999996e-164 < t < 3.20000000000000012e-9Initial program 99.7%
associate-/l*99.8%
fma-define99.7%
Simplified99.7%
Taylor expanded in a around 0 79.4%
if 3.20000000000000012e-9 < t Initial program 99.9%
*-commutative99.9%
associate-/l*99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 92.8%
Final simplification82.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* a 120.0) (* 60.0 (/ (- y x) t)))))
(if (<= t -2.8e+61)
t_1
(if (<= t 5.2e-164)
(+ (* a 120.0) (/ (* x 60.0) z))
(if (<= t 2.6e-6) (* 60.0 (/ (- x y) (- z t))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (a * 120.0) + (60.0 * ((y - x) / t));
double tmp;
if (t <= -2.8e+61) {
tmp = t_1;
} else if (t <= 5.2e-164) {
tmp = (a * 120.0) + ((x * 60.0) / z);
} else if (t <= 2.6e-6) {
tmp = 60.0 * ((x - y) / (z - 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 = (a * 120.0d0) + (60.0d0 * ((y - x) / t))
if (t <= (-2.8d+61)) then
tmp = t_1
else if (t <= 5.2d-164) then
tmp = (a * 120.0d0) + ((x * 60.0d0) / z)
else if (t <= 2.6d-6) then
tmp = 60.0d0 * ((x - y) / (z - 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 = (a * 120.0) + (60.0 * ((y - x) / t));
double tmp;
if (t <= -2.8e+61) {
tmp = t_1;
} else if (t <= 5.2e-164) {
tmp = (a * 120.0) + ((x * 60.0) / z);
} else if (t <= 2.6e-6) {
tmp = 60.0 * ((x - y) / (z - t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (a * 120.0) + (60.0 * ((y - x) / t)) tmp = 0 if t <= -2.8e+61: tmp = t_1 elif t <= 5.2e-164: tmp = (a * 120.0) + ((x * 60.0) / z) elif t <= 2.6e-6: tmp = 60.0 * ((x - y) / (z - t)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(a * 120.0) + Float64(60.0 * Float64(Float64(y - x) / t))) tmp = 0.0 if (t <= -2.8e+61) tmp = t_1; elseif (t <= 5.2e-164) tmp = Float64(Float64(a * 120.0) + Float64(Float64(x * 60.0) / z)); elseif (t <= 2.6e-6) tmp = Float64(60.0 * Float64(Float64(x - y) / Float64(z - t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (a * 120.0) + (60.0 * ((y - x) / t)); tmp = 0.0; if (t <= -2.8e+61) tmp = t_1; elseif (t <= 5.2e-164) tmp = (a * 120.0) + ((x * 60.0) / z); elseif (t <= 2.6e-6) tmp = 60.0 * ((x - y) / (z - t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a * 120.0), $MachinePrecision] + N[(60.0 * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.8e+61], t$95$1, If[LessEqual[t, 5.2e-164], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(x * 60.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.6e-6], N[(60.0 * N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot 120 + 60 \cdot \frac{y - x}{t}\\
\mathbf{if}\;t \leq -2.8 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-164}:\\
\;\;\;\;a \cdot 120 + \frac{x \cdot 60}{z}\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{-6}:\\
\;\;\;\;60 \cdot \frac{x - y}{z - t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.8000000000000001e61 or 2.60000000000000009e-6 < t Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 95.1%
associate-*r/95.1%
neg-mul-195.1%
neg-sub095.1%
sub-neg95.1%
+-commutative95.1%
associate--r+95.1%
neg-sub095.1%
remove-double-neg95.1%
Simplified95.1%
if -2.8000000000000001e61 < t < 5.2000000000000003e-164Initial program 98.8%
associate-/l*98.9%
Simplified98.9%
Taylor expanded in x around inf 75.6%
associate-*r/75.6%
Simplified75.6%
Taylor expanded in z around inf 70.8%
if 5.2000000000000003e-164 < t < 2.60000000000000009e-6Initial program 99.7%
associate-/l*99.8%
fma-define99.7%
Simplified99.7%
Taylor expanded in a around 0 79.4%
Final simplification81.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= (* a 120.0) -0.5) (not (<= (* a 120.0) 2e-14))) (* a 120.0) (* 60.0 (/ (- x y) (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a * 120.0) <= -0.5) || !((a * 120.0) <= 2e-14)) {
tmp = a * 120.0;
} else {
tmp = 60.0 * ((x - y) / (z - 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 (((a * 120.0d0) <= (-0.5d0)) .or. (.not. ((a * 120.0d0) <= 2d-14))) then
tmp = a * 120.0d0
else
tmp = 60.0d0 * ((x - y) / (z - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a * 120.0) <= -0.5) || !((a * 120.0) <= 2e-14)) {
tmp = a * 120.0;
} else {
tmp = 60.0 * ((x - y) / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((a * 120.0) <= -0.5) or not ((a * 120.0) <= 2e-14): tmp = a * 120.0 else: tmp = 60.0 * ((x - y) / (z - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(a * 120.0) <= -0.5) || !(Float64(a * 120.0) <= 2e-14)) tmp = Float64(a * 120.0); else tmp = Float64(60.0 * Float64(Float64(x - y) / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((a * 120.0) <= -0.5) || ~(((a * 120.0) <= 2e-14))) tmp = a * 120.0; else tmp = 60.0 * ((x - y) / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a * 120.0), $MachinePrecision], -0.5], N[Not[LessEqual[N[(a * 120.0), $MachinePrecision], 2e-14]], $MachinePrecision]], N[(a * 120.0), $MachinePrecision], N[(60.0 * N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 120 \leq -0.5 \lor \neg \left(a \cdot 120 \leq 2 \cdot 10^{-14}\right):\\
\;\;\;\;a \cdot 120\\
\mathbf{else}:\\
\;\;\;\;60 \cdot \frac{x - y}{z - t}\\
\end{array}
\end{array}
if (*.f64 a #s(literal 120 binary64)) < -0.5 or 2e-14 < (*.f64 a #s(literal 120 binary64)) Initial program 99.1%
associate-/l*99.1%
fma-define99.1%
Simplified99.1%
Taylor expanded in z around inf 80.0%
if -0.5 < (*.f64 a #s(literal 120 binary64)) < 2e-14Initial program 99.6%
associate-/l*99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in a around 0 79.8%
Final simplification79.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -4.8e+52) (not (<= x 1.7e+66))) (+ (* a 120.0) (/ (* x 60.0) (- z t))) (+ (* a 120.0) (/ (* y -60.0) (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -4.8e+52) || !(x <= 1.7e+66)) {
tmp = (a * 120.0) + ((x * 60.0) / (z - t));
} else {
tmp = (a * 120.0) + ((y * -60.0) / (z - 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 ((x <= (-4.8d+52)) .or. (.not. (x <= 1.7d+66))) then
tmp = (a * 120.0d0) + ((x * 60.0d0) / (z - t))
else
tmp = (a * 120.0d0) + ((y * (-60.0d0)) / (z - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -4.8e+52) || !(x <= 1.7e+66)) {
tmp = (a * 120.0) + ((x * 60.0) / (z - t));
} else {
tmp = (a * 120.0) + ((y * -60.0) / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -4.8e+52) or not (x <= 1.7e+66): tmp = (a * 120.0) + ((x * 60.0) / (z - t)) else: tmp = (a * 120.0) + ((y * -60.0) / (z - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -4.8e+52) || !(x <= 1.7e+66)) tmp = Float64(Float64(a * 120.0) + Float64(Float64(x * 60.0) / Float64(z - t))); else tmp = Float64(Float64(a * 120.0) + Float64(Float64(y * -60.0) / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -4.8e+52) || ~((x <= 1.7e+66))) tmp = (a * 120.0) + ((x * 60.0) / (z - t)); else tmp = (a * 120.0) + ((y * -60.0) / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -4.8e+52], N[Not[LessEqual[x, 1.7e+66]], $MachinePrecision]], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(x * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(y * -60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+52} \lor \neg \left(x \leq 1.7 \cdot 10^{+66}\right):\\
\;\;\;\;a \cdot 120 + \frac{x \cdot 60}{z - t}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120 + \frac{y \cdot -60}{z - t}\\
\end{array}
\end{array}
if x < -4.8e52 or 1.70000000000000015e66 < x Initial program 98.9%
associate-/l*98.9%
Simplified98.9%
Taylor expanded in x around inf 87.9%
associate-*r/87.9%
Simplified87.9%
if -4.8e52 < x < 1.70000000000000015e66Initial program 99.8%
Taylor expanded in x around 0 94.9%
Final simplification91.7%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4.8e+61)
(+ (* a 120.0) (* 60.0 (/ (- y x) t)))
(if (<= t 7.2e-7)
(+ (* a 120.0) (* (- x y) (/ 60.0 z)))
(+ (* a 120.0) (* (- x y) (/ -60.0 t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.8e+61) {
tmp = (a * 120.0) + (60.0 * ((y - x) / t));
} else if (t <= 7.2e-7) {
tmp = (a * 120.0) + ((x - y) * (60.0 / z));
} else {
tmp = (a * 120.0) + ((x - y) * (-60.0 / 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 (t <= (-4.8d+61)) then
tmp = (a * 120.0d0) + (60.0d0 * ((y - x) / t))
else if (t <= 7.2d-7) then
tmp = (a * 120.0d0) + ((x - y) * (60.0d0 / z))
else
tmp = (a * 120.0d0) + ((x - y) * ((-60.0d0) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.8e+61) {
tmp = (a * 120.0) + (60.0 * ((y - x) / t));
} else if (t <= 7.2e-7) {
tmp = (a * 120.0) + ((x - y) * (60.0 / z));
} else {
tmp = (a * 120.0) + ((x - y) * (-60.0 / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4.8e+61: tmp = (a * 120.0) + (60.0 * ((y - x) / t)) elif t <= 7.2e-7: tmp = (a * 120.0) + ((x - y) * (60.0 / z)) else: tmp = (a * 120.0) + ((x - y) * (-60.0 / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.8e+61) tmp = Float64(Float64(a * 120.0) + Float64(60.0 * Float64(Float64(y - x) / t))); elseif (t <= 7.2e-7) tmp = Float64(Float64(a * 120.0) + Float64(Float64(x - y) * Float64(60.0 / z))); else tmp = Float64(Float64(a * 120.0) + Float64(Float64(x - y) * Float64(-60.0 / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4.8e+61) tmp = (a * 120.0) + (60.0 * ((y - x) / t)); elseif (t <= 7.2e-7) tmp = (a * 120.0) + ((x - y) * (60.0 / z)); else tmp = (a * 120.0) + ((x - y) * (-60.0 / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.8e+61], N[(N[(a * 120.0), $MachinePrecision] + N[(60.0 * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.2e-7], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(x - y), $MachinePrecision] * N[(60.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(x - y), $MachinePrecision] * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{+61}:\\
\;\;\;\;a \cdot 120 + 60 \cdot \frac{y - x}{t}\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{-7}:\\
\;\;\;\;a \cdot 120 + \left(x - y\right) \cdot \frac{60}{z}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120 + \left(x - y\right) \cdot \frac{-60}{t}\\
\end{array}
\end{array}
if t < -4.7999999999999998e61Initial program 99.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 97.9%
associate-*r/97.9%
neg-mul-197.9%
neg-sub097.9%
sub-neg97.9%
+-commutative97.9%
associate--r+97.9%
neg-sub097.9%
remove-double-neg97.9%
Simplified97.9%
if -4.7999999999999998e61 < t < 7.19999999999999989e-7Initial program 99.0%
*-commutative99.0%
associate-/l*99.1%
Applied egg-rr99.1%
Taylor expanded in z around inf 86.4%
if 7.19999999999999989e-7 < t Initial program 99.9%
*-commutative99.9%
associate-/l*99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 92.8%
Final simplification90.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.3e-51) (not (<= a 4.2e-15))) (* a 120.0) (* 60.0 (/ x (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.3e-51) || !(a <= 4.2e-15)) {
tmp = a * 120.0;
} else {
tmp = 60.0 * (x / (z - 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 ((a <= (-5.3d-51)) .or. (.not. (a <= 4.2d-15))) then
tmp = a * 120.0d0
else
tmp = 60.0d0 * (x / (z - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.3e-51) || !(a <= 4.2e-15)) {
tmp = a * 120.0;
} else {
tmp = 60.0 * (x / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5.3e-51) or not (a <= 4.2e-15): tmp = a * 120.0 else: tmp = 60.0 * (x / (z - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.3e-51) || !(a <= 4.2e-15)) tmp = Float64(a * 120.0); else tmp = Float64(60.0 * Float64(x / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -5.3e-51) || ~((a <= 4.2e-15))) tmp = a * 120.0; else tmp = 60.0 * (x / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.3e-51], N[Not[LessEqual[a, 4.2e-15]], $MachinePrecision]], N[(a * 120.0), $MachinePrecision], N[(60.0 * N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.3 \cdot 10^{-51} \lor \neg \left(a \leq 4.2 \cdot 10^{-15}\right):\\
\;\;\;\;a \cdot 120\\
\mathbf{else}:\\
\;\;\;\;60 \cdot \frac{x}{z - t}\\
\end{array}
\end{array}
if a < -5.29999999999999974e-51 or 4.19999999999999962e-15 < a Initial program 99.1%
associate-/l*99.1%
fma-define99.1%
Simplified99.1%
Taylor expanded in z around inf 77.2%
if -5.29999999999999974e-51 < a < 4.19999999999999962e-15Initial program 99.6%
Taylor expanded in y around inf 90.0%
Taylor expanded in a around 0 72.4%
Taylor expanded in y around 0 81.2%
Taylor expanded in y around 0 50.0%
Final simplification64.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -7.3e+180) (not (<= x 2.05e+180))) (* 60.0 (/ x z)) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -7.3e+180) || !(x <= 2.05e+180)) {
tmp = 60.0 * (x / z);
} else {
tmp = a * 120.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 ((x <= (-7.3d+180)) .or. (.not. (x <= 2.05d+180))) then
tmp = 60.0d0 * (x / z)
else
tmp = a * 120.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -7.3e+180) || !(x <= 2.05e+180)) {
tmp = 60.0 * (x / z);
} else {
tmp = a * 120.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -7.3e+180) or not (x <= 2.05e+180): tmp = 60.0 * (x / z) else: tmp = a * 120.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -7.3e+180) || !(x <= 2.05e+180)) tmp = Float64(60.0 * Float64(x / z)); else tmp = Float64(a * 120.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -7.3e+180) || ~((x <= 2.05e+180))) tmp = 60.0 * (x / z); else tmp = a * 120.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -7.3e+180], N[Not[LessEqual[x, 2.05e+180]], $MachinePrecision]], N[(60.0 * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(a * 120.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.3 \cdot 10^{+180} \lor \neg \left(x \leq 2.05 \cdot 10^{+180}\right):\\
\;\;\;\;60 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120\\
\end{array}
\end{array}
if x < -7.30000000000000039e180 or 2.05e180 < x Initial program 98.0%
Taylor expanded in y around inf 81.6%
Taylor expanded in a around 0 68.7%
Taylor expanded in y around 0 68.1%
Taylor expanded in z around inf 54.3%
if -7.30000000000000039e180 < x < 2.05e180Initial program 99.8%
associate-/l*99.8%
fma-define99.8%
Simplified99.8%
Taylor expanded in z around inf 59.2%
Final simplification58.1%
(FPCore (x y z t a) :precision binary64 (+ (* a 120.0) (* 60.0 (/ (- x y) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return (a * 120.0) + (60.0 * ((x - y) / (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 = (a * 120.0d0) + (60.0d0 * ((x - y) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return (a * 120.0) + (60.0 * ((x - y) / (z - t)));
}
def code(x, y, z, t, a): return (a * 120.0) + (60.0 * ((x - y) / (z - t)))
function code(x, y, z, t, a) return Float64(Float64(a * 120.0) + Float64(60.0 * Float64(Float64(x - y) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = (a * 120.0) + (60.0 * ((x - y) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(N[(a * 120.0), $MachinePrecision] + N[(60.0 * N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot 120 + 60 \cdot \frac{x - y}{z - t}
\end{array}
Initial program 99.4%
associate-/l*99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t a) :precision binary64 (* a 120.0))
double code(double x, double y, double z, double t, double a) {
return a * 120.0;
}
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 = a * 120.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
return a * 120.0;
}
def code(x, y, z, t, a): return a * 120.0
function code(x, y, z, t, a) return Float64(a * 120.0) end
function tmp = code(x, y, z, t, a) tmp = a * 120.0; end
code[x_, y_, z_, t_, a_] := N[(a * 120.0), $MachinePrecision]
\begin{array}{l}
\\
a \cdot 120
\end{array}
Initial program 99.4%
associate-/l*99.4%
fma-define99.4%
Simplified99.4%
Taylor expanded in z around inf 50.4%
Final simplification50.4%
(FPCore (x y z t a) :precision binary64 (+ (/ 60.0 (/ (- z t) (- x y))) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return (60.0 / ((z - t) / (x - y))) + (a * 120.0);
}
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 = (60.0d0 / ((z - t) / (x - y))) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return (60.0 / ((z - t) / (x - y))) + (a * 120.0);
}
def code(x, y, z, t, a): return (60.0 / ((z - t) / (x - y))) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(60.0 / Float64(Float64(z - t) / Float64(x - y))) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = (60.0 / ((z - t) / (x - y))) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(60.0 / N[(N[(z - t), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{60}{\frac{z - t}{x - y}} + a \cdot 120
\end{array}
herbie shell --seed 2024148
(FPCore (x y z t a)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, B"
:precision binary64
:alt
(! :herbie-platform default (+ (/ 60 (/ (- z t) (- x y))) (* a 120)))
(+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))