
(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 11 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(y - x) * Float64(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[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(6 \cdot z\right)
\end{array}
Initial program 99.1%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.8%
Simplified99.8%
(FPCore (x y z)
:precision binary64
(if (<= z -6.4e+16)
(* z (* x -6.0))
(if (<= z -3.4e-54)
(* y (* 6.0 z))
(if (<= z 1.35e-27) x (* z (* y 6.0))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e+16) {
tmp = z * (x * -6.0);
} else if (z <= -3.4e-54) {
tmp = y * (6.0 * z);
} else if (z <= 1.35e-27) {
tmp = x;
} 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) :: tmp
if (z <= (-6.4d+16)) then
tmp = z * (x * (-6.0d0))
else if (z <= (-3.4d-54)) then
tmp = y * (6.0d0 * z)
else if (z <= 1.35d-27) then
tmp = x
else
tmp = z * (y * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6.4e+16) {
tmp = z * (x * -6.0);
} else if (z <= -3.4e-54) {
tmp = y * (6.0 * z);
} else if (z <= 1.35e-27) {
tmp = x;
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.4e+16: tmp = z * (x * -6.0) elif z <= -3.4e-54: tmp = y * (6.0 * z) elif z <= 1.35e-27: tmp = x else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.4e+16) tmp = Float64(z * Float64(x * -6.0)); elseif (z <= -3.4e-54) tmp = Float64(y * Float64(6.0 * z)); elseif (z <= 1.35e-27) tmp = x; else tmp = Float64(z * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6.4e+16) tmp = z * (x * -6.0); elseif (z <= -3.4e-54) tmp = y * (6.0 * z); elseif (z <= 1.35e-27) tmp = x; else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.4e+16], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.4e-54], N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.35e-27], x, N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+16}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{-54}:\\
\;\;\;\;y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-27}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if z < -6.4e16Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.7%
Simplified99.7%
Taylor expanded in y around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6456.2%
Simplified56.2%
if -6.4e16 < z < -3.39999999999999987e-54Initial program 99.5%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6468.8%
Simplified68.8%
Taylor expanded in y around inf
Simplified59.8%
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
div-invN/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f6459.6%
Applied egg-rr59.6%
div-invN/A
metadata-evalN/A
*-lowering-*.f6460.1%
Applied egg-rr60.1%
if -3.39999999999999987e-54 < z < 1.34999999999999994e-27Initial program 98.4%
Taylor expanded in z around 0
Simplified71.4%
if 1.34999999999999994e-27 < z Initial program 99.8%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6457.2%
Simplified57.2%
Final simplification64.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (* y 6.0))))
(if (<= z -6.8e+17)
(* z (* x -6.0))
(if (<= z -2.3e-54) t_0 (if (<= z 2.2e-27) x t_0)))))
double code(double x, double y, double z) {
double t_0 = z * (y * 6.0);
double tmp;
if (z <= -6.8e+17) {
tmp = z * (x * -6.0);
} else if (z <= -2.3e-54) {
tmp = t_0;
} else if (z <= 2.2e-27) {
tmp = x;
} 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 = z * (y * 6.0d0)
if (z <= (-6.8d+17)) then
tmp = z * (x * (-6.0d0))
else if (z <= (-2.3d-54)) then
tmp = t_0
else if (z <= 2.2d-27) then
tmp = x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (y * 6.0);
double tmp;
if (z <= -6.8e+17) {
tmp = z * (x * -6.0);
} else if (z <= -2.3e-54) {
tmp = t_0;
} else if (z <= 2.2e-27) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (y * 6.0) tmp = 0 if z <= -6.8e+17: tmp = z * (x * -6.0) elif z <= -2.3e-54: tmp = t_0 elif z <= 2.2e-27: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(y * 6.0)) tmp = 0.0 if (z <= -6.8e+17) tmp = Float64(z * Float64(x * -6.0)); elseif (z <= -2.3e-54) tmp = t_0; elseif (z <= 2.2e-27) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (y * 6.0); tmp = 0.0; if (z <= -6.8e+17) tmp = z * (x * -6.0); elseif (z <= -2.3e-54) tmp = t_0; elseif (z <= 2.2e-27) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.8e+17], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.3e-54], t$95$0, If[LessEqual[z, 2.2e-27], x, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(y \cdot 6\right)\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{+17}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{elif}\;z \leq -2.3 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-27}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.8e17Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6499.7%
Simplified99.7%
Taylor expanded in y around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6456.2%
Simplified56.2%
if -6.8e17 < z < -2.2999999999999999e-54 or 2.19999999999999987e-27 < z Initial program 99.7%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6457.8%
Simplified57.8%
if -2.2999999999999999e-54 < z < 2.19999999999999987e-27Initial program 98.4%
Taylor expanded in z around 0
Simplified71.4%
Final simplification64.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* (- y x) z)))) (if (<= z -310000.0) t_0 (if (<= z 6.8) (+ x (* y (* 6.0 z))) t_0))))
double code(double x, double y, double z) {
double t_0 = 6.0 * ((y - x) * z);
double tmp;
if (z <= -310000.0) {
tmp = t_0;
} else if (z <= 6.8) {
tmp = x + (y * (6.0 * 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 * ((y - x) * z)
if (z <= (-310000.0d0)) then
tmp = t_0
else if (z <= 6.8d0) then
tmp = x + (y * (6.0d0 * 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 * ((y - x) * z);
double tmp;
if (z <= -310000.0) {
tmp = t_0;
} else if (z <= 6.8) {
tmp = x + (y * (6.0 * z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * ((y - x) * z) tmp = 0 if z <= -310000.0: tmp = t_0 elif z <= 6.8: tmp = x + (y * (6.0 * z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(Float64(y - x) * z)) tmp = 0.0 if (z <= -310000.0) tmp = t_0; elseif (z <= 6.8) tmp = Float64(x + Float64(y * Float64(6.0 * z))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * ((y - x) * z); tmp = 0.0; if (z <= -310000.0) tmp = t_0; elseif (z <= 6.8) tmp = x + (y * (6.0 * z)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -310000.0], t$95$0, If[LessEqual[z, 6.8], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -310000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 6.8:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.1e5 or 6.79999999999999982 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.8%
Simplified98.8%
if -3.1e5 < z < 6.79999999999999982Initial program 98.6%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.9%
Simplified99.9%
Taylor expanded in y around inf
Simplified98.6%
Final simplification98.7%
(FPCore (x y z)
:precision binary64
(if (<= z -3.2e-54)
(* 6.0 (* (- y x) z))
(if (<= z 0.00056)
(* x (+ 1.0 (* z -6.0)))
(* (- y x) (/ z 0.16666666666666666)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.2e-54) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 0.00056) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = (y - x) * (z / 0.16666666666666666);
}
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-54)) then
tmp = 6.0d0 * ((y - x) * z)
else if (z <= 0.00056d0) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
else
tmp = (y - x) * (z / 0.16666666666666666d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3.2e-54) {
tmp = 6.0 * ((y - x) * z);
} else if (z <= 0.00056) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = (y - x) * (z / 0.16666666666666666);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.2e-54: tmp = 6.0 * ((y - x) * z) elif z <= 0.00056: tmp = x * (1.0 + (z * -6.0)) else: tmp = (y - x) * (z / 0.16666666666666666) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.2e-54) tmp = Float64(6.0 * Float64(Float64(y - x) * z)); elseif (z <= 0.00056) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); else tmp = Float64(Float64(y - x) * Float64(z / 0.16666666666666666)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.2e-54) tmp = 6.0 * ((y - x) * z); elseif (z <= 0.00056) tmp = x * (1.0 + (z * -6.0)); else tmp = (y - x) * (z / 0.16666666666666666); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.2e-54], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.00056], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - x), $MachinePrecision] * N[(z / 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-54}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 0.00056:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{0.16666666666666666}\\
\end{array}
\end{array}
if z < -3.19999999999999998e-54Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.3%
Simplified92.3%
if -3.19999999999999998e-54 < z < 5.5999999999999995e-4Initial program 98.5%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6470.8%
Simplified70.8%
if 5.5999999999999995e-4 < z Initial program 99.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.9%
Simplified98.9%
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
associate-/r/N/A
clear-numN/A
associate-*l/N/A
div-invN/A
times-fracN/A
remove-double-divN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
metadata-eval98.9%
Applied egg-rr98.9%
Final simplification82.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* (- y x) z)))) (if (<= z -3e-54) t_0 (if (<= z 0.00056) (* x (+ 1.0 (* z -6.0))) t_0))))
double code(double x, double y, double z) {
double t_0 = 6.0 * ((y - x) * z);
double tmp;
if (z <= -3e-54) {
tmp = t_0;
} else if (z <= 0.00056) {
tmp = x * (1.0 + (z * -6.0));
} 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 * ((y - x) * z)
if (z <= (-3d-54)) then
tmp = t_0
else if (z <= 0.00056d0) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
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 * ((y - x) * z);
double tmp;
if (z <= -3e-54) {
tmp = t_0;
} else if (z <= 0.00056) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * ((y - x) * z) tmp = 0 if z <= -3e-54: tmp = t_0 elif z <= 0.00056: tmp = x * (1.0 + (z * -6.0)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(Float64(y - x) * z)) tmp = 0.0 if (z <= -3e-54) tmp = t_0; elseif (z <= 0.00056) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * ((y - x) * z); tmp = 0.0; if (z <= -3e-54) tmp = t_0; elseif (z <= 0.00056) tmp = x * (1.0 + (z * -6.0)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3e-54], t$95$0, If[LessEqual[z, 0.00056], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -3 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.00056:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.00000000000000009e-54 or 5.5999999999999995e-4 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6494.9%
Simplified94.9%
if -3.00000000000000009e-54 < z < 5.5999999999999995e-4Initial program 98.5%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6470.8%
Simplified70.8%
Final simplification82.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* (- y x) z)))) (if (<= z -2.8e-54) t_0 (if (<= z 8.5e-28) x t_0))))
double code(double x, double y, double z) {
double t_0 = 6.0 * ((y - x) * z);
double tmp;
if (z <= -2.8e-54) {
tmp = t_0;
} else if (z <= 8.5e-28) {
tmp = x;
} 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 * ((y - x) * z)
if (z <= (-2.8d-54)) then
tmp = t_0
else if (z <= 8.5d-28) then
tmp = x
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 * ((y - x) * z);
double tmp;
if (z <= -2.8e-54) {
tmp = t_0;
} else if (z <= 8.5e-28) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * ((y - x) * z) tmp = 0 if z <= -2.8e-54: tmp = t_0 elif z <= 8.5e-28: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(Float64(y - x) * z)) tmp = 0.0 if (z <= -2.8e-54) tmp = t_0; elseif (z <= 8.5e-28) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * ((y - x) * z); tmp = 0.0; if (z <= -2.8e-54) tmp = t_0; elseif (z <= 8.5e-28) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.8e-54], t$95$0, If[LessEqual[z, 8.5e-28], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-28}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.8000000000000002e-54 or 8.49999999999999925e-28 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.6%
Simplified93.6%
if -2.8000000000000002e-54 < z < 8.49999999999999925e-28Initial program 98.4%
Taylor expanded in z around 0
Simplified71.4%
Final simplification82.7%
(FPCore (x y z) :precision binary64 (if (<= z -3.4e-54) (* 6.0 (* y z)) (if (<= z 2.9e-28) x (* z (* y 6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.4e-54) {
tmp = 6.0 * (y * z);
} else if (z <= 2.9e-28) {
tmp = x;
} 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) :: tmp
if (z <= (-3.4d-54)) then
tmp = 6.0d0 * (y * z)
else if (z <= 2.9d-28) then
tmp = x
else
tmp = z * (y * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3.4e-54) {
tmp = 6.0 * (y * z);
} else if (z <= 2.9e-28) {
tmp = x;
} else {
tmp = z * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.4e-54: tmp = 6.0 * (y * z) elif z <= 2.9e-28: tmp = x else: tmp = z * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.4e-54) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 2.9e-28) tmp = x; else tmp = Float64(z * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.4e-54) tmp = 6.0 * (y * z); elseif (z <= 2.9e-28) tmp = x; else tmp = z * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.4e-54], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e-28], x, N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.4 \cdot 10^{-54}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-28}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if z < -3.39999999999999987e-54Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6492.3%
Simplified92.3%
Taylor expanded in y around inf
Simplified51.1%
if -3.39999999999999987e-54 < z < 2.90000000000000013e-28Initial program 98.4%
Taylor expanded in z around 0
Simplified71.4%
if 2.90000000000000013e-28 < z Initial program 99.8%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6457.2%
Simplified57.2%
Final simplification62.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* y z)))) (if (<= z -3e-54) t_0 (if (<= z 3e-28) x t_0))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -3e-54) {
tmp = t_0;
} else if (z <= 3e-28) {
tmp = x;
} 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 * (y * z)
if (z <= (-3d-54)) then
tmp = t_0
else if (z <= 3d-28) then
tmp = x
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 * (y * z);
double tmp;
if (z <= -3e-54) {
tmp = t_0;
} else if (z <= 3e-28) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -3e-54: tmp = t_0 elif z <= 3e-28: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) tmp = 0.0 if (z <= -3e-54) tmp = t_0; elseif (z <= 3e-28) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); tmp = 0.0; if (z <= -3e-54) tmp = t_0; elseif (z <= 3e-28) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3e-54], t$95$0, If[LessEqual[z, 3e-28], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -3 \cdot 10^{-54}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-28}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.00000000000000009e-54 or 3.00000000000000003e-28 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6493.6%
Simplified93.6%
Taylor expanded in y around inf
Simplified53.6%
if -3.00000000000000009e-54 < z < 3.00000000000000003e-28Initial program 98.4%
Taylor expanded in z around 0
Simplified71.4%
Final simplification62.4%
(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.1%
Final simplification99.1%
(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.1%
Taylor expanded in z around 0
Simplified38.7%
(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 2024152
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(! :herbie-platform default (- x (* (* 6 z) (- x y))))
(+ x (* (* (- y x) 6.0) z)))