
(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 13 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(Float64(60.0 / Float64(z - t)) * Float64(x - y))) end
code[x_, y_, z_, t_, a_] := N[(a * 120.0 + N[(N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, 120, \frac{60}{z - t} \cdot \left(x - y\right)\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
fma-def99.8%
associate-*l/99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ 60.0 (- z t)) (- x y))))
(if (<= (* a 120.0) -50000000000.0)
(* a 120.0)
(if (<= (* a 120.0) -1e-70)
t_1
(if (<= (* a 120.0) -2e-107)
(+ (* a 120.0) (* x (/ -60.0 t)))
(if (<= (* a 120.0) -2e-114)
(+ (* a 120.0) (/ 60.0 (/ t y)))
(if (<= (* a 120.0) 2e+18) t_1 (* a 120.0))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 / (z - t)) * (x - y);
double tmp;
if ((a * 120.0) <= -50000000000.0) {
tmp = a * 120.0;
} else if ((a * 120.0) <= -1e-70) {
tmp = t_1;
} else if ((a * 120.0) <= -2e-107) {
tmp = (a * 120.0) + (x * (-60.0 / t));
} else if ((a * 120.0) <= -2e-114) {
tmp = (a * 120.0) + (60.0 / (t / y));
} else if ((a * 120.0) <= 2e+18) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (60.0d0 / (z - t)) * (x - y)
if ((a * 120.0d0) <= (-50000000000.0d0)) then
tmp = a * 120.0d0
else if ((a * 120.0d0) <= (-1d-70)) then
tmp = t_1
else if ((a * 120.0d0) <= (-2d-107)) then
tmp = (a * 120.0d0) + (x * ((-60.0d0) / t))
else if ((a * 120.0d0) <= (-2d-114)) then
tmp = (a * 120.0d0) + (60.0d0 / (t / y))
else if ((a * 120.0d0) <= 2d+18) then
tmp = t_1
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 t_1 = (60.0 / (z - t)) * (x - y);
double tmp;
if ((a * 120.0) <= -50000000000.0) {
tmp = a * 120.0;
} else if ((a * 120.0) <= -1e-70) {
tmp = t_1;
} else if ((a * 120.0) <= -2e-107) {
tmp = (a * 120.0) + (x * (-60.0 / t));
} else if ((a * 120.0) <= -2e-114) {
tmp = (a * 120.0) + (60.0 / (t / y));
} else if ((a * 120.0) <= 2e+18) {
tmp = t_1;
} else {
tmp = a * 120.0;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 / (z - t)) * (x - y) tmp = 0 if (a * 120.0) <= -50000000000.0: tmp = a * 120.0 elif (a * 120.0) <= -1e-70: tmp = t_1 elif (a * 120.0) <= -2e-107: tmp = (a * 120.0) + (x * (-60.0 / t)) elif (a * 120.0) <= -2e-114: tmp = (a * 120.0) + (60.0 / (t / y)) elif (a * 120.0) <= 2e+18: tmp = t_1 else: tmp = a * 120.0 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(60.0 / Float64(z - t)) * Float64(x - y)) tmp = 0.0 if (Float64(a * 120.0) <= -50000000000.0) tmp = Float64(a * 120.0); elseif (Float64(a * 120.0) <= -1e-70) tmp = t_1; elseif (Float64(a * 120.0) <= -2e-107) tmp = Float64(Float64(a * 120.0) + Float64(x * Float64(-60.0 / t))); elseif (Float64(a * 120.0) <= -2e-114) tmp = Float64(Float64(a * 120.0) + Float64(60.0 / Float64(t / y))); elseif (Float64(a * 120.0) <= 2e+18) tmp = t_1; else tmp = Float64(a * 120.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (60.0 / (z - t)) * (x - y); tmp = 0.0; if ((a * 120.0) <= -50000000000.0) tmp = a * 120.0; elseif ((a * 120.0) <= -1e-70) tmp = t_1; elseif ((a * 120.0) <= -2e-107) tmp = (a * 120.0) + (x * (-60.0 / t)); elseif ((a * 120.0) <= -2e-114) tmp = (a * 120.0) + (60.0 / (t / y)); elseif ((a * 120.0) <= 2e+18) tmp = t_1; else tmp = a * 120.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * 120.0), $MachinePrecision], -50000000000.0], N[(a * 120.0), $MachinePrecision], If[LessEqual[N[(a * 120.0), $MachinePrecision], -1e-70], t$95$1, If[LessEqual[N[(a * 120.0), $MachinePrecision], -2e-107], N[(N[(a * 120.0), $MachinePrecision] + N[(x * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * 120.0), $MachinePrecision], -2e-114], N[(N[(a * 120.0), $MachinePrecision] + N[(60.0 / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * 120.0), $MachinePrecision], 2e+18], t$95$1, N[(a * 120.0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60}{z - t} \cdot \left(x - y\right)\\
\mathbf{if}\;a \cdot 120 \leq -50000000000:\\
\;\;\;\;a \cdot 120\\
\mathbf{elif}\;a \cdot 120 \leq -1 \cdot 10^{-70}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot 120 \leq -2 \cdot 10^{-107}:\\
\;\;\;\;a \cdot 120 + x \cdot \frac{-60}{t}\\
\mathbf{elif}\;a \cdot 120 \leq -2 \cdot 10^{-114}:\\
\;\;\;\;a \cdot 120 + \frac{60}{\frac{t}{y}}\\
\mathbf{elif}\;a \cdot 120 \leq 2 \cdot 10^{+18}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120\\
\end{array}
\end{array}
if (*.f64 a 120) < -5e10 or 2e18 < (*.f64 a 120) Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 86.1%
if -5e10 < (*.f64 a 120) < -9.99999999999999996e-71 or -2.0000000000000001e-114 < (*.f64 a 120) < 2e18Initial program 99.6%
associate-/l*99.6%
Simplified99.6%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in a around 0 80.0%
associate-*r/80.1%
*-commutative80.1%
associate-*r/80.1%
Simplified80.1%
if -9.99999999999999996e-71 < (*.f64 a 120) < -2e-107Initial program 100.0%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in x around inf 100.0%
associate-*r/100.0%
associate-*l/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
if -2e-107 < (*.f64 a 120) < -2.0000000000000001e-114Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
associate-*r/100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in z around 0 100.0%
Final simplification83.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ 60.0 (- z t))))
(if (or (<= (* a 120.0) -2e-97) (not (<= (* a 120.0) 2e+18)))
(+ (* a 120.0) (* t_1 x))
(* t_1 (- x y)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = 60.0 / (z - t);
double tmp;
if (((a * 120.0) <= -2e-97) || !((a * 120.0) <= 2e+18)) {
tmp = (a * 120.0) + (t_1 * x);
} else {
tmp = t_1 * (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 = 60.0d0 / (z - t)
if (((a * 120.0d0) <= (-2d-97)) .or. (.not. ((a * 120.0d0) <= 2d+18))) then
tmp = (a * 120.0d0) + (t_1 * x)
else
tmp = t_1 * (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 = 60.0 / (z - t);
double tmp;
if (((a * 120.0) <= -2e-97) || !((a * 120.0) <= 2e+18)) {
tmp = (a * 120.0) + (t_1 * x);
} else {
tmp = t_1 * (x - y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = 60.0 / (z - t) tmp = 0 if ((a * 120.0) <= -2e-97) or not ((a * 120.0) <= 2e+18): tmp = (a * 120.0) + (t_1 * x) else: tmp = t_1 * (x - y) return tmp
function code(x, y, z, t, a) t_1 = Float64(60.0 / Float64(z - t)) tmp = 0.0 if ((Float64(a * 120.0) <= -2e-97) || !(Float64(a * 120.0) <= 2e+18)) tmp = Float64(Float64(a * 120.0) + Float64(t_1 * x)); else tmp = Float64(t_1 * Float64(x - y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = 60.0 / (z - t); tmp = 0.0; if (((a * 120.0) <= -2e-97) || ~(((a * 120.0) <= 2e+18))) tmp = (a * 120.0) + (t_1 * x); else tmp = t_1 * (x - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(a * 120.0), $MachinePrecision], -2e-97], N[Not[LessEqual[N[(a * 120.0), $MachinePrecision], 2e+18]], $MachinePrecision]], N[(N[(a * 120.0), $MachinePrecision] + N[(t$95$1 * x), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(x - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60}{z - t}\\
\mathbf{if}\;a \cdot 120 \leq -2 \cdot 10^{-97} \lor \neg \left(a \cdot 120 \leq 2 \cdot 10^{+18}\right):\\
\;\;\;\;a \cdot 120 + t_1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(x - y\right)\\
\end{array}
\end{array}
if (*.f64 a 120) < -2.00000000000000007e-97 or 2e18 < (*.f64 a 120) Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 91.9%
associate-*r/91.9%
associate-*l/91.9%
*-commutative91.9%
Simplified91.9%
if -2.00000000000000007e-97 < (*.f64 a 120) < 2e18Initial program 99.7%
associate-/l*99.6%
Simplified99.6%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in a around 0 81.3%
associate-*r/81.4%
*-commutative81.4%
associate-*r/81.4%
Simplified81.4%
Final simplification87.6%
(FPCore (x y z t a) :precision binary64 (if (<= (* a 120.0) -50000000000.0) (* a 120.0) (if (<= (* a 120.0) 2e+18) (* (/ 60.0 (- z t)) (- x y)) (* a 120.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a * 120.0) <= -50000000000.0) {
tmp = a * 120.0;
} else if ((a * 120.0) <= 2e+18) {
tmp = (60.0 / (z - t)) * (x - y);
} 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 ((a * 120.0d0) <= (-50000000000.0d0)) then
tmp = a * 120.0d0
else if ((a * 120.0d0) <= 2d+18) then
tmp = (60.0d0 / (z - t)) * (x - y)
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 ((a * 120.0) <= -50000000000.0) {
tmp = a * 120.0;
} else if ((a * 120.0) <= 2e+18) {
tmp = (60.0 / (z - t)) * (x - y);
} else {
tmp = a * 120.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a * 120.0) <= -50000000000.0: tmp = a * 120.0 elif (a * 120.0) <= 2e+18: tmp = (60.0 / (z - t)) * (x - y) else: tmp = a * 120.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(a * 120.0) <= -50000000000.0) tmp = Float64(a * 120.0); elseif (Float64(a * 120.0) <= 2e+18) tmp = Float64(Float64(60.0 / Float64(z - t)) * Float64(x - y)); else tmp = Float64(a * 120.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a * 120.0) <= -50000000000.0) tmp = a * 120.0; elseif ((a * 120.0) <= 2e+18) tmp = (60.0 / (z - t)) * (x - y); else tmp = a * 120.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(a * 120.0), $MachinePrecision], -50000000000.0], N[(a * 120.0), $MachinePrecision], If[LessEqual[N[(a * 120.0), $MachinePrecision], 2e+18], N[(N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision], N[(a * 120.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 120 \leq -50000000000:\\
\;\;\;\;a \cdot 120\\
\mathbf{elif}\;a \cdot 120 \leq 2 \cdot 10^{+18}:\\
\;\;\;\;\frac{60}{z - t} \cdot \left(x - y\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120\\
\end{array}
\end{array}
if (*.f64 a 120) < -5e10 or 2e18 < (*.f64 a 120) Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 86.1%
if -5e10 < (*.f64 a 120) < 2e18Initial program 99.7%
associate-/l*99.6%
Simplified99.6%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in a around 0 77.5%
associate-*r/77.6%
*-commutative77.6%
associate-*r/77.7%
Simplified77.7%
Final simplification82.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.2e+23) (not (<= y 1e+73))) (+ (* a 120.0) (/ (* y -60.0) (- z t))) (+ (* a 120.0) (* (/ 60.0 (- z t)) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.2e+23) || !(y <= 1e+73)) {
tmp = (a * 120.0) + ((y * -60.0) / (z - t));
} else {
tmp = (a * 120.0) + ((60.0 / (z - t)) * x);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-1.2d+23)) .or. (.not. (y <= 1d+73))) then
tmp = (a * 120.0d0) + ((y * (-60.0d0)) / (z - t))
else
tmp = (a * 120.0d0) + ((60.0d0 / (z - t)) * x)
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.2e+23) || !(y <= 1e+73)) {
tmp = (a * 120.0) + ((y * -60.0) / (z - t));
} else {
tmp = (a * 120.0) + ((60.0 / (z - t)) * x);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.2e+23) or not (y <= 1e+73): tmp = (a * 120.0) + ((y * -60.0) / (z - t)) else: tmp = (a * 120.0) + ((60.0 / (z - t)) * x) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.2e+23) || !(y <= 1e+73)) tmp = Float64(Float64(a * 120.0) + Float64(Float64(y * -60.0) / Float64(z - t))); else tmp = Float64(Float64(a * 120.0) + Float64(Float64(60.0 / Float64(z - t)) * x)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.2e+23) || ~((y <= 1e+73))) tmp = (a * 120.0) + ((y * -60.0) / (z - t)); else tmp = (a * 120.0) + ((60.0 / (z - t)) * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.2e+23], N[Not[LessEqual[y, 1e+73]], $MachinePrecision]], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(y * -60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+23} \lor \neg \left(y \leq 10^{+73}\right):\\
\;\;\;\;a \cdot 120 + \frac{y \cdot -60}{z - t}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120 + \frac{60}{z - t} \cdot x\\
\end{array}
\end{array}
if y < -1.2e23 or 9.99999999999999983e72 < y Initial program 99.7%
Taylor expanded in x around 0 91.8%
if -1.2e23 < y < 9.99999999999999983e72Initial program 99.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 94.5%
associate-*r/94.5%
associate-*l/94.5%
*-commutative94.5%
Simplified94.5%
Final simplification93.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -5.2e+25) (not (<= y 2.3e+70))) (+ (* a 120.0) (/ (* y -60.0) (- z t))) (+ (* a 120.0) (/ (* 60.0 x) (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5.2e+25) || !(y <= 2.3e+70)) {
tmp = (a * 120.0) + ((y * -60.0) / (z - t));
} else {
tmp = (a * 120.0) + ((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 ((y <= (-5.2d+25)) .or. (.not. (y <= 2.3d+70))) then
tmp = (a * 120.0d0) + ((y * (-60.0d0)) / (z - t))
else
tmp = (a * 120.0d0) + ((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 ((y <= -5.2e+25) || !(y <= 2.3e+70)) {
tmp = (a * 120.0) + ((y * -60.0) / (z - t));
} else {
tmp = (a * 120.0) + ((60.0 * x) / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -5.2e+25) or not (y <= 2.3e+70): tmp = (a * 120.0) + ((y * -60.0) / (z - t)) else: tmp = (a * 120.0) + ((60.0 * x) / (z - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -5.2e+25) || !(y <= 2.3e+70)) tmp = Float64(Float64(a * 120.0) + Float64(Float64(y * -60.0) / Float64(z - t))); else tmp = Float64(Float64(a * 120.0) + Float64(Float64(60.0 * x) / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -5.2e+25) || ~((y <= 2.3e+70))) tmp = (a * 120.0) + ((y * -60.0) / (z - t)); else tmp = (a * 120.0) + ((60.0 * x) / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -5.2e+25], N[Not[LessEqual[y, 2.3e+70]], $MachinePrecision]], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(y * -60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(60.0 * x), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+25} \lor \neg \left(y \leq 2.3 \cdot 10^{+70}\right):\\
\;\;\;\;a \cdot 120 + \frac{y \cdot -60}{z - t}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120 + \frac{60 \cdot x}{z - t}\\
\end{array}
\end{array}
if y < -5.1999999999999997e25 or 2.29999999999999994e70 < y Initial program 99.7%
Taylor expanded in x around 0 91.8%
if -5.1999999999999997e25 < y < 2.29999999999999994e70Initial program 99.9%
Taylor expanded in x around inf 94.5%
*-commutative94.5%
Simplified94.5%
Final simplification93.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.25e+23) (not (<= y 1.3e+70))) (+ (* a 120.0) (/ 60.0 (/ (- t z) y))) (+ (* a 120.0) (/ (* 60.0 x) (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.25e+23) || !(y <= 1.3e+70)) {
tmp = (a * 120.0) + (60.0 / ((t - z) / y));
} else {
tmp = (a * 120.0) + ((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 ((y <= (-1.25d+23)) .or. (.not. (y <= 1.3d+70))) then
tmp = (a * 120.0d0) + (60.0d0 / ((t - z) / y))
else
tmp = (a * 120.0d0) + ((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 ((y <= -1.25e+23) || !(y <= 1.3e+70)) {
tmp = (a * 120.0) + (60.0 / ((t - z) / y));
} else {
tmp = (a * 120.0) + ((60.0 * x) / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.25e+23) or not (y <= 1.3e+70): tmp = (a * 120.0) + (60.0 / ((t - z) / y)) else: tmp = (a * 120.0) + ((60.0 * x) / (z - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.25e+23) || !(y <= 1.3e+70)) tmp = Float64(Float64(a * 120.0) + Float64(60.0 / Float64(Float64(t - z) / y))); else tmp = Float64(Float64(a * 120.0) + Float64(Float64(60.0 * x) / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.25e+23) || ~((y <= 1.3e+70))) tmp = (a * 120.0) + (60.0 / ((t - z) / y)); else tmp = (a * 120.0) + ((60.0 * x) / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.25e+23], N[Not[LessEqual[y, 1.3e+70]], $MachinePrecision]], N[(N[(a * 120.0), $MachinePrecision] + N[(60.0 / N[(N[(t - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 120.0), $MachinePrecision] + N[(N[(60.0 * x), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+23} \lor \neg \left(y \leq 1.3 \cdot 10^{+70}\right):\\
\;\;\;\;a \cdot 120 + \frac{60}{\frac{t - z}{y}}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120 + \frac{60 \cdot x}{z - t}\\
\end{array}
\end{array}
if y < -1.25e23 or 1.3e70 < y Initial program 99.7%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in x around 0 91.8%
associate-*r/91.8%
neg-mul-191.8%
Simplified91.8%
if -1.25e23 < y < 1.3e70Initial program 99.9%
Taylor expanded in x around inf 94.5%
*-commutative94.5%
Simplified94.5%
Final simplification93.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5000000.0) (not (<= a 1.95e+17))) (* 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 <= -5000000.0) || !(a <= 1.95e+17)) {
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 <= (-5000000.0d0)) .or. (.not. (a <= 1.95d+17))) 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 <= -5000000.0) || !(a <= 1.95e+17)) {
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 <= -5000000.0) or not (a <= 1.95e+17): 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 ((a <= -5000000.0) || !(a <= 1.95e+17)) 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 <= -5000000.0) || ~((a <= 1.95e+17))) 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[a, -5000000.0], N[Not[LessEqual[a, 1.95e+17]], $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 \leq -5000000 \lor \neg \left(a \leq 1.95 \cdot 10^{+17}\right):\\
\;\;\;\;a \cdot 120\\
\mathbf{else}:\\
\;\;\;\;60 \cdot \frac{x - y}{z - t}\\
\end{array}
\end{array}
if a < -5e6 or 1.95e17 < a Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 86.1%
if -5e6 < a < 1.95e17Initial program 99.7%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in a around 0 77.5%
Final simplification82.0%
(FPCore (x y z t a) :precision binary64 (+ (* a 120.0) (* (/ 60.0 (- z t)) (- x y))))
double code(double x, double y, double z, double t, double a) {
return (a * 120.0) + ((60.0 / (z - t)) * (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 = (a * 120.0d0) + ((60.0d0 / (z - t)) * (x - y))
end function
public static double code(double x, double y, double z, double t, double a) {
return (a * 120.0) + ((60.0 / (z - t)) * (x - y));
}
def code(x, y, z, t, a): return (a * 120.0) + ((60.0 / (z - t)) * (x - y))
function code(x, y, z, t, a) return Float64(Float64(a * 120.0) + Float64(Float64(60.0 / Float64(z - t)) * Float64(x - y))) end
function tmp = code(x, y, z, t, a) tmp = (a * 120.0) + ((60.0 / (z - t)) * (x - y)); end
code[x_, y_, z_, t_, a_] := N[(N[(a * 120.0), $MachinePrecision] + N[(N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot 120 + \frac{60}{z - t} \cdot \left(x - y\right)
\end{array}
Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.35e-99) (* a 120.0) (if (<= a 1.55e+16) (* -60.0 (/ (- x y) t)) (* a 120.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.35e-99) {
tmp = a * 120.0;
} else if (a <= 1.55e+16) {
tmp = -60.0 * ((x - y) / 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 (a <= (-1.35d-99)) then
tmp = a * 120.0d0
else if (a <= 1.55d+16) then
tmp = (-60.0d0) * ((x - y) / 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 (a <= -1.35e-99) {
tmp = a * 120.0;
} else if (a <= 1.55e+16) {
tmp = -60.0 * ((x - y) / t);
} else {
tmp = a * 120.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.35e-99: tmp = a * 120.0 elif a <= 1.55e+16: tmp = -60.0 * ((x - y) / t) else: tmp = a * 120.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.35e-99) tmp = Float64(a * 120.0); elseif (a <= 1.55e+16) tmp = Float64(-60.0 * Float64(Float64(x - y) / t)); else tmp = Float64(a * 120.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.35e-99) tmp = a * 120.0; elseif (a <= 1.55e+16) tmp = -60.0 * ((x - y) / t); else tmp = a * 120.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.35e-99], N[(a * 120.0), $MachinePrecision], If[LessEqual[a, 1.55e+16], N[(-60.0 * N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(a * 120.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35 \cdot 10^{-99}:\\
\;\;\;\;a \cdot 120\\
\mathbf{elif}\;a \leq 1.55 \cdot 10^{+16}:\\
\;\;\;\;-60 \cdot \frac{x - y}{t}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120\\
\end{array}
\end{array}
if a < -1.35e-99 or 1.55e16 < a Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 81.3%
if -1.35e-99 < a < 1.55e16Initial program 99.7%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in a around 0 81.3%
Taylor expanded in z around 0 47.7%
Final simplification67.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.45e-99) (* a 120.0) (if (<= a 1.55e+16) (* (- x y) (/ -60.0 t)) (* a 120.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.45e-99) {
tmp = a * 120.0;
} else if (a <= 1.55e+16) {
tmp = (x - y) * (-60.0 / 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 (a <= (-1.45d-99)) then
tmp = a * 120.0d0
else if (a <= 1.55d+16) then
tmp = (x - y) * ((-60.0d0) / 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 (a <= -1.45e-99) {
tmp = a * 120.0;
} else if (a <= 1.55e+16) {
tmp = (x - y) * (-60.0 / t);
} else {
tmp = a * 120.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.45e-99: tmp = a * 120.0 elif a <= 1.55e+16: tmp = (x - y) * (-60.0 / t) else: tmp = a * 120.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.45e-99) tmp = Float64(a * 120.0); elseif (a <= 1.55e+16) tmp = Float64(Float64(x - y) * Float64(-60.0 / t)); else tmp = Float64(a * 120.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.45e-99) tmp = a * 120.0; elseif (a <= 1.55e+16) tmp = (x - y) * (-60.0 / t); else tmp = a * 120.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.45e-99], N[(a * 120.0), $MachinePrecision], If[LessEqual[a, 1.55e+16], N[(N[(x - y), $MachinePrecision] * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], N[(a * 120.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.45 \cdot 10^{-99}:\\
\;\;\;\;a \cdot 120\\
\mathbf{elif}\;a \leq 1.55 \cdot 10^{+16}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{-60}{t}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120\\
\end{array}
\end{array}
if a < -1.44999999999999993e-99 or 1.55e16 < a Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 81.3%
if -1.44999999999999993e-99 < a < 1.55e16Initial program 99.7%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in a around 0 81.3%
Taylor expanded in z around 0 47.7%
expm1-log1p-u29.8%
expm1-udef13.9%
Applied egg-rr13.9%
expm1-def29.8%
expm1-log1p47.7%
associate-*r/47.8%
associate-*l/47.8%
Simplified47.8%
Final simplification67.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.3e-205) (* a 120.0) (if (<= z 2.7e-225) (* -60.0 (/ x t)) (* a 120.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.3e-205) {
tmp = a * 120.0;
} else if (z <= 2.7e-225) {
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 (z <= (-1.3d-205)) then
tmp = a * 120.0d0
else if (z <= 2.7d-225) 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 (z <= -1.3e-205) {
tmp = a * 120.0;
} else if (z <= 2.7e-225) {
tmp = -60.0 * (x / t);
} else {
tmp = a * 120.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.3e-205: tmp = a * 120.0 elif z <= 2.7e-225: tmp = -60.0 * (x / t) else: tmp = a * 120.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.3e-205) tmp = Float64(a * 120.0); elseif (z <= 2.7e-225) 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 (z <= -1.3e-205) tmp = a * 120.0; elseif (z <= 2.7e-225) tmp = -60.0 * (x / t); else tmp = a * 120.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.3e-205], N[(a * 120.0), $MachinePrecision], If[LessEqual[z, 2.7e-225], N[(-60.0 * N[(x / t), $MachinePrecision]), $MachinePrecision], N[(a * 120.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-205}:\\
\;\;\;\;a \cdot 120\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-225}:\\
\;\;\;\;-60 \cdot \frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;a \cdot 120\\
\end{array}
\end{array}
if z < -1.2999999999999999e-205 or 2.69999999999999992e-225 < z Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 61.8%
if -1.2999999999999999e-205 < z < 2.69999999999999992e-225Initial program 99.7%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in a around 0 79.4%
Taylor expanded in z around 0 76.7%
Taylor expanded in x around inf 52.6%
Final simplification60.5%
(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 56.1%
Final simplification56.1%
(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 2023200
(FPCore (x y z t a)
:name "Data.Colour.RGB:hslsv from colour-2.3.3, B"
:precision binary64
:herbie-target
(+ (/ 60.0 (/ (- z t) (- x y))) (* a 120.0))
(+ (/ (* 60.0 (- x y)) (- z t)) (* a 120.0)))