
(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.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.4
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 (if (or (<= (* a 120.0) -5e-132) (not (<= (* a 120.0) 4e-95))) (fma (/ x (- z t)) 60.0 (* 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 * 120.0) <= -5e-132) || !((a * 120.0) <= 4e-95)) {
tmp = fma((x / (z - t)), 60.0, (120.0 * a));
} else {
tmp = (x - y) * (60.0 / (z - t));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(a * 120.0) <= -5e-132) || !(Float64(a * 120.0) <= 4e-95)) tmp = fma(Float64(x / Float64(z - t)), 60.0, Float64(120.0 * a)); 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[N[(a * 120.0), $MachinePrecision], -5e-132], N[Not[LessEqual[N[(a * 120.0), $MachinePrecision], 4e-95]], $MachinePrecision]], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0 + N[(120.0 * a), $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 \cdot 120 \leq -5 \cdot 10^{-132} \lor \neg \left(a \cdot 120 \leq 4 \cdot 10^{-95}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z - t}, 60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\end{array}
\end{array}
if (*.f64 a #s(literal 120 binary64)) < -4.9999999999999999e-132 or 3.99999999999999996e-95 < (*.f64 a #s(literal 120 binary64)) Initial program 99.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.3
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 y around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6483.8
Applied rewrites83.8%
if -4.9999999999999999e-132 < (*.f64 a #s(literal 120 binary64)) < 3.99999999999999996e-95Initial program 99.7%
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--.f6490.8
Applied rewrites90.8%
Final simplification85.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= (* a 120.0) -50.0) (not (<= (* a 120.0) 1e+25))) (* 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 * 120.0) <= -50.0) || !((a * 120.0) <= 1e+25)) {
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 * 120.0d0) <= (-50.0d0)) .or. (.not. ((a * 120.0d0) <= 1d+25))) 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 * 120.0) <= -50.0) || !((a * 120.0) <= 1e+25)) {
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 * 120.0) <= -50.0) or not ((a * 120.0) <= 1e+25): 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 ((Float64(a * 120.0) <= -50.0) || !(Float64(a * 120.0) <= 1e+25)) 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 * 120.0) <= -50.0) || ~(((a * 120.0) <= 1e+25))) 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[N[(a * 120.0), $MachinePrecision], -50.0], N[Not[LessEqual[N[(a * 120.0), $MachinePrecision], 1e+25]], $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 \cdot 120 \leq -50 \lor \neg \left(a \cdot 120 \leq 10^{+25}\right):\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{60}{z - t}\\
\end{array}
\end{array}
if (*.f64 a #s(literal 120 binary64)) < -50 or 1.00000000000000009e25 < (*.f64 a #s(literal 120 binary64)) Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6480.2
Applied rewrites80.2%
if -50 < (*.f64 a #s(literal 120 binary64)) < 1.00000000000000009e25Initial program 99.0%
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--.f6477.5
Applied rewrites77.5%
Final simplification78.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= (* a 120.0) -50.0) (not (<= (* a 120.0) 1e+25))) (* 120.0 a) (* (/ (- x y) (- z t)) 60.0)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((a * 120.0) <= -50.0) || !((a * 120.0) <= 1e+25)) {
tmp = 120.0 * a;
} else {
tmp = ((x - y) / (z - t)) * 60.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) <= (-50.0d0)) .or. (.not. ((a * 120.0d0) <= 1d+25))) then
tmp = 120.0d0 * a
else
tmp = ((x - y) / (z - t)) * 60.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) <= -50.0) || !((a * 120.0) <= 1e+25)) {
tmp = 120.0 * a;
} else {
tmp = ((x - y) / (z - t)) * 60.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((a * 120.0) <= -50.0) or not ((a * 120.0) <= 1e+25): tmp = 120.0 * a else: tmp = ((x - y) / (z - t)) * 60.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((Float64(a * 120.0) <= -50.0) || !(Float64(a * 120.0) <= 1e+25)) tmp = Float64(120.0 * a); else tmp = Float64(Float64(Float64(x - y) / Float64(z - t)) * 60.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (((a * 120.0) <= -50.0) || ~(((a * 120.0) <= 1e+25))) tmp = 120.0 * a; else tmp = ((x - y) / (z - t)) * 60.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(a * 120.0), $MachinePrecision], -50.0], N[Not[LessEqual[N[(a * 120.0), $MachinePrecision], 1e+25]], $MachinePrecision]], N[(120.0 * a), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot 120 \leq -50 \lor \neg \left(a \cdot 120 \leq 10^{+25}\right):\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{z - t} \cdot 60\\
\end{array}
\end{array}
if (*.f64 a #s(literal 120 binary64)) < -50 or 1.00000000000000009e25 < (*.f64 a #s(literal 120 binary64)) Initial program 99.8%
Taylor expanded in z around inf
lower-*.f6480.2
Applied rewrites80.2%
if -50 < (*.f64 a #s(literal 120 binary64)) < 1.00000000000000009e25Initial program 99.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.0
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6499.7
Applied rewrites99.7%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6477.5
Applied rewrites77.5%
Final simplification78.8%
(FPCore (x y z t a)
:precision binary64
(if (<= x -4.3e+14)
(fma (/ x (- z t)) 60.0 (* 120.0 a))
(if (<= x 1.06e+99)
(fma 120.0 a (* (/ y (- z t)) -60.0))
(+ (/ (* 60.0 x) (- z t)) (* a 120.0)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -4.3e+14) {
tmp = fma((x / (z - t)), 60.0, (120.0 * a));
} else if (x <= 1.06e+99) {
tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
} else {
tmp = ((60.0 * x) / (z - t)) + (a * 120.0);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (x <= -4.3e+14) tmp = fma(Float64(x / Float64(z - t)), 60.0, Float64(120.0 * a)); elseif (x <= 1.06e+99) tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0)); else tmp = Float64(Float64(Float64(60.0 * x) / Float64(z - t)) + Float64(a * 120.0)); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -4.3e+14], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.06e+99], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(60.0 * x), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{+14}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z - t}, 60, 120 \cdot a\right)\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{+99}:\\
\;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{60 \cdot x}{z - t} + a \cdot 120\\
\end{array}
\end{array}
if x < -4.3e14Initial program 99.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.7
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 y around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6487.7
Applied rewrites87.7%
if -4.3e14 < x < 1.05999999999999999e99Initial program 99.2%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6496.4
Applied rewrites96.4%
if 1.05999999999999999e99 < x Initial program 99.8%
Taylor expanded in x around inf
lower-*.f6496.2
Applied rewrites96.2%
Final simplification94.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -4.3e+14) (not (<= x 1.06e+99))) (fma (/ x (- z t)) 60.0 (* 120.0 a)) (fma 120.0 a (* (/ y (- z t)) -60.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -4.3e+14) || !(x <= 1.06e+99)) {
tmp = fma((x / (z - t)), 60.0, (120.0 * a));
} else {
tmp = fma(120.0, a, ((y / (z - t)) * -60.0));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -4.3e+14) || !(x <= 1.06e+99)) tmp = fma(Float64(x / Float64(z - t)), 60.0, Float64(120.0 * a)); else tmp = fma(120.0, a, Float64(Float64(y / Float64(z - t)) * -60.0)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -4.3e+14], N[Not[LessEqual[x, 1.06e+99]], $MachinePrecision]], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0 + N[(120.0 * a), $MachinePrecision]), $MachinePrecision], N[(120.0 * a + N[(N[(y / N[(z - t), $MachinePrecision]), $MachinePrecision] * -60.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{+14} \lor \neg \left(x \leq 1.06 \cdot 10^{+99}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z - t}, 60, 120 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(120, a, \frac{y}{z - t} \cdot -60\right)\\
\end{array}
\end{array}
if x < -4.3e14 or 1.05999999999999999e99 < x Initial program 99.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6499.8
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 y around 0
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6491.4
Applied rewrites91.4%
if -4.3e14 < x < 1.05999999999999999e99Initial program 99.2%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6496.4
Applied rewrites96.4%
Final simplification94.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -6.8e+118) (not (<= x 1.4e+135))) (* x (/ 60.0 (- z t))) (* 120.0 a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -6.8e+118) || !(x <= 1.4e+135)) {
tmp = x * (60.0 / (z - 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 <= (-6.8d+118)) .or. (.not. (x <= 1.4d+135))) then
tmp = x * (60.0d0 / (z - 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 <= -6.8e+118) || !(x <= 1.4e+135)) {
tmp = x * (60.0 / (z - t));
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -6.8e+118) or not (x <= 1.4e+135): tmp = x * (60.0 / (z - t)) else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -6.8e+118) || !(x <= 1.4e+135)) tmp = Float64(x * Float64(60.0 / Float64(z - 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 <= -6.8e+118) || ~((x <= 1.4e+135))) tmp = x * (60.0 / (z - t)); else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -6.8e+118], N[Not[LessEqual[x, 1.4e+135]], $MachinePrecision]], N[(x * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+118} \lor \neg \left(x \leq 1.4 \cdot 10^{+135}\right):\\
\;\;\;\;x \cdot \frac{60}{z - t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if x < -6.79999999999999973e118 or 1.40000000000000001e135 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6475.2
Applied rewrites75.2%
Applied rewrites75.3%
if -6.79999999999999973e118 < x < 1.40000000000000001e135Initial program 99.2%
Taylor expanded in z around inf
lower-*.f6462.0
Applied rewrites62.0%
Final simplification65.6%
(FPCore (x y z t a) :precision binary64 (if (<= x -6.8e+118) (* x (/ 60.0 (- z t))) (if (<= x 1.4e+135) (* 120.0 a) (/ (* x 60.0) (- z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -6.8e+118) {
tmp = x * (60.0 / (z - t));
} else if (x <= 1.4e+135) {
tmp = 120.0 * a;
} else {
tmp = (x * 60.0) / (z - t);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (x <= (-6.8d+118)) then
tmp = x * (60.0d0 / (z - t))
else if (x <= 1.4d+135) then
tmp = 120.0d0 * a
else
tmp = (x * 60.0d0) / (z - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -6.8e+118) {
tmp = x * (60.0 / (z - t));
} else if (x <= 1.4e+135) {
tmp = 120.0 * a;
} else {
tmp = (x * 60.0) / (z - t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -6.8e+118: tmp = x * (60.0 / (z - t)) elif x <= 1.4e+135: tmp = 120.0 * a else: tmp = (x * 60.0) / (z - t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -6.8e+118) tmp = Float64(x * Float64(60.0 / Float64(z - t))); elseif (x <= 1.4e+135) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x * 60.0) / Float64(z - t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -6.8e+118) tmp = x * (60.0 / (z - t)); elseif (x <= 1.4e+135) tmp = 120.0 * a; else tmp = (x * 60.0) / (z - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -6.8e+118], N[(x * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4e+135], N[(120.0 * a), $MachinePrecision], N[(N[(x * 60.0), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+118}:\\
\;\;\;\;x \cdot \frac{60}{z - t}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+135}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 60}{z - t}\\
\end{array}
\end{array}
if x < -6.79999999999999973e118Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6472.4
Applied rewrites72.4%
Applied rewrites72.5%
if -6.79999999999999973e118 < x < 1.40000000000000001e135Initial program 99.2%
Taylor expanded in z around inf
lower-*.f6462.0
Applied rewrites62.0%
if 1.40000000000000001e135 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6478.0
Applied rewrites78.0%
Applied rewrites78.1%
(FPCore (x y z t a) :precision binary64 (if (<= x -6.8e+118) (* x (/ 60.0 (- z t))) (if (<= x 1.4e+135) (* 120.0 a) (* (/ x (- z t)) 60.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -6.8e+118) {
tmp = x * (60.0 / (z - t));
} else if (x <= 1.4e+135) {
tmp = 120.0 * a;
} else {
tmp = (x / (z - t)) * 60.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 <= (-6.8d+118)) then
tmp = x * (60.0d0 / (z - t))
else if (x <= 1.4d+135) then
tmp = 120.0d0 * a
else
tmp = (x / (z - t)) * 60.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 <= -6.8e+118) {
tmp = x * (60.0 / (z - t));
} else if (x <= 1.4e+135) {
tmp = 120.0 * a;
} else {
tmp = (x / (z - t)) * 60.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -6.8e+118: tmp = x * (60.0 / (z - t)) elif x <= 1.4e+135: tmp = 120.0 * a else: tmp = (x / (z - t)) * 60.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -6.8e+118) tmp = Float64(x * Float64(60.0 / Float64(z - t))); elseif (x <= 1.4e+135) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x / Float64(z - t)) * 60.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -6.8e+118) tmp = x * (60.0 / (z - t)); elseif (x <= 1.4e+135) tmp = 120.0 * a; else tmp = (x / (z - t)) * 60.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -6.8e+118], N[(x * N[(60.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4e+135], N[(120.0 * a), $MachinePrecision], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] * 60.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+118}:\\
\;\;\;\;x \cdot \frac{60}{z - t}\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{+135}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - t} \cdot 60\\
\end{array}
\end{array}
if x < -6.79999999999999973e118Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6472.4
Applied rewrites72.4%
Applied rewrites72.5%
if -6.79999999999999973e118 < x < 1.40000000000000001e135Initial program 99.2%
Taylor expanded in z around inf
lower-*.f6462.0
Applied rewrites62.0%
if 1.40000000000000001e135 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6478.0
Applied rewrites78.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -6.8e+118) (not (<= x 9.8e+154))) (* x (/ -60.0 t)) (* 120.0 a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -6.8e+118) || !(x <= 9.8e+154)) {
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 <= (-6.8d+118)) .or. (.not. (x <= 9.8d+154))) 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 <= -6.8e+118) || !(x <= 9.8e+154)) {
tmp = x * (-60.0 / t);
} else {
tmp = 120.0 * a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -6.8e+118) or not (x <= 9.8e+154): tmp = x * (-60.0 / t) else: tmp = 120.0 * a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -6.8e+118) || !(x <= 9.8e+154)) 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 <= -6.8e+118) || ~((x <= 9.8e+154))) tmp = x * (-60.0 / t); else tmp = 120.0 * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -6.8e+118], N[Not[LessEqual[x, 9.8e+154]], $MachinePrecision]], N[(x * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], N[(120.0 * a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+118} \lor \neg \left(x \leq 9.8 \cdot 10^{+154}\right):\\
\;\;\;\;x \cdot \frac{-60}{t}\\
\mathbf{else}:\\
\;\;\;\;120 \cdot a\\
\end{array}
\end{array}
if x < -6.79999999999999973e118 or 9.8000000000000003e154 < x Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6476.6
Applied rewrites76.6%
Taylor expanded in z around 0
Applied rewrites51.0%
Applied rewrites51.1%
if -6.79999999999999973e118 < x < 9.8000000000000003e154Initial program 99.3%
Taylor expanded in z around inf
lower-*.f6461.8
Applied rewrites61.8%
Final simplification59.0%
(FPCore (x y z t a) :precision binary64 (if (<= x -6.8e+118) (* x (/ -60.0 t)) (if (<= x 9.8e+154) (* 120.0 a) (/ (* -60.0 x) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -6.8e+118) {
tmp = x * (-60.0 / t);
} else if (x <= 9.8e+154) {
tmp = 120.0 * a;
} 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 <= (-6.8d+118)) then
tmp = x * ((-60.0d0) / t)
else if (x <= 9.8d+154) then
tmp = 120.0d0 * a
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 <= -6.8e+118) {
tmp = x * (-60.0 / t);
} else if (x <= 9.8e+154) {
tmp = 120.0 * a;
} else {
tmp = (-60.0 * x) / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -6.8e+118: tmp = x * (-60.0 / t) elif x <= 9.8e+154: tmp = 120.0 * a else: tmp = (-60.0 * x) / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -6.8e+118) tmp = Float64(x * Float64(-60.0 / t)); elseif (x <= 9.8e+154) tmp = Float64(120.0 * a); else tmp = Float64(Float64(-60.0 * x) / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -6.8e+118) tmp = x * (-60.0 / t); elseif (x <= 9.8e+154) tmp = 120.0 * a; else tmp = (-60.0 * x) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -6.8e+118], N[(x * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.8e+154], N[(120.0 * a), $MachinePrecision], N[(N[(-60.0 * x), $MachinePrecision] / t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+118}:\\
\;\;\;\;x \cdot \frac{-60}{t}\\
\mathbf{elif}\;x \leq 9.8 \cdot 10^{+154}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{-60 \cdot x}{t}\\
\end{array}
\end{array}
if x < -6.79999999999999973e118Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6472.4
Applied rewrites72.4%
Taylor expanded in z around 0
Applied rewrites50.3%
Applied rewrites50.5%
if -6.79999999999999973e118 < x < 9.8000000000000003e154Initial program 99.3%
Taylor expanded in z around inf
lower-*.f6461.8
Applied rewrites61.8%
if 9.8000000000000003e154 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6481.3
Applied rewrites81.3%
Taylor expanded in z around 0
Applied rewrites51.8%
Applied rewrites51.8%
(FPCore (x y z t a) :precision binary64 (if (<= x -6.8e+118) (* x (/ -60.0 t)) (if (<= x 9.8e+154) (* 120.0 a) (* (/ x t) -60.0))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -6.8e+118) {
tmp = x * (-60.0 / t);
} else if (x <= 9.8e+154) {
tmp = 120.0 * a;
} else {
tmp = (x / t) * -60.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 <= (-6.8d+118)) then
tmp = x * ((-60.0d0) / t)
else if (x <= 9.8d+154) then
tmp = 120.0d0 * a
else
tmp = (x / t) * (-60.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 <= -6.8e+118) {
tmp = x * (-60.0 / t);
} else if (x <= 9.8e+154) {
tmp = 120.0 * a;
} else {
tmp = (x / t) * -60.0;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -6.8e+118: tmp = x * (-60.0 / t) elif x <= 9.8e+154: tmp = 120.0 * a else: tmp = (x / t) * -60.0 return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -6.8e+118) tmp = Float64(x * Float64(-60.0 / t)); elseif (x <= 9.8e+154) tmp = Float64(120.0 * a); else tmp = Float64(Float64(x / t) * -60.0); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -6.8e+118) tmp = x * (-60.0 / t); elseif (x <= 9.8e+154) tmp = 120.0 * a; else tmp = (x / t) * -60.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -6.8e+118], N[(x * N[(-60.0 / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.8e+154], N[(120.0 * a), $MachinePrecision], N[(N[(x / t), $MachinePrecision] * -60.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{+118}:\\
\;\;\;\;x \cdot \frac{-60}{t}\\
\mathbf{elif}\;x \leq 9.8 \cdot 10^{+154}:\\
\;\;\;\;120 \cdot a\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t} \cdot -60\\
\end{array}
\end{array}
if x < -6.79999999999999973e118Initial program 99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6472.4
Applied rewrites72.4%
Taylor expanded in z around 0
Applied rewrites50.3%
Applied rewrites50.5%
if -6.79999999999999973e118 < x < 9.8000000000000003e154Initial program 99.3%
Taylor expanded in z around inf
lower-*.f6461.8
Applied rewrites61.8%
if 9.8000000000000003e154 < x Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f6481.3
Applied rewrites81.3%
Taylor expanded in z around 0
Applied rewrites51.8%
(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.4%
Taylor expanded in z around inf
lower-*.f6451.4
Applied rewrites51.4%
(FPCore (x y z t a) :precision binary64 (+ (/ 60.0 (/ (- z t) (- x y))) (* a 120.0)))
double code(double x, double y, double z, double t, double a) {
return (60.0 / ((z - t) / (x - y))) + (a * 120.0);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (60.0d0 / ((z - t) / (x - y))) + (a * 120.0d0)
end function
public static double code(double x, double y, double z, double t, double a) {
return (60.0 / ((z - t) / (x - y))) + (a * 120.0);
}
def code(x, y, z, t, a): return (60.0 / ((z - t) / (x - y))) + (a * 120.0)
function code(x, y, z, t, a) return Float64(Float64(60.0 / Float64(Float64(z - t) / Float64(x - y))) + Float64(a * 120.0)) end
function tmp = code(x, y, z, t, a) tmp = (60.0 / ((z - t) / (x - y))) + (a * 120.0); end
code[x_, y_, z_, t_, a_] := N[(N[(60.0 / N[(N[(z - t), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * 120.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{60}{\frac{z - t}{x - y}} + a \cdot 120
\end{array}
herbie shell --seed 2024326
(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)))