
(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 (fma (* (- y x) z) 6.0 x))
double code(double x, double y, double z) {
return fma(((y - x) * z), 6.0, x);
}
function code(x, y, z) return fma(Float64(Float64(y - x) * z), 6.0, x) end
code[x_, y_, z_] := N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0 + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)
\end{array}
Initial program 99.8%
associate-*r*N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
fma-defineN/A
fma-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6499.9%
Applied egg-rr99.9%
(FPCore (x y z) :precision binary64 (if (<= z -110.0) (* z (* (- y x) 6.0)) (if (<= z 2.7e-5) (+ x (* y (* z 6.0))) (* 6.0 (* (- y x) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -110.0) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 2.7e-5) {
tmp = x + (y * (z * 6.0));
} else {
tmp = 6.0 * ((y - 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 <= (-110.0d0)) then
tmp = z * ((y - x) * 6.0d0)
else if (z <= 2.7d-5) then
tmp = x + (y * (z * 6.0d0))
else
tmp = 6.0d0 * ((y - x) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -110.0) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 2.7e-5) {
tmp = x + (y * (z * 6.0));
} else {
tmp = 6.0 * ((y - x) * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -110.0: tmp = z * ((y - x) * 6.0) elif z <= 2.7e-5: tmp = x + (y * (z * 6.0)) else: tmp = 6.0 * ((y - x) * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -110.0) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); elseif (z <= 2.7e-5) tmp = Float64(x + Float64(y * Float64(z * 6.0))); else tmp = Float64(6.0 * Float64(Float64(y - x) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -110.0) tmp = z * ((y - x) * 6.0); elseif (z <= 2.7e-5) tmp = x + (y * (z * 6.0)); else tmp = 6.0 * ((y - x) * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -110.0], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e-5], N[(x + N[(y * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -110:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-5}:\\
\;\;\;\;x + y \cdot \left(z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\end{array}
\end{array}
if z < -110Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.9%
Simplified98.9%
*-commutativeN/A
associate-*r*N/A
distribute-rgt-out--N/A
*-lowering-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6498.9%
Applied egg-rr98.9%
if -110 < z < 2.6999999999999999e-5Initial program 99.9%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.9%
Simplified99.9%
Taylor expanded in y around inf
Simplified99.8%
if 2.6999999999999999e-5 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.8%
Simplified98.8%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (<= z -3.1e-23) (* z (* (- y x) 6.0)) (if (<= z 7.2e-6) (* x (+ 1.0 (* z -6.0))) (* 6.0 (* (- y x) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.1e-23) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 7.2e-6) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = 6.0 * ((y - 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 <= (-3.1d-23)) then
tmp = z * ((y - x) * 6.0d0)
else if (z <= 7.2d-6) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
else
tmp = 6.0d0 * ((y - x) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -3.1e-23) {
tmp = z * ((y - x) * 6.0);
} else if (z <= 7.2e-6) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = 6.0 * ((y - x) * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.1e-23: tmp = z * ((y - x) * 6.0) elif z <= 7.2e-6: tmp = x * (1.0 + (z * -6.0)) else: tmp = 6.0 * ((y - x) * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.1e-23) tmp = Float64(z * Float64(Float64(y - x) * 6.0)); elseif (z <= 7.2e-6) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); else tmp = Float64(6.0 * Float64(Float64(y - x) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.1e-23) tmp = z * ((y - x) * 6.0); elseif (z <= 7.2e-6) tmp = x * (1.0 + (z * -6.0)); else tmp = 6.0 * ((y - x) * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.1e-23], N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.2e-6], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{-23}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot 6\right)\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-6}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\end{array}
\end{array}
if z < -3.0999999999999999e-23Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6497.6%
Simplified97.6%
*-commutativeN/A
associate-*r*N/A
distribute-rgt-out--N/A
*-lowering-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f6497.7%
Applied egg-rr97.7%
if -3.0999999999999999e-23 < z < 7.19999999999999967e-6Initial program 99.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6479.0%
Simplified79.0%
if 7.19999999999999967e-6 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.8%
Simplified98.8%
Final simplification88.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* (- y x) z)))) (if (<= z -6.2e-21) t_0 (if (<= z 2.1e-5) (* 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 <= -6.2e-21) {
tmp = t_0;
} else if (z <= 2.1e-5) {
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 <= (-6.2d-21)) then
tmp = t_0
else if (z <= 2.1d-5) 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 <= -6.2e-21) {
tmp = t_0;
} else if (z <= 2.1e-5) {
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 <= -6.2e-21: tmp = t_0 elif z <= 2.1e-5: 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 <= -6.2e-21) tmp = t_0; elseif (z <= 2.1e-5) 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 <= -6.2e-21) tmp = t_0; elseif (z <= 2.1e-5) 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, -6.2e-21], t$95$0, If[LessEqual[z, 2.1e-5], 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 -6.2 \cdot 10^{-21}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-5}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.1999999999999997e-21 or 2.09999999999999988e-5 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.1%
Simplified98.1%
if -6.1999999999999997e-21 < z < 2.09999999999999988e-5Initial program 99.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6479.0%
Simplified79.0%
Final simplification88.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* (- y x) z)))) (if (<= z -1.05e-22) t_0 (if (<= z 1.15e-8) x t_0))))
double code(double x, double y, double z) {
double t_0 = 6.0 * ((y - x) * z);
double tmp;
if (z <= -1.05e-22) {
tmp = t_0;
} else if (z <= 1.15e-8) {
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 <= (-1.05d-22)) then
tmp = t_0
else if (z <= 1.15d-8) 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 <= -1.05e-22) {
tmp = t_0;
} else if (z <= 1.15e-8) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * ((y - x) * z) tmp = 0 if z <= -1.05e-22: tmp = t_0 elif z <= 1.15e-8: 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 <= -1.05e-22) tmp = t_0; elseif (z <= 1.15e-8) 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 <= -1.05e-22) tmp = t_0; elseif (z <= 1.15e-8) 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, -1.05e-22], t$95$0, If[LessEqual[z, 1.15e-8], 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 -1.05 \cdot 10^{-22}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-8}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.05000000000000004e-22 or 1.15e-8 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.1%
Simplified98.1%
if -1.05000000000000004e-22 < z < 1.15e-8Initial program 99.9%
Taylor expanded in z around 0
Simplified78.9%
Final simplification88.2%
(FPCore (x y z) :precision binary64 (if (<= z -3.1e-23) (* z (* y 6.0)) (if (<= z 6500.0) x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -3.1e-23) {
tmp = z * (y * 6.0);
} else if (z <= 6500.0) {
tmp = x;
} 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 <= (-3.1d-23)) then
tmp = z * (y * 6.0d0)
else if (z <= 6500.0d0) then
tmp = x
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 <= -3.1e-23) {
tmp = z * (y * 6.0);
} else if (z <= 6500.0) {
tmp = x;
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -3.1e-23: tmp = z * (y * 6.0) elif z <= 6500.0: tmp = x else: tmp = -6.0 * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -3.1e-23) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 6500.0) tmp = x; else tmp = Float64(-6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -3.1e-23) tmp = z * (y * 6.0); elseif (z <= 6500.0) tmp = x; else tmp = -6.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -3.1e-23], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6500.0], x, N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{-23}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 6500:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -3.0999999999999999e-23Initial program 99.7%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6454.0%
Simplified54.0%
if -3.0999999999999999e-23 < z < 6500Initial program 99.9%
Taylor expanded in z around 0
Simplified77.8%
if 6500 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.8%
Simplified98.8%
Taylor expanded in y around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6459.2%
Simplified59.2%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6459.4%
Applied egg-rr59.4%
Final simplification67.5%
(FPCore (x y z) :precision binary64 (if (<= z -1.12e-20) (* z (* y 6.0)) (if (<= z 6500.0) x (* z (* x -6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.12e-20) {
tmp = z * (y * 6.0);
} else if (z <= 6500.0) {
tmp = x;
} else {
tmp = z * (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.12d-20)) then
tmp = z * (y * 6.0d0)
else if (z <= 6500.0d0) then
tmp = x
else
tmp = z * (x * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.12e-20) {
tmp = z * (y * 6.0);
} else if (z <= 6500.0) {
tmp = x;
} else {
tmp = z * (x * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.12e-20: tmp = z * (y * 6.0) elif z <= 6500.0: tmp = x else: tmp = z * (x * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.12e-20) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 6500.0) tmp = x; else tmp = Float64(z * Float64(x * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.12e-20) tmp = z * (y * 6.0); elseif (z <= 6500.0) tmp = x; else tmp = z * (x * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.12e-20], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6500.0], x, N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.12 \cdot 10^{-20}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 6500:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if z < -1.12000000000000002e-20Initial program 99.7%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6454.0%
Simplified54.0%
if -1.12000000000000002e-20 < z < 6500Initial program 99.9%
Taylor expanded in z around 0
Simplified77.8%
if 6500 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.8%
Simplified98.8%
Taylor expanded in y around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6459.2%
Simplified59.2%
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6459.3%
Applied egg-rr59.3%
Final simplification67.5%
(FPCore (x y z) :precision binary64 (if (<= z -6.6e-21) (* z (* y 6.0)) (if (<= z 6500.0) x (* x (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -6.6e-21) {
tmp = z * (y * 6.0);
} else if (z <= 6500.0) {
tmp = x;
} else {
tmp = x * (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 (z <= (-6.6d-21)) then
tmp = z * (y * 6.0d0)
else if (z <= 6500.0d0) then
tmp = x
else
tmp = x * (z * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -6.6e-21) {
tmp = z * (y * 6.0);
} else if (z <= 6500.0) {
tmp = x;
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6.6e-21: tmp = z * (y * 6.0) elif z <= 6500.0: tmp = x else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6.6e-21) tmp = Float64(z * Float64(y * 6.0)); elseif (z <= 6500.0) tmp = x; else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -6.6e-21) tmp = z * (y * 6.0); elseif (z <= 6500.0) tmp = x; else tmp = x * (z * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6.6e-21], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6500.0], x, N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.6 \cdot 10^{-21}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;z \leq 6500:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -6.60000000000000018e-21Initial program 99.7%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6454.0%
Simplified54.0%
if -6.60000000000000018e-21 < z < 6500Initial program 99.9%
Taylor expanded in z around 0
Simplified77.8%
if 6500 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.8%
Simplified98.8%
Taylor expanded in y around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6459.2%
Simplified59.2%
Final simplification67.5%
(FPCore (x y z) :precision binary64 (if (<= z -1.05e-20) (* 6.0 (* y z)) (if (<= z 6500.0) x (* x (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.05e-20) {
tmp = 6.0 * (y * z);
} else if (z <= 6500.0) {
tmp = x;
} else {
tmp = x * (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 (z <= (-1.05d-20)) then
tmp = 6.0d0 * (y * z)
else if (z <= 6500.0d0) then
tmp = x
else
tmp = x * (z * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.05e-20) {
tmp = 6.0 * (y * z);
} else if (z <= 6500.0) {
tmp = x;
} else {
tmp = x * (z * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.05e-20: tmp = 6.0 * (y * z) elif z <= 6500.0: tmp = x else: tmp = x * (z * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.05e-20) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= 6500.0) tmp = x; else tmp = Float64(x * Float64(z * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.05e-20) tmp = 6.0 * (y * z); elseif (z <= 6500.0) tmp = x; else tmp = x * (z * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.05e-20], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6500.0], x, N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{-20}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 6500:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if z < -1.0499999999999999e-20Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6497.6%
Simplified97.6%
Taylor expanded in y around inf
Simplified54.0%
if -1.0499999999999999e-20 < z < 6500Initial program 99.9%
Taylor expanded in z around 0
Simplified77.8%
if 6500 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.8%
Simplified98.8%
Taylor expanded in y around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6459.2%
Simplified59.2%
Final simplification67.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* y z)))) (if (<= z -9.2e-21) t_0 (if (<= z 1.1e-8) x t_0))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double tmp;
if (z <= -9.2e-21) {
tmp = t_0;
} else if (z <= 1.1e-8) {
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 <= (-9.2d-21)) then
tmp = t_0
else if (z <= 1.1d-8) 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 <= -9.2e-21) {
tmp = t_0;
} else if (z <= 1.1e-8) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) tmp = 0 if z <= -9.2e-21: tmp = t_0 elif z <= 1.1e-8: 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 <= -9.2e-21) tmp = t_0; elseif (z <= 1.1e-8) 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 <= -9.2e-21) tmp = t_0; elseif (z <= 1.1e-8) 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, -9.2e-21], t$95$0, If[LessEqual[z, 1.1e-8], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -9.2 \cdot 10^{-21}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-8}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -9.19999999999999998e-21 or 1.0999999999999999e-8 < z Initial program 99.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.1%
Simplified98.1%
Taylor expanded in y around inf
Simplified50.3%
if -9.19999999999999998e-21 < z < 1.0999999999999999e-8Initial program 99.9%
Taylor expanded in z around 0
Simplified78.9%
Final simplification65.1%
(FPCore (x y z) :precision binary64 (+ x (* (- y x) (* z 6.0))))
double code(double x, double y, double z) {
return x + ((y - x) * (z * 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 + ((y - x) * (z * 6.0d0))
end function
public static double code(double x, double y, double z) {
return x + ((y - x) * (z * 6.0));
}
def code(x, y, z): return x + ((y - x) * (z * 6.0))
function code(x, y, z) return Float64(x + Float64(Float64(y - x) * Float64(z * 6.0))) end
function tmp = code(x, y, z) tmp = x + ((y - x) * (z * 6.0)); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(z \cdot 6\right)
\end{array}
Initial program 99.8%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.8%
Simplified99.8%
Final simplification99.8%
(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.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.8%
Taylor expanded in z around 0
Simplified42.4%
(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 2024138
(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)))