
(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 12 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 (/ 60.0 (/ (- z t) (- x y)))))
double code(double x, double y, double z, double t, double a) {
return fma(a, 120.0, (60.0 / ((z - t) / (x - y))));
}
function code(x, y, z, t, a) return fma(a, 120.0, Float64(60.0 / Float64(Float64(z - t) / Float64(x - y)))) end
code[x_, y_, z_, t_, a_] := N[(a * 120.0 + N[(60.0 / N[(N[(z - t), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, 120, \frac{60}{\frac{z - t}{x - y}}\right)
\end{array}
Initial program 99.4%
associate-/l*99.7%
Simplified99.7%
+-commutative99.7%
fma-define99.8%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= (* a 120.0) -4e+85) (not (<= (* a 120.0) 0.2))) (* 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) <= -4e+85) || !((a * 120.0) <= 0.2)) {
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) <= (-4d+85)) .or. (.not. ((a * 120.0d0) <= 0.2d0))) 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) <= -4e+85) || !((a * 120.0) <= 0.2)) {
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) <= -4e+85) or not ((a * 120.0) <= 0.2): 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) <= -4e+85) || !(Float64(a * 120.0) <= 0.2)) 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) <= -4e+85) || ~(((a * 120.0) <= 0.2))) 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], -4e+85], N[Not[LessEqual[N[(a * 120.0), $MachinePrecision], 0.2]], $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 -4 \cdot 10^{+85} \lor \neg \left(a \cdot 120 \leq 0.2\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.0000000000000001e85 or 0.20000000000000001 < (*.f64 a #s(literal 120 binary64)) Initial program 99.0%
*-commutative99.0%
associate-/l*99.8%
fma-define99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
distribute-frac-neg299.9%
distribute-neg-frac99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 76.4%
if -4.0000000000000001e85 < (*.f64 a #s(literal 120 binary64)) < 0.20000000000000001Initial program 99.7%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in a around 0 74.8%
Final simplification75.5%
(FPCore (x y z t a)
:precision binary64
(if (<= (* a 120.0) -4e+85)
(* a 120.0)
(if (<= (* a 120.0) 4e+18)
(* 60.0 (/ (- x y) (- z t)))
(+ (* a 120.0) (/ (* y -60.0) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 120.0) <= -4e+85) {
tmp = a * 120.0;
} else if ((a * 120.0) <= 4e+18) {
tmp = 60.0 * ((x - y) / (z - t));
} else {
tmp = (a * 120.0) + ((y * -60.0) / 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 ((a * 120.0d0) <= (-4d+85)) then
tmp = a * 120.0d0
else if ((a * 120.0d0) <= 4d+18) then
tmp = 60.0d0 * ((x - y) / (z - t))
else
tmp = (a * 120.0d0) + ((y * (-60.0d0)) / z)
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) <= -4e+85) {
tmp = a * 120.0;
} else if ((a * 120.0) <= 4e+18) {
tmp = 60.0 * ((x - y) / (z - t));
} else {
tmp = (a * 120.0) + ((y * -60.0) / z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a * 120.0) <= -4e+85: tmp = a * 120.0 elif (a * 120.0) <= 4e+18: tmp = 60.0 * ((x - y) / (z - t)) else: tmp = (a * 120.0) + ((y * -60.0) / z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 120.0) <= -4e+85) tmp = Float64(a * 120.0); elseif (Float64(a * 120.0) <= 4e+18) tmp = Float64(60.0 * Float64(Float64(x - y) / Float64(z - t))); else tmp = Float64(Float64(a * 120.0) + Float64(Float64(y * -60.0) / z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a * 120.0) <= -4e+85) tmp = a * 120.0; elseif ((a * 120.0) <= 4e+18) tmp = 60.0 * ((x - y) / (z - t)); else tmp = (a * 120.0) + ((y * -60.0) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a * 120.0), $MachinePrecision], -4e+85], N[(a * 120.0), $MachinePrecision], If[LessEqual[N[(a * 120.0), $MachinePrecision], 4e+18], N[(60.0 * N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(y * -60.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 120 \leq -4 \cdot 10^{+85}:\\
\;\;\;\;a \cdot 120\\
\mathbf{elif}\;a \cdot 120 \leq 4 \cdot 10^{+18}:\\
\;\;\;\;60 \cdot \frac{x - y}{z - t}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120 + \frac{y \cdot -60}{z}\\
\end{array}
\end{array}
if (*.f64 a #s(literal 120 binary64)) < -4.0000000000000001e85Initial program 98.1%
*-commutative98.1%
associate-/l*99.9%
fma-define99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
distribute-frac-neg299.9%
distribute-neg-frac99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 82.9%
if -4.0000000000000001e85 < (*.f64 a #s(literal 120 binary64)) < 4e18Initial program 99.7%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in a around 0 73.0%
if 4e18 < (*.f64 a #s(literal 120 binary64)) Initial program 99.7%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in x around 0 95.8%
neg-mul-195.8%
distribute-neg-frac295.8%
sub-neg95.8%
distribute-neg-in95.8%
remove-double-neg95.8%
+-commutative95.8%
sub-neg95.8%
Simplified95.8%
Taylor expanded in t around 0 78.0%
associate-*r/78.0%
*-commutative78.0%
Simplified78.0%
Final simplification76.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -4.8e+122) (not (<= x 1.55e+177))) (/ 60.0 (/ (- z t) (- x y))) (+ (* a 120.0) (* 60.0 (/ y (- t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -4.8e+122) || !(x <= 1.55e+177)) {
tmp = 60.0 / ((z - t) / (x - y));
} 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 <= (-4.8d+122)) .or. (.not. (x <= 1.55d+177))) then
tmp = 60.0d0 / ((z - t) / (x - y))
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 <= -4.8e+122) || !(x <= 1.55e+177)) {
tmp = 60.0 / ((z - t) / (x - y));
} else {
tmp = (a * 120.0) + (60.0 * (y / (t - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -4.8e+122) or not (x <= 1.55e+177): tmp = 60.0 / ((z - t) / (x - y)) else: tmp = (a * 120.0) + (60.0 * (y / (t - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -4.8e+122) || !(x <= 1.55e+177)) tmp = Float64(60.0 / Float64(Float64(z - t) / Float64(x - y))); 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 <= -4.8e+122) || ~((x <= 1.55e+177))) tmp = 60.0 / ((z - t) / (x - y)); 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, -4.8e+122], N[Not[LessEqual[x, 1.55e+177]], $MachinePrecision]], N[(60.0 / N[(N[(z - t), $MachinePrecision] / N[(x - y), $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 -4.8 \cdot 10^{+122} \lor \neg \left(x \leq 1.55 \cdot 10^{+177}\right):\\
\;\;\;\;\frac{60}{\frac{z - t}{x - y}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120 + 60 \cdot \frac{y}{t - z}\\
\end{array}
\end{array}
if x < -4.8000000000000004e122 or 1.55e177 < x Initial program 99.8%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in a around 0 74.6%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr74.8%
if -4.8000000000000004e122 < x < 1.55e177Initial program 99.2%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 90.1%
neg-mul-190.1%
distribute-neg-frac290.1%
sub-neg90.1%
distribute-neg-in90.1%
remove-double-neg90.1%
+-commutative90.1%
sub-neg90.1%
Simplified90.1%
Final simplification86.3%
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.26e+46)
(+ (* a 120.0) (/ 60.0 (/ (- t z) y)))
(if (<= y 1.2e+24)
(+ (* a 120.0) (/ (* 60.0 x) (- z t)))
(+ (* a 120.0) (* 60.0 (/ y (- t z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.26e+46) {
tmp = (a * 120.0) + (60.0 / ((t - z) / y));
} else if (y <= 1.2e+24) {
tmp = (a * 120.0) + ((60.0 * x) / (z - t));
} 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 (y <= (-1.26d+46)) then
tmp = (a * 120.0d0) + (60.0d0 / ((t - z) / y))
else if (y <= 1.2d+24) then
tmp = (a * 120.0d0) + ((60.0d0 * x) / (z - t))
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 (y <= -1.26e+46) {
tmp = (a * 120.0) + (60.0 / ((t - z) / y));
} else if (y <= 1.2e+24) {
tmp = (a * 120.0) + ((60.0 * x) / (z - t));
} else {
tmp = (a * 120.0) + (60.0 * (y / (t - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.26e+46: tmp = (a * 120.0) + (60.0 / ((t - z) / y)) elif y <= 1.2e+24: tmp = (a * 120.0) + ((60.0 * x) / (z - t)) else: tmp = (a * 120.0) + (60.0 * (y / (t - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.26e+46) tmp = Float64(Float64(a * 120.0) + Float64(60.0 / Float64(Float64(t - z) / y))); elseif (y <= 1.2e+24) tmp = Float64(Float64(a * 120.0) + Float64(Float64(60.0 * x) / Float64(z - t))); 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 (y <= -1.26e+46) tmp = (a * 120.0) + (60.0 / ((t - z) / y)); elseif (y <= 1.2e+24) tmp = (a * 120.0) + ((60.0 * x) / (z - t)); else tmp = (a * 120.0) + (60.0 * (y / (t - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.26e+46], N[(N[(a * 120.0), $MachinePrecision] + N[(60.0 / N[(N[(t - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.2e+24], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(60.0 * x), $MachinePrecision] / N[(z - t), $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}\;y \leq -1.26 \cdot 10^{+46}:\\
\;\;\;\;a \cdot 120 + \frac{60}{\frac{t - z}{y}}\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+24}:\\
\;\;\;\;a \cdot 120 + \frac{60 \cdot x}{z - t}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120 + 60 \cdot \frac{y}{t - z}\\
\end{array}
\end{array}
if y < -1.2599999999999999e46Initial program 99.7%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in x around 0 90.8%
neg-mul-190.8%
distribute-neg-frac290.8%
sub-neg90.8%
distribute-neg-in90.8%
remove-double-neg90.8%
+-commutative90.8%
sub-neg90.8%
Simplified90.8%
clear-num90.8%
un-div-inv90.9%
Applied egg-rr90.9%
if -1.2599999999999999e46 < y < 1.2e24Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 94.9%
associate-*r/94.9%
Simplified94.9%
if 1.2e24 < y Initial program 98.2%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in x around 0 85.6%
neg-mul-185.6%
distribute-neg-frac285.6%
sub-neg85.6%
distribute-neg-in85.6%
remove-double-neg85.6%
+-commutative85.6%
sub-neg85.6%
Simplified85.6%
Final simplification91.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.1e-99) (not (<= a 2.4e-20))) (* a 120.0) (* -60.0 (/ (- x y) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.1e-99) || !(a <= 2.4e-20)) {
tmp = a * 120.0;
} else {
tmp = -60.0 * ((x - 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 <= (-1.1d-99)) .or. (.not. (a <= 2.4d-20))) then
tmp = a * 120.0d0
else
tmp = (-60.0d0) * ((x - 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 <= -1.1e-99) || !(a <= 2.4e-20)) {
tmp = a * 120.0;
} else {
tmp = -60.0 * ((x - y) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.1e-99) or not (a <= 2.4e-20): tmp = a * 120.0 else: tmp = -60.0 * ((x - y) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.1e-99) || !(a <= 2.4e-20)) tmp = Float64(a * 120.0); else tmp = Float64(-60.0 * Float64(Float64(x - y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.1e-99) || ~((a <= 2.4e-20))) tmp = a * 120.0; else tmp = -60.0 * ((x - y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.1e-99], N[Not[LessEqual[a, 2.4e-20]], $MachinePrecision]], N[(a * 120.0), $MachinePrecision], N[(-60.0 * N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{-99} \lor \neg \left(a \leq 2.4 \cdot 10^{-20}\right):\\
\;\;\;\;a \cdot 120\\
\mathbf{else}:\\
\;\;\;\;-60 \cdot \frac{x - y}{t}\\
\end{array}
\end{array}
if a < -1.10000000000000002e-99 or 2.39999999999999993e-20 < a Initial program 99.2%
*-commutative99.2%
associate-/l*99.8%
fma-define99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
distribute-frac-neg299.9%
distribute-neg-frac99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 68.2%
if -1.10000000000000002e-99 < a < 2.39999999999999993e-20Initial program 99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in a around inf 80.8%
Taylor expanded in z around 0 51.0%
*-commutative51.0%
Simplified51.0%
Taylor expanded in a around 0 54.8%
Final simplification62.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -4.8e+119) (not (<= x 2.3e+231))) (* -60.0 (/ x t)) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -4.8e+119) || !(x <= 2.3e+231)) {
tmp = -60.0 * (x / t);
} 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 <= (-4.8d+119)) .or. (.not. (x <= 2.3d+231))) then
tmp = (-60.0d0) * (x / t)
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 <= -4.8e+119) || !(x <= 2.3e+231)) {
tmp = -60.0 * (x / t);
} else {
tmp = a * 120.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -4.8e+119) or not (x <= 2.3e+231): tmp = -60.0 * (x / t) else: tmp = a * 120.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -4.8e+119) || !(x <= 2.3e+231)) tmp = Float64(-60.0 * Float64(x / t)); else tmp = Float64(a * 120.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -4.8e+119) || ~((x <= 2.3e+231))) tmp = -60.0 * (x / t); else tmp = a * 120.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -4.8e+119], N[Not[LessEqual[x, 2.3e+231]], $MachinePrecision]], N[(-60.0 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(a * 120.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{+119} \lor \neg \left(x \leq 2.3 \cdot 10^{+231}\right):\\
\;\;\;\;-60 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120\\
\end{array}
\end{array}
if x < -4.8e119 or 2.29999999999999999e231 < x Initial program 99.8%
associate-/l*99.7%
Simplified99.7%
+-commutative99.7%
fma-define99.7%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 71.0%
Taylor expanded in z around 0 54.6%
if -4.8e119 < x < 2.29999999999999999e231Initial program 99.3%
*-commutative99.3%
associate-/l*99.7%
fma-define99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
distribute-frac-neg299.8%
distribute-neg-frac99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 56.8%
Final simplification56.4%
(FPCore (x y z t a) :precision binary64 (if (<= x -3.3e+119) (/ (* x -60.0) t) (if (<= x 5e+231) (* a 120.0) (* -60.0 (/ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -3.3e+119) {
tmp = (x * -60.0) / t;
} else if (x <= 5e+231) {
tmp = a * 120.0;
} else {
tmp = -60.0 * (x / 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 <= (-3.3d+119)) then
tmp = (x * (-60.0d0)) / t
else if (x <= 5d+231) then
tmp = a * 120.0d0
else
tmp = (-60.0d0) * (x / 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 <= -3.3e+119) {
tmp = (x * -60.0) / t;
} else if (x <= 5e+231) {
tmp = a * 120.0;
} else {
tmp = -60.0 * (x / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -3.3e+119: tmp = (x * -60.0) / t elif x <= 5e+231: tmp = a * 120.0 else: tmp = -60.0 * (x / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -3.3e+119) tmp = Float64(Float64(x * -60.0) / t); elseif (x <= 5e+231) tmp = Float64(a * 120.0); else tmp = Float64(-60.0 * Float64(x / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -3.3e+119) tmp = (x * -60.0) / t; elseif (x <= 5e+231) tmp = a * 120.0; else tmp = -60.0 * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -3.3e+119], N[(N[(x * -60.0), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[x, 5e+231], N[(a * 120.0), $MachinePrecision], N[(-60.0 * N[(x / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{+119}:\\
\;\;\;\;\frac{x \cdot -60}{t}\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+231}:\\
\;\;\;\;a \cdot 120\\
\mathbf{else}:\\
\;\;\;\;-60 \cdot \frac{x}{t}\\
\end{array}
\end{array}
if x < -3.3000000000000002e119Initial program 99.7%
associate-/l*99.6%
Simplified99.6%
+-commutative99.6%
fma-define99.7%
clear-num99.6%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in x around inf 65.3%
Taylor expanded in z around 0 50.2%
associate-*r/50.4%
Simplified50.4%
if -3.3000000000000002e119 < x < 5.00000000000000028e231Initial program 99.3%
*-commutative99.3%
associate-/l*99.7%
fma-define99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
distribute-frac-neg299.8%
distribute-neg-frac99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 56.8%
if 5.00000000000000028e231 < x Initial program 100.0%
associate-/l*99.9%
Simplified99.9%
+-commutative99.9%
fma-define99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 84.5%
Taylor expanded in z around 0 65.2%
Final simplification56.4%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.3e+119) (* x (/ -60.0 t)) (if (<= x 2.75e+231) (* a 120.0) (* -60.0 (/ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.3e+119) {
tmp = x * (-60.0 / t);
} else if (x <= 2.75e+231) {
tmp = a * 120.0;
} else {
tmp = -60.0 * (x / 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 <= (-1.3d+119)) then
tmp = x * ((-60.0d0) / t)
else if (x <= 2.75d+231) then
tmp = a * 120.0d0
else
tmp = (-60.0d0) * (x / 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 <= -1.3e+119) {
tmp = x * (-60.0 / t);
} else if (x <= 2.75e+231) {
tmp = a * 120.0;
} else {
tmp = -60.0 * (x / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.3e+119: tmp = x * (-60.0 / t) elif x <= 2.75e+231: tmp = a * 120.0 else: tmp = -60.0 * (x / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.3e+119) tmp = Float64(x * Float64(-60.0 / t)); elseif (x <= 2.75e+231) tmp = Float64(a * 120.0); else tmp = Float64(-60.0 * Float64(x / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.3e+119) tmp = x * (-60.0 / t); elseif (x <= 2.75e+231) tmp = a * 120.0; else tmp = -60.0 * (x / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.3e+119], N[(x * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.75e+231], N[(a * 120.0), $MachinePrecision], N[(-60.0 * N[(x / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+119}:\\
\;\;\;\;x \cdot \frac{-60}{t}\\
\mathbf{elif}\;x \leq 2.75 \cdot 10^{+231}:\\
\;\;\;\;a \cdot 120\\
\mathbf{else}:\\
\;\;\;\;-60 \cdot \frac{x}{t}\\
\end{array}
\end{array}
if x < -1.3e119Initial program 99.7%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in a around inf 81.1%
Taylor expanded in z around 0 55.6%
*-commutative55.6%
Simplified55.6%
Taylor expanded in x around inf 55.3%
associate-*r/55.3%
*-commutative55.3%
times-frac32.1%
Simplified32.1%
Taylor expanded in a around 0 50.2%
associate-*r/50.4%
*-commutative50.4%
associate-*r/50.3%
Simplified50.3%
if -1.3e119 < x < 2.75e231Initial program 99.3%
*-commutative99.3%
associate-/l*99.7%
fma-define99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
distribute-frac-neg299.8%
distribute-neg-frac99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 56.8%
if 2.75e231 < x Initial program 100.0%
associate-/l*99.9%
Simplified99.9%
+-commutative99.9%
fma-define99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 84.5%
Taylor expanded in z around 0 65.2%
Final simplification56.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}
Initial program 99.4%
associate-/l*99.7%
Simplified99.7%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
(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.7%
Simplified99.7%
Final simplification99.7%
(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%
*-commutative99.4%
associate-/l*99.7%
fma-define99.7%
sub-neg99.7%
+-commutative99.7%
neg-sub099.7%
associate-+l-99.7%
sub0-neg99.7%
distribute-frac-neg299.7%
distribute-neg-frac99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in t around inf 50.2%
Final simplification50.2%
(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 2024187
(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)))