
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (+ x (* z (* (- y x) 6.0))))
double code(double x, double y, double z) {
return x + (z * ((y - x) * 6.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (z * ((y - x) * 6.0d0))
end function
public static double code(double x, double y, double z) {
return x + (z * ((y - x) * 6.0));
}
def code(x, y, z): return x + (z * ((y - x) * 6.0))
function code(x, y, z) return Float64(x + Float64(z * Float64(Float64(y - x) * 6.0))) end
function tmp = code(x, y, z) tmp = x + (z * ((y - x) * 6.0)); end
code[x_, y_, z_] := N[(x + N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \left(\left(y - x\right) \cdot 6\right)
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -7.3e-6) (not (<= z 4.9e-15))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -7.3e-6) || !(z <= 4.9e-15)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-7.3d-6)) .or. (.not. (z <= 4.9d-15))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -7.3e-6) || !(z <= 4.9e-15)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -7.3e-6) or not (z <= 4.9e-15): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -7.3e-6) || !(z <= 4.9e-15)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -7.3e-6) || ~((z <= 4.9e-15))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -7.3e-6], N[Not[LessEqual[z, 4.9e-15]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.3 \cdot 10^{-6} \lor \neg \left(z \leq 4.9 \cdot 10^{-15}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.30000000000000041e-6 or 4.8999999999999999e-15 < z Initial program 99.8%
Taylor expanded in y around 0 96.5%
+-commutative96.5%
metadata-eval96.5%
cancel-sign-sub-inv96.5%
*-commutative96.5%
associate-*l*96.5%
*-commutative96.5%
associate-*l*96.5%
distribute-lft-out--99.8%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.5%
if -7.30000000000000041e-6 < z < 4.8999999999999999e-15Initial program 99.9%
Taylor expanded in z around 0 75.4%
Final simplification86.9%
(FPCore (x y z) :precision binary64 (if (<= z -1.25e-8) (* 6.0 (* (- y x) z)) (if (<= z 7e-21) x (* z (* (- y x) 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.25e-8) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 7e-21) {
tmp = x;
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.25d-8)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 7d-21) then
tmp = x
else
tmp = z * ((y - x) * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.25e-8) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 7e-21) {
tmp = x;
} else {
tmp = z * ((y - x) * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.25e-8: tmp = 6.0 * ((y - x) * z) elif z <= 7e-21: tmp = x else: tmp = z * ((y - x) * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.25e-8) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 7e-21) tmp = x; else tmp = Float64(z * Float64(Float64(y - x) * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.25e-8) tmp = 6.0 * ((y - x) * z); elseif (z <= 7e-21) tmp = x; else tmp = z * ((y - x) * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.25e-8], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7e-21], x, N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{-8}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-21}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\end{array}
\end{array}
if z < -1.2499999999999999e-8Initial program 99.7%
Taylor expanded in y around 0 96.8%
+-commutative96.8%
metadata-eval96.8%
cancel-sign-sub-inv96.8%
*-commutative96.8%
associate-*l*96.8%
*-commutative96.8%
associate-*l*96.8%
distribute-lft-out--99.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.3%
if -1.2499999999999999e-8 < z < 7.0000000000000007e-21Initial program 99.9%
Taylor expanded in z around 0 75.4%
if 7.0000000000000007e-21 < z Initial program 99.9%
Taylor expanded in y around 0 96.0%
+-commutative96.0%
metadata-eval96.0%
cancel-sign-sub-inv96.0%
*-commutative96.0%
associate-*l*96.2%
*-commutative96.2%
associate-*l*96.2%
distribute-lft-out--99.9%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
Simplified99.9%
Final simplification86.9%
(FPCore (x y z) :precision binary64 (if (<= z -1.2e-8) (* 6.0 (* (- y x) z)) (if (<= z 7e-11) x (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.2e-8) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 7e-11) {
tmp = x;
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.2d-8)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 7d-11) then
tmp = x
else
tmp = (y - x) * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.2e-8) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 7e-11) {
tmp = x;
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.2e-8: tmp = 6.0 * ((y - x) * z) elif z <= 7e-11: tmp = x else: tmp = (y - x) * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.2e-8) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 7e-11) tmp = x; else tmp = Float64(Float64(y - x) * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.2e-8) tmp = 6.0 * ((y - x) * z); elseif (z <= 7e-11) tmp = x; else tmp = (y - x) * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.2e-8], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7e-11], x, N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{-8}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-11}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -1.19999999999999999e-8Initial program 99.7%
Taylor expanded in y around 0 96.8%
+-commutative96.8%
metadata-eval96.8%
cancel-sign-sub-inv96.8%
*-commutative96.8%
associate-*l*96.8%
*-commutative96.8%
associate-*l*96.8%
distribute-lft-out--99.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.3%
if -1.19999999999999999e-8 < z < 7.00000000000000038e-11Initial program 99.9%
Taylor expanded in z around 0 75.4%
if 7.00000000000000038e-11 < z Initial program 99.9%
Taylor expanded in y around 0 96.0%
+-commutative96.0%
metadata-eval96.0%
cancel-sign-sub-inv96.0%
*-commutative96.0%
associate-*l*96.2%
*-commutative96.2%
associate-*l*96.2%
distribute-lft-out--99.9%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
associate-*r*99.9%
*-commutative99.9%
Simplified99.9%
Final simplification86.9%
(FPCore (x y z) :precision binary64 (if (<= z -3.2e-5) (* 6.0 (* (- y x) z)) (if (<= z 5.7e-11) (+ x (* -6.0 (* x z))) (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.2e-5) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 5.7e-11) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-3.2d-5)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 5.7d-11) then
tmp = x + ((-6.0d0) * (x * z))
else
tmp = (y - x) * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3.2e-5) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 5.7e-11) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.2e-5: tmp = 6.0 * ((y - x) * z) elif z <= 5.7e-11: tmp = x + (-6.0 * (x * z)) else: tmp = (y - x) * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.2e-5) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 5.7e-11) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = Float64(Float64(y - x) * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.2e-5) tmp = 6.0 * ((y - x) * z); elseif (z <= 5.7e-11) tmp = x + (-6.0 * (x * z)); else tmp = (y - x) * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.2e-5], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.7e-11], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-5}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-11}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -3.19999999999999986e-5Initial program 99.7%
Taylor expanded in y around 0 96.8%
+-commutative96.8%
metadata-eval96.8%
cancel-sign-sub-inv96.8%
*-commutative96.8%
associate-*l*96.8%
*-commutative96.8%
associate-*l*96.8%
distribute-lft-out--99.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.3%
if -3.19999999999999986e-5 < z < 5.6999999999999997e-11Initial program 99.9%
Taylor expanded in y around 0 75.8%
if 5.6999999999999997e-11 < z Initial program 99.9%
Taylor expanded in y around 0 96.0%
+-commutative96.0%
metadata-eval96.0%
cancel-sign-sub-inv96.0%
*-commutative96.0%
associate-*l*96.2%
*-commutative96.2%
associate-*l*96.2%
distribute-lft-out--99.9%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
associate-*r*99.9%
*-commutative99.9%
Simplified99.9%
Final simplification87.1%
(FPCore (x y z) :precision binary64 (if (<= z -1850.0) (* 6.0 (* (- y x) z)) (if (<= z 8.5e-9) (+ x (* 6.0 (* y z))) (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1850.0) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 8.5e-9) {
tmp = x + (6.0 * (y * z));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1850.0d0)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 8.5d-9) then
tmp = x + (6.0d0 * (y * z))
else
tmp = (y - x) * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1850.0) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 8.5e-9) {
tmp = x + (6.0 * (y * z));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1850.0: tmp = 6.0 * ((y - x) * z) elif z <= 8.5e-9: tmp = x + (6.0 * (y * z)) else: tmp = (y - x) * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1850.0) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 8.5e-9) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(Float64(y - x) * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1850.0) tmp = 6.0 * ((y - x) * z); elseif (z <= 8.5e-9) tmp = x + (6.0 * (y * z)); else tmp = (y - x) * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1850.0], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e-9], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1850:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-9}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -1850Initial program 99.7%
Taylor expanded in y around 0 96.8%
+-commutative96.8%
metadata-eval96.8%
cancel-sign-sub-inv96.8%
*-commutative96.8%
associate-*l*96.8%
*-commutative96.8%
associate-*l*96.7%
distribute-lft-out--99.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.3%
if -1850 < z < 8.5e-9Initial program 99.9%
Taylor expanded in y around inf 99.5%
if 8.5e-9 < z Initial program 99.9%
Taylor expanded in y around 0 96.0%
+-commutative96.0%
metadata-eval96.0%
cancel-sign-sub-inv96.0%
*-commutative96.0%
associate-*l*96.2%
*-commutative96.2%
associate-*l*96.2%
distribute-lft-out--99.9%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
associate-*r*99.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (<= z -1850.0) (* 6.0 (* (- y x) z)) (if (<= z 8.5e-9) (+ x (* z (* y 6.0))) (* (- y x) (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1850.0) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 8.5e-9) {
tmp = x + (z * (y * 6.0));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1850.0d0)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 8.5d-9) then
tmp = x + (z * (y * 6.0d0))
else
tmp = (y - x) * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1850.0) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 8.5e-9) {
tmp = x + (z * (y * 6.0));
} else {
tmp = (y - x) * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1850.0: tmp = 6.0 * ((y - x) * z) elif z <= 8.5e-9: tmp = x + (z * (y * 6.0)) else: tmp = (y - x) * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1850.0) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 8.5e-9) tmp = Float64(x + Float64(z * Float64(y * 6.0))); else tmp = Float64(Float64(y - x) * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1850.0) tmp = 6.0 * ((y - x) * z); elseif (z <= 8.5e-9) tmp = x + (z * (y * 6.0)); else tmp = (y - x) * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1850.0], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e-9], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1850:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-9}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -1850Initial program 99.7%
Taylor expanded in y around 0 96.8%
+-commutative96.8%
metadata-eval96.8%
cancel-sign-sub-inv96.8%
*-commutative96.8%
associate-*l*96.8%
*-commutative96.8%
associate-*l*96.7%
distribute-lft-out--99.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.3%
if -1850 < z < 8.5e-9Initial program 99.9%
Taylor expanded in y around inf 99.6%
if 8.5e-9 < z Initial program 99.9%
Taylor expanded in y around 0 96.0%
+-commutative96.0%
metadata-eval96.0%
cancel-sign-sub-inv96.0%
*-commutative96.0%
associate-*l*96.2%
*-commutative96.2%
associate-*l*96.2%
distribute-lft-out--99.9%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
associate-*r*99.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -1850.0) (not (<= z 5.6e+15))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1850.0) || !(z <= 5.6e+15)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-1850.0d0)) .or. (.not. (z <= 5.6d+15))) then
tmp = (-6.0d0) * (x * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1850.0) || !(z <= 5.6e+15)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1850.0) or not (z <= 5.6e+15): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1850.0) || !(z <= 5.6e+15)) tmp = Float64(-6.0 * Float64(x * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1850.0) || ~((z <= 5.6e+15))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1850.0], N[Not[LessEqual[z, 5.6e+15]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1850 \lor \neg \left(z \leq 5.6 \cdot 10^{+15}\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1850 or 5.6e15 < z Initial program 99.8%
Taylor expanded in y around 0 96.4%
+-commutative96.4%
metadata-eval96.4%
cancel-sign-sub-inv96.4%
*-commutative96.4%
associate-*l*96.4%
*-commutative96.4%
associate-*l*96.4%
distribute-lft-out--99.8%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.5%
Taylor expanded in y around 0 53.8%
if -1850 < z < 5.6e15Initial program 99.9%
Taylor expanded in z around 0 73.4%
Final simplification64.3%
(FPCore (x y z) :precision binary64 (if (<= z -1850.0) (* -6.0 (* x z)) (if (<= z 2.05e-16) x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1850.0) {
tmp = -6.0 * (x * z);
} else if (z <= 2.05e-16) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1850.0d0)) then
tmp = (-6.0d0) * (x * z)
else if (z <= 2.05d-16) then
tmp = x
else
tmp = 6.0d0 * (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1850.0) {
tmp = -6.0 * (x * z);
} else if (z <= 2.05e-16) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1850.0: tmp = -6.0 * (x * z) elif z <= 2.05e-16: tmp = x else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1850.0) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= 2.05e-16) tmp = x; else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1850.0) tmp = -6.0 * (x * z); elseif (z <= 2.05e-16) tmp = x; else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1850.0], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.05e-16], x, N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1850:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{-16}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -1850Initial program 99.7%
Taylor expanded in y around 0 96.8%
+-commutative96.8%
metadata-eval96.8%
cancel-sign-sub-inv96.8%
*-commutative96.8%
associate-*l*96.8%
*-commutative96.8%
associate-*l*96.7%
distribute-lft-out--99.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.3%
Taylor expanded in y around 0 57.6%
if -1850 < z < 2.05000000000000003e-16Initial program 99.9%
Taylor expanded in z around 0 74.9%
if 2.05000000000000003e-16 < z Initial program 99.9%
Taylor expanded in y around 0 96.0%
+-commutative96.0%
metadata-eval96.0%
cancel-sign-sub-inv96.0%
*-commutative96.0%
associate-*l*96.2%
*-commutative96.2%
associate-*l*96.2%
distribute-lft-out--99.9%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in y around inf 62.1%
*-commutative62.1%
Simplified62.1%
Final simplification67.7%
(FPCore (x y z) :precision binary64 (if (<= z -1850.0) (* -6.0 (* x z)) (if (<= z 2.9e-11) x (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1850.0) {
tmp = -6.0 * (x * z);
} else if (z <= 2.9e-11) {
tmp = x;
} else {
tmp = y * (6.0 * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1850.0d0)) then
tmp = (-6.0d0) * (x * z)
else if (z <= 2.9d-11) then
tmp = x
else
tmp = y * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1850.0) {
tmp = -6.0 * (x * z);
} else if (z <= 2.9e-11) {
tmp = x;
} else {
tmp = y * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1850.0: tmp = -6.0 * (x * z) elif z <= 2.9e-11: tmp = x else: tmp = y * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1850.0) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= 2.9e-11) tmp = x; else tmp = Float64(y * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1850.0) tmp = -6.0 * (x * z); elseif (z <= 2.9e-11) tmp = x; else tmp = y * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1850.0], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e-11], x, N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1850:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-11}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -1850Initial program 99.7%
Taylor expanded in y around 0 96.8%
+-commutative96.8%
metadata-eval96.8%
cancel-sign-sub-inv96.8%
*-commutative96.8%
associate-*l*96.8%
*-commutative96.8%
associate-*l*96.7%
distribute-lft-out--99.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.3%
Taylor expanded in y around 0 57.6%
if -1850 < z < 2.9e-11Initial program 99.9%
Taylor expanded in z around 0 74.9%
if 2.9e-11 < z Initial program 99.9%
Taylor expanded in y around 0 96.0%
+-commutative96.0%
metadata-eval96.0%
cancel-sign-sub-inv96.0%
*-commutative96.0%
associate-*l*96.2%
*-commutative96.2%
associate-*l*96.2%
distribute-lft-out--99.9%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in y around inf 62.1%
*-commutative62.1%
*-commutative62.1%
*-commutative62.1%
associate-*r*62.3%
Simplified62.3%
Final simplification67.7%
(FPCore (x y z) :precision binary64 (if (<= z -1850.0) (* z (* x -6.0)) (if (<= z 1.55e-11) x (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1850.0) {
tmp = z * (x * -6.0);
} else if (z <= 1.55e-11) {
tmp = x;
} else {
tmp = y * (6.0 * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1850.0d0)) then
tmp = z * (x * (-6.0d0))
else if (z <= 1.55d-11) then
tmp = x
else
tmp = y * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1850.0) {
tmp = z * (x * -6.0);
} else if (z <= 1.55e-11) {
tmp = x;
} else {
tmp = y * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1850.0: tmp = z * (x * -6.0) elif z <= 1.55e-11: tmp = x else: tmp = y * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1850.0) tmp = Float64(z * Float64(x * -6.0)); elseif (z <= 1.55e-11) tmp = x; else tmp = Float64(y * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1850.0) tmp = z * (x * -6.0); elseif (z <= 1.55e-11) tmp = x; else tmp = y * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1850.0], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e-11], x, N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1850:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-11}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -1850Initial program 99.7%
Taylor expanded in y around 0 96.8%
+-commutative96.8%
metadata-eval96.8%
cancel-sign-sub-inv96.8%
*-commutative96.8%
associate-*l*96.8%
*-commutative96.8%
associate-*l*96.7%
distribute-lft-out--99.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.3%
associate-*r*99.3%
*-commutative99.3%
associate-*l*99.3%
Simplified99.3%
Taylor expanded in y around 0 57.6%
*-commutative57.6%
Simplified57.6%
if -1850 < z < 1.55000000000000014e-11Initial program 99.9%
Taylor expanded in z around 0 74.9%
if 1.55000000000000014e-11 < z Initial program 99.9%
Taylor expanded in y around 0 96.0%
+-commutative96.0%
metadata-eval96.0%
cancel-sign-sub-inv96.0%
*-commutative96.0%
associate-*l*96.2%
*-commutative96.2%
associate-*l*96.2%
distribute-lft-out--99.9%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in y around inf 62.1%
*-commutative62.1%
*-commutative62.1%
*-commutative62.1%
associate-*r*62.3%
Simplified62.3%
Final simplification67.7%
(FPCore (x y z) :precision binary64 (+ x (* 6.0 (* (- y x) z))))
double code(double x, double y, double z) {
return x + (6.0 * ((y - x) * z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (6.0d0 * ((y - x) * z))
end function
public static double code(double x, double y, double z) {
return x + (6.0 * ((y - x) * z));
}
def code(x, y, z): return x + (6.0 * ((y - x) * z))
function code(x, y, z) return Float64(x + Float64(6.0 * Float64(Float64(y - x) * z))) end
function tmp = code(x, y, z) tmp = x + (6.0 * ((y - x) * z)); end
code[x_, y_, z_] := N[(x + N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 6 \cdot \left(\left(y - x\right) \cdot z\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 98.3%
+-commutative98.3%
metadata-eval98.3%
cancel-sign-sub-inv98.3%
*-commutative98.3%
associate-*l*98.3%
*-commutative98.3%
associate-*l*98.3%
distribute-lft-out--99.9%
associate-*r*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
Taylor expanded in z around 0 41.1%
Final simplification41.1%
(FPCore (x y z) :precision binary64 (- x (* (* 6.0 z) (- x y))))
double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x - ((6.0d0 * z) * (x - y))
end function
public static double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
def code(x, y, z): return x - ((6.0 * z) * (x - y))
function code(x, y, z) return Float64(x - Float64(Float64(6.0 * z) * Float64(x - y))) end
function tmp = code(x, y, z) tmp = x - ((6.0 * z) * (x - y)); end
code[x_, y_, z_] := N[(x - N[(N[(6.0 * z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(6 \cdot z\right) \cdot \left(x - y\right)
\end{array}
herbie shell --seed 2023318
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:herbie-target
(- x (* (* 6.0 z) (- x y)))
(+ x (* (* (- y x) 6.0) z)))