
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ (+ x (sin y)) (* z (cos y))))
double code(double x, double y, double z) {
return (x + sin(y)) + (z * cos(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 + sin(y)) + (z * cos(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.sin(y)) + (z * Math.cos(y));
}
def code(x, y, z): return (x + math.sin(y)) + (z * math.cos(y))
function code(x, y, z) return Float64(Float64(x + sin(y)) + Float64(z * cos(y))) end
function tmp = code(x, y, z) tmp = (x + sin(y)) + (z * cos(y)); end
code[x_, y_, z_] := N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \sin y\right) + z \cdot \cos y
\end{array}
(FPCore (x y z) :precision binary64 (fma (cos y) z (+ x (sin y))))
double code(double x, double y, double z) {
return fma(cos(y), z, (x + sin(y)));
}
function code(x, y, z) return fma(cos(y), z, Float64(x + sin(y))) end
code[x_, y_, z_] := N[(N[Cos[y], $MachinePrecision] * z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\cos y, z, x + \sin y\right)
\end{array}
Initial program 99.9%
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
sin-lowering-sin.f6499.9
Applied egg-rr99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (+ x (sin y)) (* (cos y) z)))) (if (<= t_0 -2e-20) (+ z x) (if (<= t_0 5e-21) (+ y x) (+ z x)))))
double code(double x, double y, double z) {
double t_0 = (x + sin(y)) + (cos(y) * z);
double tmp;
if (t_0 <= -2e-20) {
tmp = z + x;
} else if (t_0 <= 5e-21) {
tmp = y + x;
} else {
tmp = z + 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 = (x + sin(y)) + (cos(y) * z)
if (t_0 <= (-2d-20)) then
tmp = z + x
else if (t_0 <= 5d-21) then
tmp = y + x
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x + Math.sin(y)) + (Math.cos(y) * z);
double tmp;
if (t_0 <= -2e-20) {
tmp = z + x;
} else if (t_0 <= 5e-21) {
tmp = y + x;
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): t_0 = (x + math.sin(y)) + (math.cos(y) * z) tmp = 0 if t_0 <= -2e-20: tmp = z + x elif t_0 <= 5e-21: tmp = y + x else: tmp = z + x return tmp
function code(x, y, z) t_0 = Float64(Float64(x + sin(y)) + Float64(cos(y) * z)) tmp = 0.0 if (t_0 <= -2e-20) tmp = Float64(z + x); elseif (t_0 <= 5e-21) tmp = Float64(y + x); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x + sin(y)) + (cos(y) * z); tmp = 0.0; if (t_0 <= -2e-20) tmp = z + x; elseif (t_0 <= 5e-21) tmp = y + x; else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-20], N[(z + x), $MachinePrecision], If[LessEqual[t$95$0, 5e-21], N[(y + x), $MachinePrecision], N[(z + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x + \sin y\right) + \cos y \cdot z\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-20}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-21}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < -1.99999999999999989e-20 or 4.99999999999999973e-21 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6471.8
Simplified71.8%
if -1.99999999999999989e-20 < (+.f64 (+.f64 x (sin.f64 y)) (*.f64 z (cos.f64 y))) < 4.99999999999999973e-21Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
unpow2N/A
*-lft-identityN/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt1-inN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified100.0%
Taylor expanded in z around 0
Simplified85.4%
Final simplification73.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (cos y) z)))
(if (<= z -1.65e+202)
t_0
(if (<= z -3.8e-24)
(+ z x)
(if (<= z 6.4e-27) (+ x (sin y)) (if (<= z 3.15e+122) (+ z x) t_0))))))
double code(double x, double y, double z) {
double t_0 = cos(y) * z;
double tmp;
if (z <= -1.65e+202) {
tmp = t_0;
} else if (z <= -3.8e-24) {
tmp = z + x;
} else if (z <= 6.4e-27) {
tmp = x + sin(y);
} else if (z <= 3.15e+122) {
tmp = z + 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 = cos(y) * z
if (z <= (-1.65d+202)) then
tmp = t_0
else if (z <= (-3.8d-24)) then
tmp = z + x
else if (z <= 6.4d-27) then
tmp = x + sin(y)
else if (z <= 3.15d+122) then
tmp = z + x
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.cos(y) * z;
double tmp;
if (z <= -1.65e+202) {
tmp = t_0;
} else if (z <= -3.8e-24) {
tmp = z + x;
} else if (z <= 6.4e-27) {
tmp = x + Math.sin(y);
} else if (z <= 3.15e+122) {
tmp = z + x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.cos(y) * z tmp = 0 if z <= -1.65e+202: tmp = t_0 elif z <= -3.8e-24: tmp = z + x elif z <= 6.4e-27: tmp = x + math.sin(y) elif z <= 3.15e+122: tmp = z + x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(cos(y) * z) tmp = 0.0 if (z <= -1.65e+202) tmp = t_0; elseif (z <= -3.8e-24) tmp = Float64(z + x); elseif (z <= 6.4e-27) tmp = Float64(x + sin(y)); elseif (z <= 3.15e+122) tmp = Float64(z + x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = cos(y) * z; tmp = 0.0; if (z <= -1.65e+202) tmp = t_0; elseif (z <= -3.8e-24) tmp = z + x; elseif (z <= 6.4e-27) tmp = x + sin(y); elseif (z <= 3.15e+122) tmp = z + x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -1.65e+202], t$95$0, If[LessEqual[z, -3.8e-24], N[(z + x), $MachinePrecision], If[LessEqual[z, 6.4e-27], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.15e+122], N[(z + x), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos y \cdot z\\
\mathbf{if}\;z \leq -1.65 \cdot 10^{+202}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{-24}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-27}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 3.15 \cdot 10^{+122}:\\
\;\;\;\;z + x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -1.6499999999999999e202 or 3.1500000000000001e122 < z Initial program 99.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6489.2
Simplified89.2%
if -1.6499999999999999e202 < z < -3.80000000000000026e-24 or 6.39999999999999982e-27 < z < 3.1500000000000001e122Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6480.6
Simplified80.6%
if -3.80000000000000026e-24 < z < 6.39999999999999982e-27Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6495.8
Simplified95.8%
Final simplification89.6%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fma (cos y) z x))) (if (<= z -2.2e-33) t_0 (if (<= z 4.9e-28) (+ x (sin y)) t_0))))
double code(double x, double y, double z) {
double t_0 = fma(cos(y), z, x);
double tmp;
if (z <= -2.2e-33) {
tmp = t_0;
} else if (z <= 4.9e-28) {
tmp = x + sin(y);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = fma(cos(y), z, x) tmp = 0.0 if (z <= -2.2e-33) tmp = t_0; elseif (z <= 4.9e-28) tmp = Float64(x + sin(y)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Cos[y], $MachinePrecision] * z + x), $MachinePrecision]}, If[LessEqual[z, -2.2e-33], t$95$0, If[LessEqual[z, 4.9e-28], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\cos y, z, x\right)\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{-33}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{-28}:\\
\;\;\;\;x + \sin y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.20000000000000005e-33 or 4.9000000000000003e-28 < z Initial program 99.8%
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
sin-lowering-sin.f6499.8
Applied egg-rr99.8%
Taylor expanded in x around inf
Simplified99.8%
if -2.20000000000000005e-33 < z < 4.9000000000000003e-28Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6495.8
Simplified95.8%
Final simplification98.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (sin y))))
(if (<= y -0.36)
t_0
(if (<= y 0.108) (+ y (fma (* z (* y -0.5)) y (+ z x))) t_0))))
double code(double x, double y, double z) {
double t_0 = x + sin(y);
double tmp;
if (y <= -0.36) {
tmp = t_0;
} else if (y <= 0.108) {
tmp = y + fma((z * (y * -0.5)), y, (z + x));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + sin(y)) tmp = 0.0 if (y <= -0.36) tmp = t_0; elseif (y <= 0.108) tmp = Float64(y + fma(Float64(z * Float64(y * -0.5)), y, Float64(z + x))); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.36], t$95$0, If[LessEqual[y, 0.108], N[(y + N[(N[(z * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] * y + N[(z + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \sin y\\
\mathbf{if}\;y \leq -0.36:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.108:\\
\;\;\;\;y + \mathsf{fma}\left(z \cdot \left(y \cdot -0.5\right), y, z + x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.35999999999999999 or 0.107999999999999999 < y Initial program 99.8%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
sin-lowering-sin.f6464.0
Simplified64.0%
if -0.35999999999999999 < y < 0.107999999999999999Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
unpow2N/A
*-lft-identityN/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt1-inN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified99.7%
distribute-lft-inN/A
*-rgt-identityN/A
associate-+l+N/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f6499.7
Applied egg-rr99.7%
Final simplification82.4%
(FPCore (x y z)
:precision binary64
(if (<= y -4.8)
(+ z x)
(if (<= y 13000.0)
(+ x (fma y (fma y (fma y -0.16666666666666666 (* z -0.5)) 1.0) z))
(+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.8) {
tmp = z + x;
} else if (y <= 13000.0) {
tmp = x + fma(y, fma(y, fma(y, -0.16666666666666666, (z * -0.5)), 1.0), z);
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -4.8) tmp = Float64(z + x); elseif (y <= 13000.0) tmp = Float64(x + fma(y, fma(y, fma(y, -0.16666666666666666, Float64(z * -0.5)), 1.0), z)); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -4.8], N[(z + x), $MachinePrecision], If[LessEqual[y, 13000.0], N[(x + N[(y * N[(y * N[(y * -0.16666666666666666 + N[(z * -0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 13000:\\
\;\;\;\;x + \mathsf{fma}\left(y, \mathsf{fma}\left(y, \mathsf{fma}\left(y, -0.16666666666666666, z \cdot -0.5\right), 1\right), z\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -4.79999999999999982 or 13000 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6449.8
Simplified49.8%
if -4.79999999999999982 < y < 13000Initial program 100.0%
Taylor expanded in y around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6498.6
Simplified98.6%
(FPCore (x y z) :precision binary64 (if (<= y -4.8) (+ z x) (if (<= y 13000.0) (+ y (fma z (fma y (* y -0.5) 1.0) x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.8) {
tmp = z + x;
} else if (y <= 13000.0) {
tmp = y + fma(z, fma(y, (y * -0.5), 1.0), x);
} else {
tmp = z + x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -4.8) tmp = Float64(z + x); elseif (y <= 13000.0) tmp = Float64(y + fma(z, fma(y, Float64(y * -0.5), 1.0), x)); else tmp = Float64(z + x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -4.8], N[(z + x), $MachinePrecision], If[LessEqual[y, 13000.0], N[(y + N[(z * N[(y * N[(y * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 13000:\\
\;\;\;\;y + \mathsf{fma}\left(z, \mathsf{fma}\left(y, y \cdot -0.5, 1\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -4.79999999999999982 or 13000 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6449.8
Simplified49.8%
if -4.79999999999999982 < y < 13000Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
unpow2N/A
*-lft-identityN/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt1-inN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified98.5%
(FPCore (x y z) :precision binary64 (if (<= y -1.65e+141) (+ z x) (if (<= y 6.5e+58) (+ y (+ z x)) (+ z x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.65e+141) {
tmp = z + x;
} else if (y <= 6.5e+58) {
tmp = y + (z + x);
} else {
tmp = z + 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 (y <= (-1.65d+141)) then
tmp = z + x
else if (y <= 6.5d+58) then
tmp = y + (z + x)
else
tmp = z + x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.65e+141) {
tmp = z + x;
} else if (y <= 6.5e+58) {
tmp = y + (z + x);
} else {
tmp = z + x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.65e+141: tmp = z + x elif y <= 6.5e+58: tmp = y + (z + x) else: tmp = z + x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.65e+141) tmp = Float64(z + x); elseif (y <= 6.5e+58) tmp = Float64(y + Float64(z + x)); else tmp = Float64(z + x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.65e+141) tmp = z + x; elseif (y <= 6.5e+58) tmp = y + (z + x); else tmp = z + x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.65e+141], N[(z + x), $MachinePrecision], If[LessEqual[y, 6.5e+58], N[(y + N[(z + x), $MachinePrecision]), $MachinePrecision], N[(z + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+141}:\\
\;\;\;\;z + x\\
\mathbf{elif}\;y \leq 6.5 \cdot 10^{+58}:\\
\;\;\;\;y + \left(z + x\right)\\
\mathbf{else}:\\
\;\;\;\;z + x\\
\end{array}
\end{array}
if y < -1.6499999999999998e141 or 6.49999999999999998e58 < y Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6449.7
Simplified49.7%
if -1.6499999999999998e141 < y < 6.49999999999999998e58Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f6488.2
Simplified88.2%
(FPCore (x y z) :precision binary64 (if (<= x -2550.0) x (if (<= x 0.0068) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2550.0) {
tmp = x;
} else if (x <= 0.0068) {
tmp = 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 (x <= (-2550.0d0)) then
tmp = x
else if (x <= 0.0068d0) then
tmp = z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2550.0) {
tmp = x;
} else if (x <= 0.0068) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2550.0: tmp = x elif x <= 0.0068: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2550.0) tmp = x; elseif (x <= 0.0068) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2550.0) tmp = x; elseif (x <= 0.0068) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2550.0], x, If[LessEqual[x, 0.0068], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2550:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 0.0068:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2550 or 0.00679999999999999962 < x Initial program 99.9%
Taylor expanded in x around inf
Simplified75.9%
if -2550 < x < 0.00679999999999999962Initial program 99.9%
Taylor expanded in z around inf
*-lowering-*.f64N/A
cos-lowering-cos.f6461.7
Simplified61.7%
Taylor expanded in y around 0
Simplified41.7%
(FPCore (x y z) :precision binary64 (if (<= x -5.2e-48) x (if (<= x 3.2e-144) y x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -5.2e-48) {
tmp = x;
} else if (x <= 3.2e-144) {
tmp = y;
} 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 (x <= (-5.2d-48)) then
tmp = x
else if (x <= 3.2d-144) then
tmp = y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -5.2e-48) {
tmp = x;
} else if (x <= 3.2e-144) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -5.2e-48: tmp = x elif x <= 3.2e-144: tmp = y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -5.2e-48) tmp = x; elseif (x <= 3.2e-144) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -5.2e-48) tmp = x; elseif (x <= 3.2e-144) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -5.2e-48], x, If[LessEqual[x, 3.2e-144], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-48}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-144}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.19999999999999975e-48 or 3.19999999999999973e-144 < x Initial program 99.9%
Taylor expanded in x around inf
Simplified59.5%
if -5.19999999999999975e-48 < x < 3.19999999999999973e-144Initial program 99.9%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-inN/A
associate-*r*N/A
unpow2N/A
*-lft-identityN/A
associate-+r+N/A
+-commutativeN/A
+-lowering-+.f64N/A
associate-+l+N/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt1-inN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified60.9%
Taylor expanded in z around 0
Simplified28.6%
Taylor expanded in y around inf
Simplified25.3%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
Taylor expanded in x around inf
Simplified44.0%
herbie shell --seed 2024199
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, C"
:precision binary64
(+ (+ x (sin y)) (* z (cos y))))