
(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 (+ x (+ (* z (cos y)) (sin y))))
double code(double x, double y, double z) {
return x + ((z * cos(y)) + sin(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 + ((z * cos(y)) + sin(y))
end function
public static double code(double x, double y, double z) {
return x + ((z * Math.cos(y)) + Math.sin(y));
}
def code(x, y, z): return x + ((z * math.cos(y)) + math.sin(y))
function code(x, y, z) return Float64(x + Float64(Float64(z * cos(y)) + sin(y))) end
function tmp = code(x, y, z) tmp = x + ((z * cos(y)) + sin(y)); end
code[x_, y_, z_] := N[(x + N[(N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision] + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z \cdot \cos y + \sin y\right)
\end{array}
Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
fma-undefine99.9%
Applied egg-rr99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (cos y))))
(if (<= z -9.5e+110)
t_0
(if (<= z -1.85e-15)
(+ x z)
(if (<= z 5.5e-38) (+ x (sin y)) (if (<= z 8.2e+77) (+ x z) t_0))))))
double code(double x, double y, double z) {
double t_0 = z * cos(y);
double tmp;
if (z <= -9.5e+110) {
tmp = t_0;
} else if (z <= -1.85e-15) {
tmp = x + z;
} else if (z <= 5.5e-38) {
tmp = x + sin(y);
} else if (z <= 8.2e+77) {
tmp = x + 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 = z * cos(y)
if (z <= (-9.5d+110)) then
tmp = t_0
else if (z <= (-1.85d-15)) then
tmp = x + z
else if (z <= 5.5d-38) then
tmp = x + sin(y)
else if (z <= 8.2d+77) then
tmp = x + z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.cos(y);
double tmp;
if (z <= -9.5e+110) {
tmp = t_0;
} else if (z <= -1.85e-15) {
tmp = x + z;
} else if (z <= 5.5e-38) {
tmp = x + Math.sin(y);
} else if (z <= 8.2e+77) {
tmp = x + z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.cos(y) tmp = 0 if z <= -9.5e+110: tmp = t_0 elif z <= -1.85e-15: tmp = x + z elif z <= 5.5e-38: tmp = x + math.sin(y) elif z <= 8.2e+77: tmp = x + z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * cos(y)) tmp = 0.0 if (z <= -9.5e+110) tmp = t_0; elseif (z <= -1.85e-15) tmp = Float64(x + z); elseif (z <= 5.5e-38) tmp = Float64(x + sin(y)); elseif (z <= 8.2e+77) tmp = Float64(x + z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * cos(y); tmp = 0.0; if (z <= -9.5e+110) tmp = t_0; elseif (z <= -1.85e-15) tmp = x + z; elseif (z <= 5.5e-38) tmp = x + sin(y); elseif (z <= 8.2e+77) tmp = x + z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.5e+110], t$95$0, If[LessEqual[z, -1.85e-15], N[(x + z), $MachinePrecision], If[LessEqual[z, 5.5e-38], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.2e+77], N[(x + z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \cos y\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+110}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{-15}:\\
\;\;\;\;x + z\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-38}:\\
\;\;\;\;x + \sin y\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+77}:\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -9.49999999999999939e110 or 8.2000000000000002e77 < z Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 84.5%
if -9.49999999999999939e110 < z < -1.85000000000000008e-15 or 5.50000000000000005e-38 < z < 8.2000000000000002e77Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 84.1%
+-commutative84.1%
Simplified84.1%
if -1.85000000000000008e-15 < z < 5.50000000000000005e-38Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 96.4%
+-commutative96.4%
Simplified96.4%
Final simplification89.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -58000000.0) (not (<= z 0.0135))) (+ x (* z (cos y))) (+ z (+ x (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -58000000.0) || !(z <= 0.0135)) {
tmp = x + (z * cos(y));
} else {
tmp = z + (x + sin(y));
}
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 <= (-58000000.0d0)) .or. (.not. (z <= 0.0135d0))) then
tmp = x + (z * cos(y))
else
tmp = z + (x + sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -58000000.0) || !(z <= 0.0135)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = z + (x + Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -58000000.0) or not (z <= 0.0135): tmp = x + (z * math.cos(y)) else: tmp = z + (x + math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -58000000.0) || !(z <= 0.0135)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(z + Float64(x + sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -58000000.0) || ~((z <= 0.0135))) tmp = x + (z * cos(y)); else tmp = z + (x + sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -58000000.0], N[Not[LessEqual[z, 0.0135]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z + N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -58000000 \lor \neg \left(z \leq 0.0135\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;z + \left(x + \sin y\right)\\
\end{array}
\end{array}
if z < -5.8e7 or 0.0134999999999999998 < z Initial program 99.9%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 99.8%
if -5.8e7 < z < 0.0134999999999999998Initial program 100.0%
expm1-log1p-u100.0%
expm1-undefine100.0%
Applied egg-rr100.0%
expm1-define100.0%
Simplified100.0%
Taylor expanded in y around 0 99.0%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.2e-15) (not (<= z 5.3e-37))) (+ x (* z (cos y))) (+ x (sin y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.2e-15) || !(z <= 5.3e-37)) {
tmp = x + (z * cos(y));
} else {
tmp = x + sin(y);
}
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 <= (-2.2d-15)) .or. (.not. (z <= 5.3d-37))) then
tmp = x + (z * cos(y))
else
tmp = x + sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.2e-15) || !(z <= 5.3e-37)) {
tmp = x + (z * Math.cos(y));
} else {
tmp = x + Math.sin(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.2e-15) or not (z <= 5.3e-37): tmp = x + (z * math.cos(y)) else: tmp = x + math.sin(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.2e-15) || !(z <= 5.3e-37)) tmp = Float64(x + Float64(z * cos(y))); else tmp = Float64(x + sin(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.2e-15) || ~((z <= 5.3e-37))) tmp = x + (z * cos(y)); else tmp = x + sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.2e-15], N[Not[LessEqual[z, 5.3e-37]], $MachinePrecision]], N[(x + N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Sin[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{-15} \lor \neg \left(z \leq 5.3 \cdot 10^{-37}\right):\\
\;\;\;\;x + z \cdot \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \sin y\\
\end{array}
\end{array}
if z < -2.19999999999999986e-15 or 5.29999999999999995e-37 < z Initial program 99.9%
log1p-expm1-u99.9%
Applied egg-rr99.9%
Taylor expanded in x around inf 97.5%
if -2.19999999999999986e-15 < z < 5.29999999999999995e-37Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around 0 96.4%
+-commutative96.4%
Simplified96.4%
Final simplification97.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -0.00041) (not (<= x 55.0))) (+ x z) (* z (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -0.00041) || !(x <= 55.0)) {
tmp = x + z;
} else {
tmp = z * cos(y);
}
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 <= (-0.00041d0)) .or. (.not. (x <= 55.0d0))) then
tmp = x + z
else
tmp = z * cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -0.00041) || !(x <= 55.0)) {
tmp = x + z;
} else {
tmp = z * Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -0.00041) or not (x <= 55.0): tmp = x + z else: tmp = z * math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -0.00041) || !(x <= 55.0)) tmp = Float64(x + z); else tmp = Float64(z * cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -0.00041) || ~((x <= 55.0))) tmp = x + z; else tmp = z * cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -0.00041], N[Not[LessEqual[x, 55.0]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z * N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00041 \lor \neg \left(x \leq 55\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z \cdot \cos y\\
\end{array}
\end{array}
if x < -4.0999999999999999e-4 or 55 < x Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 85.7%
+-commutative85.7%
Simplified85.7%
if -4.0999999999999999e-4 < x < 55Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 56.5%
Final simplification70.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.42e+20) (not (<= y 3.4e+14))) (+ x z) (+ (+ x z) (* y (+ 1.0 (* -0.5 (* z y)))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.42e+20) || !(y <= 3.4e+14)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (z * y))));
}
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.42d+20)) .or. (.not. (y <= 3.4d+14))) then
tmp = x + z
else
tmp = (x + z) + (y * (1.0d0 + ((-0.5d0) * (z * y))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.42e+20) || !(y <= 3.4e+14)) {
tmp = x + z;
} else {
tmp = (x + z) + (y * (1.0 + (-0.5 * (z * y))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.42e+20) or not (y <= 3.4e+14): tmp = x + z else: tmp = (x + z) + (y * (1.0 + (-0.5 * (z * y)))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.42e+20) || !(y <= 3.4e+14)) tmp = Float64(x + z); else tmp = Float64(Float64(x + z) + Float64(y * Float64(1.0 + Float64(-0.5 * Float64(z * y))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.42e+20) || ~((y <= 3.4e+14))) tmp = x + z; else tmp = (x + z) + (y * (1.0 + (-0.5 * (z * y)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.42e+20], N[Not[LessEqual[y, 3.4e+14]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(N[(x + z), $MachinePrecision] + N[(y * N[(1.0 + N[(-0.5 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.42 \cdot 10^{+20} \lor \neg \left(y \leq 3.4 \cdot 10^{+14}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;\left(x + z\right) + y \cdot \left(1 + -0.5 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if y < -1.42e20 or 3.4e14 < y Initial program 99.8%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 38.3%
+-commutative38.3%
Simplified38.3%
if -1.42e20 < y < 3.4e14Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 96.4%
associate-+r+96.4%
+-commutative96.4%
Simplified96.4%
Final simplification66.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -6e+20) (not (<= y 8e+16))) (+ x z) (+ y (+ x z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6e+20) || !(y <= 8e+16)) {
tmp = x + z;
} else {
tmp = 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 ((y <= (-6d+20)) .or. (.not. (y <= 8d+16))) then
tmp = x + z
else
tmp = y + (x + z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6e+20) || !(y <= 8e+16)) {
tmp = x + z;
} else {
tmp = y + (x + z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6e+20) or not (y <= 8e+16): tmp = x + z else: tmp = y + (x + z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6e+20) || !(y <= 8e+16)) tmp = Float64(x + z); else tmp = Float64(y + Float64(x + z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6e+20) || ~((y <= 8e+16))) tmp = x + z; else tmp = y + (x + z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6e+20], N[Not[LessEqual[y, 8e+16]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(y + N[(x + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{+20} \lor \neg \left(y \leq 8 \cdot 10^{+16}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;y + \left(x + z\right)\\
\end{array}
\end{array}
if y < -6e20 or 8e16 < y Initial program 99.8%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 38.3%
+-commutative38.3%
Simplified38.3%
if -6e20 < y < 8e16Initial program 100.0%
associate-+l+100.0%
+-commutative100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in y around 0 96.3%
+-commutative96.3%
associate-+l+96.3%
Simplified96.3%
Final simplification66.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -7e-96) (not (<= x 1.35e-180))) (+ x z) (+ z y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -7e-96) || !(x <= 1.35e-180)) {
tmp = x + z;
} else {
tmp = z + y;
}
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 <= (-7d-96)) .or. (.not. (x <= 1.35d-180))) then
tmp = x + z
else
tmp = z + y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -7e-96) || !(x <= 1.35e-180)) {
tmp = x + z;
} else {
tmp = z + y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -7e-96) or not (x <= 1.35e-180): tmp = x + z else: tmp = z + y return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -7e-96) || !(x <= 1.35e-180)) tmp = Float64(x + z); else tmp = Float64(z + y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -7e-96) || ~((x <= 1.35e-180))) tmp = x + z; else tmp = z + y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -7e-96], N[Not[LessEqual[x, 1.35e-180]], $MachinePrecision]], N[(x + z), $MachinePrecision], N[(z + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-96} \lor \neg \left(x \leq 1.35 \cdot 10^{-180}\right):\\
\;\;\;\;x + z\\
\mathbf{else}:\\
\;\;\;\;z + y\\
\end{array}
\end{array}
if x < -6.9999999999999998e-96 or 1.35000000000000007e-180 < x Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 72.2%
+-commutative72.2%
Simplified72.2%
if -6.9999999999999998e-96 < x < 1.35000000000000007e-180Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 45.8%
Final simplification65.5%
(FPCore (x y z) :precision binary64 (if (<= x -0.00085) x (if (<= x 41000.0) (+ z y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.00085) {
tmp = x;
} else if (x <= 41000.0) {
tmp = z + 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 <= (-0.00085d0)) then
tmp = x
else if (x <= 41000.0d0) then
tmp = z + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -0.00085) {
tmp = x;
} else if (x <= 41000.0) {
tmp = z + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.00085: tmp = x elif x <= 41000.0: tmp = z + y else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.00085) tmp = x; elseif (x <= 41000.0) tmp = Float64(z + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.00085) tmp = x; elseif (x <= 41000.0) tmp = z + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.00085], x, If[LessEqual[x, 41000.0], N[(z + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00085:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 41000:\\
\;\;\;\;z + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -8.49999999999999953e-4 or 41000 < x Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 74.4%
if -8.49999999999999953e-4 < x < 41000Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around 0 95.0%
Taylor expanded in y around 0 43.3%
Final simplification58.4%
(FPCore (x y z) :precision binary64 (if (<= x -0.00085) x (if (<= x 48000.0) z x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.00085) {
tmp = x;
} else if (x <= 48000.0) {
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 <= (-0.00085d0)) then
tmp = x
else if (x <= 48000.0d0) 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 <= -0.00085) {
tmp = x;
} else if (x <= 48000.0) {
tmp = z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.00085: tmp = x elif x <= 48000.0: tmp = z else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.00085) tmp = x; elseif (x <= 48000.0) tmp = z; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.00085) tmp = x; elseif (x <= 48000.0) tmp = z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.00085], x, If[LessEqual[x, 48000.0], z, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00085:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 48000:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -8.49999999999999953e-4 or 48000 < x Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 74.4%
if -8.49999999999999953e-4 < x < 48000Initial program 99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in y around 0 38.7%
+-commutative38.7%
Simplified38.7%
Taylor expanded in z around inf 35.7%
(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%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in x around inf 38.8%
herbie shell --seed 2024146
(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))))