
(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 14 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.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.1
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* 60.0 (- x y)) (- z t))))
(if (<= t_1 -5e+20)
(* (- x y) (/ -60.0 t))
(if (<= t_1 1e+39) (* 120.0 a) (* (- x y) (/ 60.0 z))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+20) {
tmp = (x - y) * (-60.0 / t);
} else if (t_1 <= 1e+39) {
tmp = 120.0 * a;
} else {
tmp = (x - 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) :: t_1
real(8) :: tmp
t_1 = (60.0d0 * (x - y)) / (z - t)
if (t_1 <= (-5d+20)) then
tmp = (x - y) * ((-60.0d0) / t)
else if (t_1 <= 1d+39) then
tmp = 120.0d0 * a
else
tmp = (x - 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 t_1 = (60.0 * (x - y)) / (z - t);
double tmp;
if (t_1 <= -5e+20) {
tmp = (x - y) * (-60.0 / t);
} else if (t_1 <= 1e+39) {
tmp = 120.0 * a;
} else {
tmp = (x - y) * (60.0 / z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (60.0 * (x - y)) / (z - t) tmp = 0 if t_1 <= -5e+20: tmp = (x - y) * (-60.0 / t) elif t_1 <= 1e+39: tmp = 120.0 * a else: tmp = (x - y) * (60.0 / z) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(60.0 * Float64(x - y)) / Float64(z - t)) tmp = 0.0 if (t_1 <= -5e+20) tmp = Float64(Float64(x - y) * Float64(-60.0 / t)); elseif (t_1 <= 1e+39) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x - y) * Float64(60.0 / z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (60.0 * (x - y)) / (z - t); tmp = 0.0; if (t_1 <= -5e+20) tmp = (x - y) * (-60.0 / t); elseif (t_1 <= 1e+39) tmp = 120.0 * a; else tmp = (x - y) * (60.0 / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(60.0 * N[(x - y), $MachinePrecision]), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+20], N[(N[(x - y), $MachinePrecision] * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+39], N[(120.0 * a), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(60.0 / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{60 \cdot \left(x - y\right)}{z - t}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+20}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{-60}{t}\\
\mathbf{elif}\;t\_1 \leq 10^{+39}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z}\\
\end{array}
\end{array}
if (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < -5e20Initial program 99.8%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6476.5
Applied rewrites76.5%
Taylor expanded in z around 0
Applied rewrites54.6%
if -5e20 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) < 9.9999999999999994e38Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6472.9
Applied rewrites72.9%
if 9.9999999999999994e38 < (/.f64 (*.f64 #s(literal 60 binary64) (-.f64 x y)) (-.f64 z t)) Initial program 96.6%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6482.5
Applied rewrites82.5%
Taylor expanded in z around inf
Applied rewrites54.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.06e-10) (not (<= y 9.5e+84))) (fma a 120.0 (/ (* -60.0 y) (- z t))) (fma a 120.0 (/ (* x 60.0) (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.06e-10) || !(y <= 9.5e+84)) {
tmp = fma(a, 120.0, ((-60.0 * y) / (z - t)));
} else {
tmp = fma(a, 120.0, ((x * 60.0) / (z - t)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.06e-10) || !(y <= 9.5e+84)) tmp = fma(a, 120.0, Float64(Float64(-60.0 * y) / Float64(z - t))); else tmp = fma(a, 120.0, Float64(Float64(x * 60.0) / Float64(z - t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.06e-10], N[Not[LessEqual[y, 9.5e+84]], $MachinePrecision]], N[(a * 120.0 + N[(N[(-60.0 * y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + N[(N[(x * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.06 \cdot 10^{-10} \lor \neg \left(y \leq 9.5 \cdot 10^{+84}\right):\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60 \cdot y}{z - t}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x \cdot 60}{z - t}\right)\\
\end{array}
\end{array}
if y < -1.06e-10 or 9.49999999999999979e84 < y Initial program 98.2%
Taylor expanded in x around 0
lower-*.f6489.8
Applied rewrites89.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6489.8
Applied rewrites89.8%
if -1.06e-10 < y < 9.49999999999999979e84Initial program 99.8%
Taylor expanded in x around inf
lower-*.f6495.5
Applied rewrites95.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6495.5
Applied rewrites95.5%
Final simplification92.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.1e-55) (not (<= t 4.1e-20))) (fma a 120.0 (* (/ -60.0 t) (- x y))) (fma a 120.0 (* (/ 60.0 z) (- x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.1e-55) || !(t <= 4.1e-20)) {
tmp = fma(a, 120.0, ((-60.0 / t) * (x - y)));
} else {
tmp = fma(a, 120.0, ((60.0 / z) * (x - y)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.1e-55) || !(t <= 4.1e-20)) tmp = fma(a, 120.0, Float64(Float64(-60.0 / t) * Float64(x - y))); else tmp = fma(a, 120.0, Float64(Float64(60.0 / z) * Float64(x - y))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.1e-55], N[Not[LessEqual[t, 4.1e-20]], $MachinePrecision]], N[(a * 120.0 + N[(N[(-60.0 / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + N[(N[(60.0 / z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-55} \lor \neg \left(t \leq 4.1 \cdot 10^{-20}\right):\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60}{t} \cdot \left(x - y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{60}{z} \cdot \left(x - y\right)\right)\\
\end{array}
\end{array}
if t < -1.1e-55 or 4.1000000000000001e-20 < t Initial program 99.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.2
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around 0
lower-/.f6486.5
Applied rewrites86.5%
if -1.1e-55 < t < 4.1000000000000001e-20Initial program 98.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6498.9
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
lower-/.f6489.2
Applied rewrites89.2%
Final simplification87.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.1e-55) (not (<= t 4.1e-20))) (fma a 120.0 (* (/ -60.0 t) (- x y))) (fma a 120.0 (* (/ (- x y) z) 60.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.1e-55) || !(t <= 4.1e-20)) {
tmp = fma(a, 120.0, ((-60.0 / t) * (x - y)));
} else {
tmp = fma(a, 120.0, (((x - y) / z) * 60.0));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.1e-55) || !(t <= 4.1e-20)) tmp = fma(a, 120.0, Float64(Float64(-60.0 / t) * Float64(x - y))); else tmp = fma(a, 120.0, Float64(Float64(Float64(x - y) / z) * 60.0)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.1e-55], N[Not[LessEqual[t, 4.1e-20]], $MachinePrecision]], N[(a * 120.0 + N[(N[(-60.0 / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-55} \lor \neg \left(t \leq 4.1 \cdot 10^{-20}\right):\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{-60}{t} \cdot \left(x - y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x - y}{z} \cdot 60\right)\\
\end{array}
\end{array}
if t < -1.1e-55 or 4.1000000000000001e-20 < t Initial program 99.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.2
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around 0
lower-/.f6486.5
Applied rewrites86.5%
if -1.1e-55 < t < 4.1000000000000001e-20Initial program 98.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6498.9
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6489.2
Applied rewrites89.2%
Final simplification87.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.1e-55) (not (<= t 4.1e-20))) (fma (/ (- x y) t) -60.0 (* 120.0 a)) (fma a 120.0 (* (/ (- x y) z) 60.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.1e-55) || !(t <= 4.1e-20)) {
tmp = fma(((x - y) / t), -60.0, (120.0 * a));
} else {
tmp = fma(a, 120.0, (((x - y) / z) * 60.0));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.1e-55) || !(t <= 4.1e-20)) tmp = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)); else tmp = fma(a, 120.0, Float64(Float64(Float64(x - y) / z) * 60.0)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.1e-55], N[Not[LessEqual[t, 4.1e-20]], $MachinePrecision]], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(a * 120.0 + N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-55} \lor \neg \left(t \leq 4.1 \cdot 10^{-20}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 120, \frac{x - y}{z} \cdot 60\right)\\
\end{array}
\end{array}
if t < -1.1e-55 or 4.1000000000000001e-20 < t Initial program 99.1%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6486.4
Applied rewrites86.4%
if -1.1e-55 < t < 4.1000000000000001e-20Initial program 98.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6498.9
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6489.2
Applied rewrites89.2%
Final simplification87.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.4e-12) (not (<= t 4.1e-20))) (fma (/ (- x y) t) -60.0 (* 120.0 a)) (fma (/ (- x y) z) 60.0 (* 120.0 a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.4e-12) || !(t <= 4.1e-20)) {
tmp = fma(((x - y) / t), -60.0, (120.0 * a));
} else {
tmp = fma(((x - y) / z), 60.0, (120.0 * a));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.4e-12) || !(t <= 4.1e-20)) tmp = fma(Float64(Float64(x - y) / t), -60.0, Float64(120.0 * a)); else tmp = fma(Float64(Float64(x - y) / z), 60.0, Float64(120.0 * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.4e-12], N[Not[LessEqual[t, 4.1e-20]], $MachinePrecision]], N[(N[(N[(x - y), $MachinePrecision] / t), $MachinePrecision] * -60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{-12} \lor \neg \left(t \leq 4.1 \cdot 10^{-20}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{t}, -60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - y}{z}, 60, 120 \cdot a\right)\\
\end{array}
\end{array}
if t < -3.4000000000000001e-12 or 4.1000000000000001e-20 < t Initial program 99.1%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6489.4
Applied rewrites89.4%
if -3.4000000000000001e-12 < t < 4.1000000000000001e-20Initial program 99.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6485.5
Applied rewrites85.5%
Final simplification87.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8.6e-150) (not (<= a 2.8e-46))) (fma 120.0 a (* (/ y (- z t)) -60.0)) (* (- x y) (/ 60.0 (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8.6e-150) || !(a <= 2.8e-46)) {
tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
} else {
tmp = (x - y) * (60.0 / (z - t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8.6e-150) || !(a <= 2.8e-46)) tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0)); else tmp = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8.6e-150], N[Not[LessEqual[a, 2.8e-46]], $MachinePrecision]], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.6 \cdot 10^{-150} \lor \neg \left(a \leq 2.8 \cdot 10^{-46}\right):\\
\;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\end{array}
\end{array}
if a < -8.60000000000000008e-150 or 2.7999999999999998e-46 < a Initial program 99.9%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6484.3
Applied rewrites84.3%
if -8.60000000000000008e-150 < a < 2.7999999999999998e-46Initial program 97.5%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6489.3
Applied rewrites89.3%
Final simplification86.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -9.2e+81) (not (<= a 6.2e+96))) (* 120.0 a) (* (- x y) (/ 60.0 (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -9.2e+81) || !(a <= 6.2e+96)) {
tmp = 120.0 * a;
} else {
tmp = (x - 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 ((a <= (-9.2d+81)) .or. (.not. (a <= 6.2d+96))) then
tmp = 120.0d0 * a
else
tmp = (x - 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 ((a <= -9.2e+81) || !(a <= 6.2e+96)) {
tmp = 120.0 * a;
} else {
tmp = (x - y) * (60.0 / (z - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -9.2e+81) or not (a <= 6.2e+96): tmp = 120.0 * a else: tmp = (x - y) * (60.0 / (z - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -9.2e+81) || !(a <= 6.2e+96)) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x - y) * Float64(60.0 / Float64(z - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -9.2e+81) || ~((a <= 6.2e+96))) tmp = 120.0 * a; else tmp = (x - y) * (60.0 / (z - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -9.2e+81], N[Not[LessEqual[a, 6.2e+96]], $MachinePrecision]], N[(120.0 * a), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.2 \cdot 10^{+81} \lor \neg \left(a \leq 6.2 \cdot 10^{+96}\right):\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\end{array}
\end{array}
if a < -9.1999999999999995e81 or 6.1999999999999996e96 < a Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6486.0
Applied rewrites86.0%
if -9.1999999999999995e81 < a < 6.1999999999999996e96Initial program 98.5%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6474.2
Applied rewrites74.2%
Final simplification78.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -9.2e+81) (not (<= a 6.2e+96))) (* 120.0 a) (/ (* (- x y) 60.0) (- z t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -9.2e+81) || !(a <= 6.2e+96)) {
tmp = 120.0 * a;
} else {
tmp = ((x - 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 ((a <= (-9.2d+81)) .or. (.not. (a <= 6.2d+96))) then
tmp = 120.0d0 * a
else
tmp = ((x - 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 ((a <= -9.2e+81) || !(a <= 6.2e+96)) {
tmp = 120.0 * a;
} else {
tmp = ((x - y) * 60.0) / (z - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -9.2e+81) or not (a <= 6.2e+96): tmp = 120.0 * a else: tmp = ((x - y) * 60.0) / (z - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -9.2e+81) || !(a <= 6.2e+96)) tmp = Float64(120.0 * a); else tmp = Float64(Float64(Float64(x - y) * 60.0) / Float64(z - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -9.2e+81) || ~((a <= 6.2e+96))) tmp = 120.0 * a; else tmp = ((x - y) * 60.0) / (z - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -9.2e+81], N[Not[LessEqual[a, 6.2e+96]], $MachinePrecision]], N[(120.0 * a), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.2 \cdot 10^{+81} \lor \neg \left(a \leq 6.2 \cdot 10^{+96}\right):\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot 60}{z - t}\\
\end{array}
\end{array}
if a < -9.1999999999999995e81 or 6.1999999999999996e96 < a Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6486.0
Applied rewrites86.0%
if -9.1999999999999995e81 < a < 6.1999999999999996e96Initial program 98.5%
Taylor expanded in x around 0
lower-*.f6465.5
Applied rewrites65.5%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6465.5
Applied rewrites65.5%
Taylor expanded in a around 0
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6473.0
Applied rewrites73.0%
Final simplification77.7%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.6e-127)
(* 120.0 a)
(if (<= a 3.2e-298)
(* x (/ -60.0 t))
(if (<= a 6.5e-146) (* (/ y t) 60.0) (* 120.0 a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.6e-127) {
tmp = 120.0 * a;
} else if (a <= 3.2e-298) {
tmp = x * (-60.0 / t);
} else if (a <= 6.5e-146) {
tmp = (y / t) * 60.0;
} else {
tmp = 120.0 * a;
}
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.6d-127)) then
tmp = 120.0d0 * a
else if (a <= 3.2d-298) then
tmp = x * ((-60.0d0) / t)
else if (a <= 6.5d-146) then
tmp = (y / t) * 60.0d0
else
tmp = 120.0d0 * a
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.6e-127) {
tmp = 120.0 * a;
} else if (a <= 3.2e-298) {
tmp = x * (-60.0 / t);
} else if (a <= 6.5e-146) {
tmp = (y / t) * 60.0;
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.6e-127: tmp = 120.0 * a elif a <= 3.2e-298: tmp = x * (-60.0 / t) elif a <= 6.5e-146: tmp = (y / t) * 60.0 else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.6e-127) tmp = Float64(120.0 * a); elseif (a <= 3.2e-298) tmp = Float64(x * Float64(-60.0 / t)); elseif (a <= 6.5e-146) tmp = Float64(Float64(y / t) * 60.0); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.6e-127) tmp = 120.0 * a; elseif (a <= 3.2e-298) tmp = x * (-60.0 / t); elseif (a <= 6.5e-146) tmp = (y / t) * 60.0; else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.6e-127], N[(120.0 * a), $MachinePrecision], If[LessEqual[a, 3.2e-298], N[(x * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6.5e-146], N[(N[(y / t), $MachinePrecision] * 60.0), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \cdot 10^{-127}:\\
\;\;\;\;120 \cdot a\\
\mathbf{elif}\;a \leq 3.2 \cdot 10^{-298}:\\
\;\;\;\;x \cdot \frac{-60}{t}\\
\mathbf{elif}\;a \leq 6.5 \cdot 10^{-146}:\\
\;\;\;\;\frac{y}{t} \cdot 60\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if a < -1.60000000000000009e-127 or 6.4999999999999999e-146 < a Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6464.5
Applied rewrites64.5%
if -1.60000000000000009e-127 < a < 3.19999999999999997e-298Initial program 97.2%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6454.9
Applied rewrites54.9%
Taylor expanded in x around inf
Applied rewrites33.4%
Applied rewrites33.5%
if 3.19999999999999997e-298 < a < 6.4999999999999999e-146Initial program 97.1%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6453.0
Applied rewrites53.0%
Taylor expanded in y around inf
Applied rewrites40.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8.2e-128) (not (<= a 1.96e-41))) (* 120.0 a) (* (- x y) (/ -60.0 t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8.2e-128) || !(a <= 1.96e-41)) {
tmp = 120.0 * a;
} else {
tmp = (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 ((a <= (-8.2d-128)) .or. (.not. (a <= 1.96d-41))) then
tmp = 120.0d0 * a
else
tmp = (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 ((a <= -8.2e-128) || !(a <= 1.96e-41)) {
tmp = 120.0 * a;
} else {
tmp = (x - y) * (-60.0 / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -8.2e-128) or not (a <= 1.96e-41): tmp = 120.0 * a else: tmp = (x - y) * (-60.0 / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8.2e-128) || !(a <= 1.96e-41)) tmp = Float64(120.0 * a); else tmp = 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 ((a <= -8.2e-128) || ~((a <= 1.96e-41))) tmp = 120.0 * a; else tmp = (x - y) * (-60.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8.2e-128], N[Not[LessEqual[a, 1.96e-41]], $MachinePrecision]], N[(120.0 * a), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.2 \cdot 10^{-128} \lor \neg \left(a \leq 1.96 \cdot 10^{-41}\right):\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{-60}{t}\\
\end{array}
\end{array}
if a < -8.1999999999999999e-128 or 1.96e-41 < a Initial program 99.9%
Taylor expanded in z around inf
lower-*.f6468.4
Applied rewrites68.4%
if -8.1999999999999999e-128 < a < 1.96e-41Initial program 97.6%
Taylor expanded in a around 0
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower--.f6488.7
Applied rewrites88.7%
Taylor expanded in z around 0
Applied rewrites48.9%
Final simplification61.4%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.86e+188) (* x (/ -60.0 t)) (* 120.0 a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.86e+188) {
tmp = x * (-60.0 / t);
} else {
tmp = 120.0 * a;
}
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.86d+188)) then
tmp = x * ((-60.0d0) / t)
else
tmp = 120.0d0 * a
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.86e+188) {
tmp = x * (-60.0 / t);
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.86e+188: tmp = x * (-60.0 / t) else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.86e+188) tmp = Float64(x * Float64(-60.0 / t)); else tmp = Float64(120.0 * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.86e+188) tmp = x * (-60.0 / t); else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.86e+188], N[(x * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.86 \cdot 10^{+188}:\\
\;\;\;\;x \cdot \frac{-60}{t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if x < -1.86e188Initial program 96.1%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6471.2
Applied rewrites71.2%
Taylor expanded in x around inf
Applied rewrites58.7%
Applied rewrites58.7%
if -1.86e188 < x Initial program 99.4%
Taylor expanded in z around inf
lower-*.f6451.5
Applied rewrites51.5%
(FPCore (x y z t a) :precision binary64 (* 120.0 a))
double code(double x, double y, double z, double t, double a) {
return 120.0 * a;
}
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 = 120.0d0 * a
end function
public static double code(double x, double y, double z, double t, double a) {
return 120.0 * a;
}
def code(x, y, z, t, a): return 120.0 * a
function code(x, y, z, t, a) return Float64(120.0 * a) end
function tmp = code(x, y, z, t, a) tmp = 120.0 * a; end
code[x_, y_, z_, t_, a_] := N[(120.0 * a), $MachinePrecision]
\begin{array}{l}
\\
120 \cdot a
\end{array}
Initial program 99.0%
Taylor expanded in z around inf
lower-*.f6448.8
Applied rewrites48.8%
(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 2024332
(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)))