
(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 (* x (+ 1.0 (* z -6.0)))))
(if (<= y -5.8e+151)
(* y (* 6.0 z))
(if (<= y -8.2e+99)
t_0
(if (<= y -2.46e+14)
(* 6.0 (* y z))
(if (<= y 8e+177) t_0 (* z (* y 6.0))))))))
double code(double x, double y, double z) {
double t_0 = x * (1.0 + (z * -6.0));
double tmp;
if (y <= -5.8e+151) {
tmp = y * (6.0 * z);
} else if (y <= -8.2e+99) {
tmp = t_0;
} else if (y <= -2.46e+14) {
tmp = 6.0 * (y * z);
} else if (y <= 8e+177) {
tmp = t_0;
} else {
tmp = z * (y * 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) :: t_0
real(8) :: tmp
t_0 = x * (1.0d0 + (z * (-6.0d0)))
if (y <= (-5.8d+151)) then
tmp = y * (6.0d0 * z)
else if (y <= (-8.2d+99)) then
tmp = t_0
else if (y <= (-2.46d+14)) then
tmp = 6.0d0 * (y * z)
else if (y <= 8d+177) then
tmp = t_0
else
tmp = z * (y * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (1.0 + (z * -6.0));
double tmp;
if (y <= -5.8e+151) {
tmp = y * (6.0 * z);
} else if (y <= -8.2e+99) {
tmp = t_0;
} else if (y <= -2.46e+14) {
tmp = 6.0 * (y * z);
} else if (y <= 8e+177) {
tmp = t_0;
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): t_0 = x * (1.0 + (z * -6.0)) tmp = 0 if y <= -5.8e+151: tmp = y * (6.0 * z) elif y <= -8.2e+99: tmp = t_0 elif y <= -2.46e+14: tmp = 6.0 * (y * z) elif y <= 8e+177: tmp = t_0 else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) t_0 = Float64(x * Float64(1.0 + Float64(z * -6.0))) tmp = 0.0 if (y <= -5.8e+151) tmp = Float64(y * Float64(6.0 * z)); elseif (y <= -8.2e+99) tmp = t_0; elseif (y <= -2.46e+14) tmp = Float64(6.0 * Float64(y * z)); elseif (y <= 8e+177) tmp = t_0; else tmp = Float64(z * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (1.0 + (z * -6.0)); tmp = 0.0; if (y <= -5.8e+151) tmp = y * (6.0 * z); elseif (y <= -8.2e+99) tmp = t_0; elseif (y <= -2.46e+14) tmp = 6.0 * (y * z); elseif (y <= 8e+177) tmp = t_0; else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.8e+151], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -8.2e+99], t$95$0, If[LessEqual[y, -2.46e+14], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e+177], t$95$0, N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{if}\;y \leq -5.8 \cdot 10^{+151}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;y \leq -8.2 \cdot 10^{+99}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -2.46 \cdot 10^{+14}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+177}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if y < -5.80000000000000036e151Initial program 99.7%
Taylor expanded in y around inf 96.6%
Taylor expanded in x around 0 85.8%
associate-*r*85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in z around 0 85.8%
associate-*r*85.7%
*-commutative85.7%
associate-*r*85.9%
Simplified85.9%
if -5.80000000000000036e151 < y < -8.19999999999999959e99 or -2.46e14 < y < 8.0000000000000001e177Initial program 99.9%
Taylor expanded in x around inf 80.1%
if -8.19999999999999959e99 < y < -2.46e14Initial program 99.8%
Taylor expanded in y around inf 88.1%
Taylor expanded in x around 0 71.7%
if 8.0000000000000001e177 < y Initial program 99.9%
Taylor expanded in y around inf 97.1%
Taylor expanded in x around 0 81.5%
associate-*r*81.7%
*-commutative81.7%
Simplified81.7%
Final simplification80.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))) (t_1 (* 6.0 (* y z))))
(if (<= z -4.8e+52)
t_0
(if (<= z -1.05e-37)
t_1
(if (<= z 9.5e-13) x (if (<= z 2.2e+147) t_1 t_0))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -4.8e+52) {
tmp = t_0;
} else if (z <= -1.05e-37) {
tmp = t_1;
} else if (z <= 9.5e-13) {
tmp = x;
} else if (z <= 2.2e+147) {
tmp = t_1;
} else {
tmp = t_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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (-6.0d0) * (x * z)
t_1 = 6.0d0 * (y * z)
if (z <= (-4.8d+52)) then
tmp = t_0
else if (z <= (-1.05d-37)) then
tmp = t_1
else if (z <= 9.5d-13) then
tmp = x
else if (z <= 2.2d+147) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double t_1 = 6.0 * (y * z);
double tmp;
if (z <= -4.8e+52) {
tmp = t_0;
} else if (z <= -1.05e-37) {
tmp = t_1;
} else if (z <= 9.5e-13) {
tmp = x;
} else if (z <= 2.2e+147) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) t_1 = 6.0 * (y * z) tmp = 0 if z <= -4.8e+52: tmp = t_0 elif z <= -1.05e-37: tmp = t_1 elif z <= 9.5e-13: tmp = x elif z <= 2.2e+147: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) t_1 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -4.8e+52) tmp = t_0; elseif (z <= -1.05e-37) tmp = t_1; elseif (z <= 9.5e-13) tmp = x; elseif (z <= 2.2e+147) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); t_1 = 6.0 * (y * z); tmp = 0.0; if (z <= -4.8e+52) tmp = t_0; elseif (z <= -1.05e-37) tmp = t_1; elseif (z <= 9.5e-13) tmp = x; elseif (z <= 2.2e+147) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.8e+52], t$95$0, If[LessEqual[z, -1.05e-37], t$95$1, If[LessEqual[z, 9.5e-13], x, If[LessEqual[z, 2.2e+147], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
t_1 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{+52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+147}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -4.8e52 or 2.2000000000000002e147 < z Initial program 99.9%
Taylor expanded in x around inf 64.2%
Taylor expanded in z around inf 64.2%
Taylor expanded in z around 0 64.2%
if -4.8e52 < z < -1.05e-37 or 9.49999999999999991e-13 < z < 2.2000000000000002e147Initial program 99.7%
Taylor expanded in y around inf 73.3%
Taylor expanded in x around 0 66.3%
if -1.05e-37 < z < 9.49999999999999991e-13Initial program 99.9%
Taylor expanded in z around 0 76.3%
Final simplification70.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))))
(if (<= z -3.3e+50)
t_0
(if (<= z -1.2e-37)
(* y (* 6.0 z))
(if (<= z 4.3e-13) x (if (<= z 1.55e+147) (* 6.0 (* y z)) t_0))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double tmp;
if (z <= -3.3e+50) {
tmp = t_0;
} else if (z <= -1.2e-37) {
tmp = y * (6.0 * z);
} else if (z <= 4.3e-13) {
tmp = x;
} else if (z <= 1.55e+147) {
tmp = 6.0 * (y * z);
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = (-6.0d0) * (x * z)
if (z <= (-3.3d+50)) then
tmp = t_0
else if (z <= (-1.2d-37)) then
tmp = y * (6.0d0 * z)
else if (z <= 4.3d-13) then
tmp = x
else if (z <= 1.55d+147) then
tmp = 6.0d0 * (y * z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double tmp;
if (z <= -3.3e+50) {
tmp = t_0;
} else if (z <= -1.2e-37) {
tmp = y * (6.0 * z);
} else if (z <= 4.3e-13) {
tmp = x;
} else if (z <= 1.55e+147) {
tmp = 6.0 * (y * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) tmp = 0 if z <= -3.3e+50: tmp = t_0 elif z <= -1.2e-37: tmp = y * (6.0 * z) elif z <= 4.3e-13: tmp = x elif z <= 1.55e+147: tmp = 6.0 * (y * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) tmp = 0.0 if (z <= -3.3e+50) tmp = t_0; elseif (z <= -1.2e-37) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 4.3e-13) tmp = x; elseif (z <= 1.55e+147) tmp = Float64(6.0 * Float64(y * z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); tmp = 0.0; if (z <= -3.3e+50) tmp = t_0; elseif (z <= -1.2e-37) tmp = y * (6.0 * z); elseif (z <= 4.3e-13) tmp = x; elseif (z <= 1.55e+147) tmp = 6.0 * (y * z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.3e+50], t$95$0, If[LessEqual[z, -1.2e-37], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.3e-13], x, If[LessEqual[z, 1.55e+147], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -3.3 \cdot 10^{+50}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-37}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{+147}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -3.3e50 or 1.55e147 < z Initial program 99.9%
Taylor expanded in x around inf 64.2%
Taylor expanded in z around inf 64.2%
Taylor expanded in z around 0 64.2%
if -3.3e50 < z < -1.19999999999999995e-37Initial program 99.7%
Taylor expanded in y around inf 75.7%
Taylor expanded in x around 0 58.2%
associate-*r*58.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in z around 0 58.2%
associate-*r*58.3%
*-commutative58.3%
associate-*r*58.3%
Simplified58.3%
if -1.19999999999999995e-37 < z < 4.2999999999999999e-13Initial program 99.9%
Taylor expanded in z around 0 76.3%
if 4.2999999999999999e-13 < z < 1.55e147Initial program 99.8%
Taylor expanded in y around inf 71.8%
Taylor expanded in x around 0 71.1%
Final simplification70.6%
(FPCore (x y z)
:precision binary64
(if (<= z -1.35e+51)
(* x (* z -6.0))
(if (<= z -1.2e-37)
(* y (* 6.0 z))
(if (<= z 4.3e-13)
x
(if (<= z 3e+154) (* 6.0 (* y z)) (* -6.0 (* x z)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.35e+51) {
tmp = x * (z * -6.0);
} else if (z <= -1.2e-37) {
tmp = y * (6.0 * z);
} else if (z <= 4.3e-13) {
tmp = x;
} else if (z <= 3e+154) {
tmp = 6.0 * (y * z);
} else {
tmp = -6.0 * (x * 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.35d+51)) then
tmp = x * (z * (-6.0d0))
else if (z <= (-1.2d-37)) then
tmp = y * (6.0d0 * z)
else if (z <= 4.3d-13) then
tmp = x
else if (z <= 3d+154) then
tmp = 6.0d0 * (y * z)
else
tmp = (-6.0d0) * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.35e+51) {
tmp = x * (z * -6.0);
} else if (z <= -1.2e-37) {
tmp = y * (6.0 * z);
} else if (z <= 4.3e-13) {
tmp = x;
} else if (z <= 3e+154) {
tmp = 6.0 * (y * z);
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.35e+51: tmp = x * (z * -6.0) elif z <= -1.2e-37: tmp = y * (6.0 * z) elif z <= 4.3e-13: tmp = x elif z <= 3e+154: tmp = 6.0 * (y * z) else: tmp = -6.0 * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.35e+51) tmp = Float64(x * Float64(z * -6.0)); elseif (z <= -1.2e-37) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 4.3e-13) tmp = x; elseif (z <= 3e+154) tmp = Float64(6.0 * Float64(y * z)); else tmp = Float64(-6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.35e+51) tmp = x * (z * -6.0); elseif (z <= -1.2e-37) tmp = y * (6.0 * z); elseif (z <= 4.3e-13) tmp = x; elseif (z <= 3e+154) tmp = 6.0 * (y * z); else tmp = -6.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.35e+51], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.2e-37], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.3e-13], x, If[LessEqual[z, 3e+154], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+51}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-37}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+154}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -1.34999999999999996e51Initial program 99.8%
Taylor expanded in x around inf 60.6%
Taylor expanded in z around inf 60.6%
if -1.34999999999999996e51 < z < -1.19999999999999995e-37Initial program 99.7%
Taylor expanded in y around inf 75.7%
Taylor expanded in x around 0 58.2%
associate-*r*58.3%
*-commutative58.3%
Simplified58.3%
Taylor expanded in z around 0 58.2%
associate-*r*58.3%
*-commutative58.3%
associate-*r*58.3%
Simplified58.3%
if -1.19999999999999995e-37 < z < 4.2999999999999999e-13Initial program 99.9%
Taylor expanded in z around 0 76.3%
if 4.2999999999999999e-13 < z < 3.00000000000000026e154Initial program 99.8%
Taylor expanded in y around inf 71.8%
Taylor expanded in x around 0 71.1%
if 3.00000000000000026e154 < z Initial program 99.9%
Taylor expanded in x around inf 70.9%
Taylor expanded in z around inf 70.9%
Taylor expanded in z around 0 70.9%
Final simplification70.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.45e-30) (not (<= y 3.45e-59))) (+ x (* 6.0 (* y z))) (* x (+ 1.0 (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.45e-30) || !(y <= 3.45e-59)) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x * (1.0 + (z * -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 ((y <= (-1.45d-30)) .or. (.not. (y <= 3.45d-59))) then
tmp = x + (6.0d0 * (y * z))
else
tmp = x * (1.0d0 + (z * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.45e-30) || !(y <= 3.45e-59)) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x * (1.0 + (z * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.45e-30) or not (y <= 3.45e-59): tmp = x + (6.0 * (y * z)) else: tmp = x * (1.0 + (z * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.45e-30) || !(y <= 3.45e-59)) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.45e-30) || ~((y <= 3.45e-59))) tmp = x + (6.0 * (y * z)); else tmp = x * (1.0 + (z * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.45e-30], N[Not[LessEqual[y, 3.45e-59]], $MachinePrecision]], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.45 \cdot 10^{-30} \lor \neg \left(y \leq 3.45 \cdot 10^{-59}\right):\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\end{array}
\end{array}
if y < -1.44999999999999995e-30 or 3.44999999999999991e-59 < y Initial program 99.8%
Taylor expanded in y around inf 90.7%
if -1.44999999999999995e-30 < y < 3.44999999999999991e-59Initial program 99.9%
Taylor expanded in x around inf 90.0%
Final simplification90.4%
(FPCore (x y z) :precision binary64 (if (<= y -1.4e-30) (+ x (* 6.0 (* y z))) (if (<= y 1.15e-59) (* x (+ 1.0 (* z -6.0))) (+ x (* z (* y 6.0))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e-30) {
tmp = x + (6.0 * (y * z));
} else if (y <= 1.15e-59) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = x + (z * (y * 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 (y <= (-1.4d-30)) then
tmp = x + (6.0d0 * (y * z))
else if (y <= 1.15d-59) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
else
tmp = x + (z * (y * 6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.4e-30) {
tmp = x + (6.0 * (y * z));
} else if (y <= 1.15e-59) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = x + (z * (y * 6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.4e-30: tmp = x + (6.0 * (y * z)) elif y <= 1.15e-59: tmp = x * (1.0 + (z * -6.0)) else: tmp = x + (z * (y * 6.0)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.4e-30) tmp = Float64(x + Float64(6.0 * Float64(y * z))); elseif (y <= 1.15e-59) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); else tmp = Float64(x + Float64(z * Float64(y * 6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.4e-30) tmp = x + (6.0 * (y * z)); elseif (y <= 1.15e-59) tmp = x * (1.0 + (z * -6.0)); else tmp = x + (z * (y * 6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.4e-30], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.15e-59], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.4 \cdot 10^{-30}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;y \leq 1.15 \cdot 10^{-59}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if y < -1.39999999999999994e-30Initial program 99.8%
Taylor expanded in y around inf 87.4%
if -1.39999999999999994e-30 < y < 1.1499999999999999e-59Initial program 99.9%
Taylor expanded in x around inf 90.0%
if 1.1499999999999999e-59 < y Initial program 99.9%
Taylor expanded in y around inf 94.2%
associate-*r*94.2%
Simplified94.2%
Final simplification90.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -9.5e-10) (not (<= z 0.165))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -9.5e-10) || !(z <= 0.165)) {
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 <= (-9.5d-10)) .or. (.not. (z <= 0.165d0))) 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 <= -9.5e-10) || !(z <= 0.165)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -9.5e-10) or not (z <= 0.165): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -9.5e-10) || !(z <= 0.165)) 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 <= -9.5e-10) || ~((z <= 0.165))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -9.5e-10], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-10} \lor \neg \left(z \leq 0.165\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.50000000000000028e-10 or 0.165000000000000008 < z Initial program 99.8%
Taylor expanded in x around inf 51.8%
Taylor expanded in z around inf 51.0%
Taylor expanded in z around 0 51.0%
if -9.50000000000000028e-10 < z < 0.165000000000000008Initial program 99.9%
Taylor expanded in z around 0 73.3%
Final simplification62.9%
(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.6%
Final simplification40.6%
(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 2023240
(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)))