
(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 (fma a 120.0 (* (- x y) (/ 60.0 (- z t)))))
double code(double x, double y, double z, double t, double a) {
return fma(a, 120.0, ((x - y) * (60.0 / (z - t))));
}
function code(x, y, z, t, a) return fma(a, 120.0, Float64(Float64(x - y) * Float64(60.0 / Float64(z - t)))) end
code[x_, y_, z_, t_, a_] := N[(a * 120.0 + N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, 120, \left(x - y\right) \cdot \frac{60}{z - t}\right)
\end{array}
Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
+-commutative99.8%
fma-define99.8%
associate-*r/99.8%
*-commutative99.8%
associate-/l*99.8%
Applied egg-rr99.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= (* a 120.0) -1e-28) (not (<= (* a 120.0) 5e-83))) (+ (* a 120.0) (* 60.0 (/ y (- t z)))) (* 60.0 (/ (- x y) (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a * 120.0) <= -1e-28) || !((a * 120.0) <= 5e-83)) {
tmp = (a * 120.0) + (60.0 * (y / (t - z)));
} 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) <= (-1d-28)) .or. (.not. ((a * 120.0d0) <= 5d-83))) then
tmp = (a * 120.0d0) + (60.0d0 * (y / (t - z)))
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) <= -1e-28) || !((a * 120.0) <= 5e-83)) {
tmp = (a * 120.0) + (60.0 * (y / (t - z)));
} else {
tmp = 60.0 * ((x - y) / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((a * 120.0) <= -1e-28) or not ((a * 120.0) <= 5e-83): tmp = (a * 120.0) + (60.0 * (y / (t - z))) 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) <= -1e-28) || !(Float64(a * 120.0) <= 5e-83)) tmp = Float64(Float64(a * 120.0) + Float64(60.0 * Float64(y / Float64(t - z)))); 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) <= -1e-28) || ~(((a * 120.0) <= 5e-83))) tmp = (a * 120.0) + (60.0 * (y / (t - z))); 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], -1e-28], N[Not[LessEqual[N[(a * 120.0), $MachinePrecision], 5e-83]], $MachinePrecision]], N[(N[(a * 120.0), $MachinePrecision] + N[(60.0 * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 -1 \cdot 10^{-28} \lor \neg \left(a \cdot 120 \leq 5 \cdot 10^{-83}\right):\\
\;\;\;\;a \cdot 120 + 60 \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;60 \cdot \frac{x - y}{z - t}\\
\end{array}
\end{array}
if (*.f64 a #s(literal 120 binary64)) < -9.99999999999999971e-29 or 5e-83 < (*.f64 a #s(literal 120 binary64)) Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around 0 92.1%
associate-*r/92.1%
remove-double-neg92.1%
neg-mul-192.1%
times-frac92.1%
metadata-eval92.1%
neg-sub092.1%
sub-neg92.1%
+-commutative92.1%
associate--r+92.1%
neg-sub092.1%
remove-double-neg92.1%
Simplified92.1%
if -9.99999999999999971e-29 < (*.f64 a #s(literal 120 binary64)) < 5e-83Initial program 99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in a around 0 84.5%
Final simplification89.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= (* a 120.0) -5e-25) (not (<= (* a 120.0) 5e-10))) (* 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) <= -5e-25) || !((a * 120.0) <= 5e-10)) {
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) <= (-5d-25)) .or. (.not. ((a * 120.0d0) <= 5d-10))) 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) <= -5e-25) || !((a * 120.0) <= 5e-10)) {
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) <= -5e-25) or not ((a * 120.0) <= 5e-10): 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) <= -5e-25) || !(Float64(a * 120.0) <= 5e-10)) 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) <= -5e-25) || ~(((a * 120.0) <= 5e-10))) 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], -5e-25], N[Not[LessEqual[N[(a * 120.0), $MachinePrecision], 5e-10]], $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 -5 \cdot 10^{-25} \lor \neg \left(a \cdot 120 \leq 5 \cdot 10^{-10}\right):\\
\;\;\;\;a \cdot 120\\
\mathbf{else}:\\
\;\;\;\;60 \cdot \frac{x - y}{z - t}\\
\end{array}
\end{array}
if (*.f64 a #s(literal 120 binary64)) < -4.99999999999999962e-25 or 5.00000000000000031e-10 < (*.f64 a #s(literal 120 binary64)) Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 80.7%
if -4.99999999999999962e-25 < (*.f64 a #s(literal 120 binary64)) < 5.00000000000000031e-10Initial program 99.6%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in a around 0 82.0%
Final simplification81.3%
(FPCore (x y z t a)
:precision binary64
(if (<= (* a 120.0) -5e-25)
(* a 120.0)
(if (<= (* a 120.0) 5e-57)
(* 60.0 (/ (- x y) (- z t)))
(+ (* a 120.0) (* 60.0 (/ y t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 120.0) <= -5e-25) {
tmp = a * 120.0;
} else if ((a * 120.0) <= 5e-57) {
tmp = 60.0 * ((x - y) / (z - t));
} else {
tmp = (a * 120.0) + (60.0 * (y / 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) <= (-5d-25)) then
tmp = a * 120.0d0
else if ((a * 120.0d0) <= 5d-57) then
tmp = 60.0d0 * ((x - y) / (z - t))
else
tmp = (a * 120.0d0) + (60.0d0 * (y / 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) <= -5e-25) {
tmp = a * 120.0;
} else if ((a * 120.0) <= 5e-57) {
tmp = 60.0 * ((x - y) / (z - t));
} else {
tmp = (a * 120.0) + (60.0 * (y / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a * 120.0) <= -5e-25: tmp = a * 120.0 elif (a * 120.0) <= 5e-57: tmp = 60.0 * ((x - y) / (z - t)) else: tmp = (a * 120.0) + (60.0 * (y / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 120.0) <= -5e-25) tmp = Float64(a * 120.0); elseif (Float64(a * 120.0) <= 5e-57) tmp = Float64(60.0 * Float64(Float64(x - y) / Float64(z - t))); else tmp = Float64(Float64(a * 120.0) + Float64(60.0 * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a * 120.0) <= -5e-25) tmp = a * 120.0; elseif ((a * 120.0) <= 5e-57) tmp = 60.0 * ((x - y) / (z - t)); else tmp = (a * 120.0) + (60.0 * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a * 120.0), $MachinePrecision], -5e-25], N[(a * 120.0), $MachinePrecision], If[LessEqual[N[(a * 120.0), $MachinePrecision], 5e-57], N[(60.0 * N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 120.0), $MachinePrecision] + N[(60.0 * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 120 \leq -5 \cdot 10^{-25}:\\
\;\;\;\;a \cdot 120\\
\mathbf{elif}\;a \cdot 120 \leq 5 \cdot 10^{-57}:\\
\;\;\;\;60 \cdot \frac{x - y}{z - t}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120 + 60 \cdot \frac{y}{t}\\
\end{array}
\end{array}
if (*.f64 a #s(literal 120 binary64)) < -4.99999999999999962e-25Initial program 99.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in z around inf 83.1%
if -4.99999999999999962e-25 < (*.f64 a #s(literal 120 binary64)) < 5.0000000000000002e-57Initial program 99.6%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in a around 0 82.9%
if 5.0000000000000002e-57 < (*.f64 a #s(literal 120 binary64)) Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 75.7%
Taylor expanded in x around 0 70.9%
Taylor expanded in t around inf 76.4%
Final simplification81.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -5e+32) (not (<= x 1.9e+152))) (+ (* a 120.0) (* x (/ -60.0 (- t z)))) (+ (* a 120.0) (/ (* y -60.0) (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -5e+32) || !(x <= 1.9e+152)) {
tmp = (a * 120.0) + (x * (-60.0 / (t - z)));
} 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 <= (-5d+32)) .or. (.not. (x <= 1.9d+152))) then
tmp = (a * 120.0d0) + (x * ((-60.0d0) / (t - z)))
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 <= -5e+32) || !(x <= 1.9e+152)) {
tmp = (a * 120.0) + (x * (-60.0 / (t - z)));
} else {
tmp = (a * 120.0) + ((y * -60.0) / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -5e+32) or not (x <= 1.9e+152): tmp = (a * 120.0) + (x * (-60.0 / (t - z))) else: tmp = (a * 120.0) + ((y * -60.0) / (z - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -5e+32) || !(x <= 1.9e+152)) tmp = Float64(Float64(a * 120.0) + Float64(x * Float64(-60.0 / Float64(t - z)))); 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 <= -5e+32) || ~((x <= 1.9e+152))) tmp = (a * 120.0) + (x * (-60.0 / (t - z))); 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, -5e+32], N[Not[LessEqual[x, 1.9e+152]], $MachinePrecision]], N[(N[(a * 120.0), $MachinePrecision] + N[(x * N[(-60.0 / N[(t - z), $MachinePrecision]), $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 -5 \cdot 10^{+32} \lor \neg \left(x \leq 1.9 \cdot 10^{+152}\right):\\
\;\;\;\;a \cdot 120 + x \cdot \frac{-60}{t - z}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120 + \frac{y \cdot -60}{z - t}\\
\end{array}
\end{array}
if x < -4.9999999999999997e32 or 1.9e152 < x Initial program 99.7%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 94.2%
associate-*r/94.1%
*-commutative94.1%
*-lft-identity94.1%
times-frac94.1%
/-rgt-identity94.1%
remove-double-neg94.1%
distribute-frac-neg294.1%
distribute-neg-frac294.1%
distribute-neg-frac94.1%
metadata-eval94.1%
distribute-frac-neg294.1%
neg-sub094.1%
sub-neg94.1%
+-commutative94.1%
associate--r+94.1%
neg-sub094.1%
remove-double-neg94.1%
Simplified94.1%
if -4.9999999999999997e32 < x < 1.9e152Initial program 99.8%
Taylor expanded in x around 0 93.7%
Final simplification93.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -2.9e+32) (not (<= x 1.9e+152))) (+ (* a 120.0) (* x (/ -60.0 (- t z)))) (+ (* a 120.0) (* 60.0 (/ y (- t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -2.9e+32) || !(x <= 1.9e+152)) {
tmp = (a * 120.0) + (x * (-60.0 / (t - z)));
} else {
tmp = (a * 120.0) + (60.0 * (y / (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) :: tmp
if ((x <= (-2.9d+32)) .or. (.not. (x <= 1.9d+152))) then
tmp = (a * 120.0d0) + (x * ((-60.0d0) / (t - z)))
else
tmp = (a * 120.0d0) + (60.0d0 * (y / (t - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -2.9e+32) || !(x <= 1.9e+152)) {
tmp = (a * 120.0) + (x * (-60.0 / (t - z)));
} else {
tmp = (a * 120.0) + (60.0 * (y / (t - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -2.9e+32) or not (x <= 1.9e+152): tmp = (a * 120.0) + (x * (-60.0 / (t - z))) else: tmp = (a * 120.0) + (60.0 * (y / (t - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -2.9e+32) || !(x <= 1.9e+152)) tmp = Float64(Float64(a * 120.0) + Float64(x * Float64(-60.0 / Float64(t - z)))); else tmp = Float64(Float64(a * 120.0) + Float64(60.0 * Float64(y / Float64(t - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -2.9e+32) || ~((x <= 1.9e+152))) tmp = (a * 120.0) + (x * (-60.0 / (t - z))); else tmp = (a * 120.0) + (60.0 * (y / (t - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -2.9e+32], N[Not[LessEqual[x, 1.9e+152]], $MachinePrecision]], N[(N[(a * 120.0), $MachinePrecision] + N[(x * N[(-60.0 / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 120.0), $MachinePrecision] + N[(60.0 * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{+32} \lor \neg \left(x \leq 1.9 \cdot 10^{+152}\right):\\
\;\;\;\;a \cdot 120 + x \cdot \frac{-60}{t - z}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120 + 60 \cdot \frac{y}{t - z}\\
\end{array}
\end{array}
if x < -2.90000000000000003e32 or 1.9e152 < x Initial program 99.7%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 94.2%
associate-*r/94.1%
*-commutative94.1%
*-lft-identity94.1%
times-frac94.1%
/-rgt-identity94.1%
remove-double-neg94.1%
distribute-frac-neg294.1%
distribute-neg-frac294.1%
distribute-neg-frac94.1%
metadata-eval94.1%
distribute-frac-neg294.1%
neg-sub094.1%
sub-neg94.1%
+-commutative94.1%
associate--r+94.1%
neg-sub094.1%
remove-double-neg94.1%
Simplified94.1%
if -2.90000000000000003e32 < x < 1.9e152Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 93.7%
associate-*r/93.7%
remove-double-neg93.7%
neg-mul-193.7%
times-frac93.7%
metadata-eval93.7%
neg-sub093.7%
sub-neg93.7%
+-commutative93.7%
associate--r+93.7%
neg-sub093.7%
remove-double-neg93.7%
Simplified93.7%
Final simplification93.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -7e-40) (not (<= a 1.45e-77))) (* a 120.0) (* 60.0 (/ x (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -7e-40) || !(a <= 1.45e-77)) {
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 <= (-7d-40)) .or. (.not. (a <= 1.45d-77))) 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 <= -7e-40) || !(a <= 1.45e-77)) {
tmp = a * 120.0;
} else {
tmp = 60.0 * (x / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -7e-40) or not (a <= 1.45e-77): 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 <= -7e-40) || !(a <= 1.45e-77)) 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 <= -7e-40) || ~((a <= 1.45e-77))) 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, -7e-40], N[Not[LessEqual[a, 1.45e-77]], $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 -7 \cdot 10^{-40} \lor \neg \left(a \leq 1.45 \cdot 10^{-77}\right):\\
\;\;\;\;a \cdot 120\\
\mathbf{else}:\\
\;\;\;\;60 \cdot \frac{x}{z - t}\\
\end{array}
\end{array}
if a < -7.0000000000000003e-40 or 1.4499999999999999e-77 < a Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 77.6%
if -7.0000000000000003e-40 < a < 1.4499999999999999e-77Initial program 99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in x around inf 92.0%
Taylor expanded in x around inf 49.6%
Final simplification66.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.5e-95) (not (<= a 4.4e-88))) (* a 120.0) (* -60.0 (/ y (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.5e-95) || !(a <= 4.4e-88)) {
tmp = a * 120.0;
} else {
tmp = -60.0 * (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 <= (-3.5d-95)) .or. (.not. (a <= 4.4d-88))) then
tmp = a * 120.0d0
else
tmp = (-60.0d0) * (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 <= -3.5e-95) || !(a <= 4.4e-88)) {
tmp = a * 120.0;
} else {
tmp = -60.0 * (y / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -3.5e-95) or not (a <= 4.4e-88): tmp = a * 120.0 else: tmp = -60.0 * (y / (z - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.5e-95) || !(a <= 4.4e-88)) tmp = Float64(a * 120.0); else tmp = Float64(-60.0 * Float64(y / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -3.5e-95) || ~((a <= 4.4e-88))) tmp = a * 120.0; else tmp = -60.0 * (y / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.5e-95], N[Not[LessEqual[a, 4.4e-88]], $MachinePrecision]], N[(a * 120.0), $MachinePrecision], N[(-60.0 * N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.5 \cdot 10^{-95} \lor \neg \left(a \leq 4.4 \cdot 10^{-88}\right):\\
\;\;\;\;a \cdot 120\\
\mathbf{else}:\\
\;\;\;\;-60 \cdot \frac{y}{z - t}\\
\end{array}
\end{array}
if a < -3.4999999999999997e-95 or 4.4000000000000001e-88 < a Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 75.3%
if -3.4999999999999997e-95 < a < 4.4000000000000001e-88Initial program 99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in x around inf 91.2%
Taylor expanded in y around inf 41.7%
Final simplification62.7%
(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(60.0 * Float64(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[(60.0 * N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
60 \cdot \frac{x - y}{z - t} + a \cdot 120
\end{array}
Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
(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.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 52.7%
Final simplification52.7%
(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 2024111
(FPCore (x y z t a)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, B"
:precision binary64
:alt
(+ (/ 60.0 (/ (- z t) (- x y))) (* a 120.0))
(+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))