
(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 9 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 (* (* (- 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}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))))
(if (<= z -2.1e+157)
t_0
(if (<= z -4.2e+73)
(* -6.0 (* x z))
(if (or (<= z -8.2e-20) (not (<= z 1.5e-52))) t_0 x)))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -2.1e+157) {
tmp = t_0;
} else if (z <= -4.2e+73) {
tmp = -6.0 * (x * z);
} else if ((z <= -8.2e-20) || !(z <= 1.5e-52)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
if (z <= (-2.1d+157)) then
tmp = t_0
else if (z <= (-4.2d+73)) then
tmp = (-6.0d0) * (x * z)
else if ((z <= (-8.2d-20)) .or. (.not. (z <= 1.5d-52))) then
tmp = t_0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -2.1e+157) {
tmp = t_0;
} else if (z <= -4.2e+73) {
tmp = -6.0 * (x * z);
} else if ((z <= -8.2e-20) || !(z <= 1.5e-52)) {
tmp = t_0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -2.1e+157: tmp = t_0 elif z <= -4.2e+73: tmp = -6.0 * (x * z) elif (z <= -8.2e-20) or not (z <= 1.5e-52): tmp = t_0 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -2.1e+157) tmp = t_0; elseif (z <= -4.2e+73) tmp = Float64(-6.0 * Float64(x * z)); elseif ((z <= -8.2e-20) || !(z <= 1.5e-52)) tmp = t_0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -2.1e+157) tmp = t_0; elseif (z <= -4.2e+73) tmp = -6.0 * (x * z); elseif ((z <= -8.2e-20) || ~((z <= 1.5e-52))) tmp = t_0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e+157], t$95$0, If[LessEqual[z, -4.2e+73], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -8.2e-20], N[Not[LessEqual[z, 1.5e-52]], $MachinePrecision]], t$95$0, x]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{+157}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{+73}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -8.2 \cdot 10^{-20} \lor \neg \left(z \leq 1.5 \cdot 10^{-52}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.1e157 or -4.2000000000000003e73 < z < -8.2000000000000002e-20 or 1.5e-52 < z Initial program 99.8%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 60.0%
*-commutative60.0%
Simplified60.0%
if -2.1e157 < z < -4.2000000000000003e73Initial program 99.9%
Taylor expanded in y around 0 79.5%
Taylor expanded in z around inf 79.5%
if -8.2000000000000002e-20 < z < 1.5e-52Initial program 99.9%
Taylor expanded in z around 0 77.0%
Final simplification69.4%
(FPCore (x y z)
:precision binary64
(if (<= z -5.1e+154)
(* 6.0 (* y z))
(if (<= z -4.5e+73)
(* -6.0 (* x z))
(if (or (<= z -3.15e-18) (not (<= z 6.8e-53))) (* z (* y 6.0)) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.1e+154) {
tmp = 6.0 * (y * z);
} else if (z <= -4.5e+73) {
tmp = -6.0 * (x * z);
} else if ((z <= -3.15e-18) || !(z <= 6.8e-53)) {
tmp = z * (y * 6.0);
} 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 <= (-5.1d+154)) then
tmp = 6.0d0 * (y * z)
else if (z <= (-4.5d+73)) then
tmp = (-6.0d0) * (x * z)
else if ((z <= (-3.15d-18)) .or. (.not. (z <= 6.8d-53))) then
tmp = z * (y * 6.0d0)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5.1e+154) {
tmp = 6.0 * (y * z);
} else if (z <= -4.5e+73) {
tmp = -6.0 * (x * z);
} else if ((z <= -3.15e-18) || !(z <= 6.8e-53)) {
tmp = z * (y * 6.0);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.1e+154: tmp = 6.0 * (y * z) elif z <= -4.5e+73: tmp = -6.0 * (x * z) elif (z <= -3.15e-18) or not (z <= 6.8e-53): tmp = z * (y * 6.0) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.1e+154) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= -4.5e+73) tmp = Float64(-6.0 * Float64(x * z)); elseif ((z <= -3.15e-18) || !(z <= 6.8e-53)) tmp = Float64(z * Float64(y * 6.0)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.1e+154) tmp = 6.0 * (y * z); elseif (z <= -4.5e+73) tmp = -6.0 * (x * z); elseif ((z <= -3.15e-18) || ~((z <= 6.8e-53))) tmp = z * (y * 6.0); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.1e+154], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.5e+73], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -3.15e-18], N[Not[LessEqual[z, 6.8e-53]], $MachinePrecision]], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.1 \cdot 10^{+154}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{+73}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -3.15 \cdot 10^{-18} \lor \neg \left(z \leq 6.8 \cdot 10^{-53}\right):\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.0999999999999999e154Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.9%
fma-define99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 63.9%
*-commutative63.9%
Simplified63.9%
if -5.0999999999999999e154 < z < -4.49999999999999985e73Initial program 99.9%
Taylor expanded in y around 0 79.5%
Taylor expanded in z around inf 79.5%
if -4.49999999999999985e73 < z < -3.1500000000000002e-18 or 6.8e-53 < z Initial program 99.8%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 58.8%
associate-*r*58.9%
*-commutative58.9%
Simplified58.9%
if -3.1500000000000002e-18 < z < 6.8e-53Initial program 99.9%
Taylor expanded in z around 0 77.0%
Final simplification69.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.48e-24) (not (<= z 8.5e-52))) (* 6.0 (* (- y x) z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.48e-24) || !(z <= 8.5e-52)) {
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 <= (-1.48d-24)) .or. (.not. (z <= 8.5d-52))) 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 <= -1.48e-24) || !(z <= 8.5e-52)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.48e-24) or not (z <= 8.5e-52): tmp = 6.0 * ((y - x) * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.48e-24) || !(z <= 8.5e-52)) 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 <= -1.48e-24) || ~((z <= 8.5e-52))) tmp = 6.0 * ((y - x) * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.48e-24], N[Not[LessEqual[z, 8.5e-52]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.48 \cdot 10^{-24} \lor \neg \left(z \leq 8.5 \cdot 10^{-52}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.48000000000000003e-24 or 8.50000000000000006e-52 < z Initial program 99.8%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 94.8%
if -1.48000000000000003e-24 < z < 8.50000000000000006e-52Initial program 99.9%
Taylor expanded in z around 0 77.0%
Final simplification86.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -50000.0) (not (<= z 7.5e-52))) (* 6.0 (* (- y x) z)) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -50000.0) || !(z <= 7.5e-52)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x * ((z * -6.0) + 1.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 <= (-50000.0d0)) .or. (.not. (z <= 7.5d-52))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x * ((z * (-6.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -50000.0) || !(z <= 7.5e-52)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -50000.0) or not (z <= 7.5e-52): tmp = 6.0 * ((y - x) * z) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -50000.0) || !(z <= 7.5e-52)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -50000.0) || ~((z <= 7.5e-52))) tmp = 6.0 * ((y - x) * z); else tmp = x * ((z * -6.0) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -50000.0], N[Not[LessEqual[z, 7.5e-52]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -50000 \lor \neg \left(z \leq 7.5 \cdot 10^{-52}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if z < -5e4 or 7.50000000000000006e-52 < z Initial program 99.8%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 97.5%
if -5e4 < z < 7.50000000000000006e-52Initial program 99.9%
Taylor expanded in x around inf 76.8%
+-commutative76.8%
Simplified76.8%
Final simplification86.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 6.8e-19))) (* 6.0 (* (- y x) z)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 6.8e-19)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (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 <= (-0.165d0)) .or. (.not. (z <= 6.8d-19))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x + (6.0d0 * (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 6.8e-19)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) or not (z <= 6.8e-19): tmp = 6.0 * ((y - x) * z) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 6.8e-19)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = Float64(x + Float64(6.0 * Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.165) || ~((z <= 6.8e-19))) tmp = 6.0 * ((y - x) * z); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.165], N[Not[LessEqual[z, 6.8e-19]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 6.8 \cdot 10^{-19}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 6.8000000000000004e-19 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 97.5%
if -0.165000000000000008 < z < 6.8000000000000004e-19Initial program 99.9%
Taylor expanded in y around inf 99.1%
*-commutative99.1%
Simplified99.1%
Final simplification98.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 6.8e-19))) (* 6.0 (* (- y x) z)) (+ x (* y (* 6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 6.8e-19)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (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 <= (-0.165d0)) .or. (.not. (z <= 6.8d-19))) then
tmp = 6.0d0 * ((y - x) * z)
else
tmp = x + (y * (6.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 6.8e-19)) {
tmp = 6.0 * ((y - x) * z);
} else {
tmp = x + (y * (6.0 * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) or not (z <= 6.8e-19): tmp = 6.0 * ((y - x) * z) else: tmp = x + (y * (6.0 * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 6.8e-19)) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); else tmp = Float64(x + Float64(y * Float64(6.0 * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.165) || ~((z <= 6.8e-19))) tmp = 6.0 * ((y - x) * z); else tmp = x + (y * (6.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.165], N[Not[LessEqual[z, 6.8e-19]], $MachinePrecision]], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 6.8 \cdot 10^{-19}\right):\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 6.8000000000000004e-19 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 97.5%
if -0.165000000000000008 < z < 6.8000000000000004e-19Initial program 99.9%
Taylor expanded in y around inf 99.1%
*-commutative99.1%
associate-*r*99.2%
Simplified99.2%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 6.8e-19))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 6.8e-19)) {
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 <= (-0.165d0)) .or. (.not. (z <= 6.8d-19))) 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 <= -0.165) || !(z <= 6.8e-19)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) or not (z <= 6.8e-19): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 6.8e-19)) 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 <= -0.165) || ~((z <= 6.8e-19))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.165], N[Not[LessEqual[z, 6.8e-19]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 6.8 \cdot 10^{-19}\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 6.8000000000000004e-19 < z Initial program 99.8%
Taylor expanded in y around 0 49.4%
Taylor expanded in z around inf 47.2%
if -0.165000000000000008 < z < 6.8000000000000004e-19Initial program 99.9%
Taylor expanded in z around 0 73.7%
Final simplification61.2%
(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.8%
Taylor expanded in z around 0 40.5%
Final simplification40.5%
(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 2024066
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(- x (* (* 6.0 z) (- x y)))
(+ x (* (* (- y x) 6.0) z)))