
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * 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 + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= x -0.0105) (+ x (cos y)) (if (<= x 5.6e+40) (- (cos y) (* z (sin y))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.0105) {
tmp = x + cos(y);
} else if (x <= 5.6e+40) {
tmp = cos(y) - (z * sin(y));
} else {
tmp = x + 1.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 (x <= (-0.0105d0)) then
tmp = x + cos(y)
else if (x <= 5.6d+40) then
tmp = cos(y) - (z * sin(y))
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -0.0105) {
tmp = x + Math.cos(y);
} else if (x <= 5.6e+40) {
tmp = Math.cos(y) - (z * Math.sin(y));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.0105: tmp = x + math.cos(y) elif x <= 5.6e+40: tmp = math.cos(y) - (z * math.sin(y)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.0105) tmp = Float64(x + cos(y)); elseif (x <= 5.6e+40) tmp = Float64(cos(y) - Float64(z * sin(y))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.0105) tmp = x + cos(y); elseif (x <= 5.6e+40) tmp = cos(y) - (z * sin(y)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.0105], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.6e+40], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0105:\\
\;\;\;\;x + \cos y\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+40}:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -0.0105000000000000007Initial program 100.0%
Taylor expanded in z around 0 81.3%
+-commutative81.3%
Simplified81.3%
if -0.0105000000000000007 < x < 5.6000000000000003e40Initial program 99.9%
Taylor expanded in x around 0 98.1%
if 5.6000000000000003e40 < x Initial program 99.9%
Taylor expanded in y around 0 88.6%
+-commutative88.6%
Simplified88.6%
Final simplification91.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.45e+172) (not (<= z 6.2e+101))) (- (+ 1.0 (+ x (* -0.5 (* y y)))) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.45e+172) || !(z <= 6.2e+101)) {
tmp = (1.0 + (x + (-0.5 * (y * y)))) - (z * sin(y));
} else {
tmp = x + 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 ((z <= (-1.45d+172)) .or. (.not. (z <= 6.2d+101))) then
tmp = (1.0d0 + (x + ((-0.5d0) * (y * y)))) - (z * sin(y))
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.45e+172) || !(z <= 6.2e+101)) {
tmp = (1.0 + (x + (-0.5 * (y * y)))) - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.45e+172) or not (z <= 6.2e+101): tmp = (1.0 + (x + (-0.5 * (y * y)))) - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.45e+172) || !(z <= 6.2e+101)) tmp = Float64(Float64(1.0 + Float64(x + Float64(-0.5 * Float64(y * y)))) - Float64(z * sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.45e+172) || ~((z <= 6.2e+101))) tmp = (1.0 + (x + (-0.5 * (y * y)))) - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.45e+172], N[Not[LessEqual[z, 6.2e+101]], $MachinePrecision]], N[(N[(1.0 + N[(x + N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{+172} \lor \neg \left(z \leq 6.2 \cdot 10^{+101}\right):\\
\;\;\;\;\left(1 + \left(x + -0.5 \cdot \left(y \cdot y\right)\right)\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.45e172 or 6.19999999999999998e101 < z Initial program 99.8%
Taylor expanded in y around 0 72.1%
unpow272.1%
Simplified72.1%
if -1.45e172 < z < 6.19999999999999998e101Initial program 99.9%
Taylor expanded in z around 0 88.5%
+-commutative88.5%
Simplified88.5%
Final simplification83.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -170000000.0) (not (<= y 3600000000000.0))) (+ x (cos y)) (+ 1.0 (fma (- y) z x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -170000000.0) || !(y <= 3600000000000.0)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + fma(-y, z, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -170000000.0) || !(y <= 3600000000000.0)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + fma(Float64(-y), z, x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -170000000.0], N[Not[LessEqual[y, 3600000000000.0]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[((-y) * z + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -170000000 \lor \neg \left(y \leq 3600000000000\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \mathsf{fma}\left(-y, z, x\right)\\
\end{array}
\end{array}
if y < -1.7e8 or 3.6e12 < y Initial program 99.9%
Taylor expanded in z around 0 64.9%
+-commutative64.9%
Simplified64.9%
if -1.7e8 < y < 3.6e12Initial program 100.0%
Taylor expanded in y around 0 96.6%
+-commutative96.6%
associate-*r*96.6%
fma-def96.6%
mul-1-neg96.6%
Simplified96.6%
Final simplification81.1%
(FPCore (x y z) :precision binary64 (if (or (<= y -6600000.0) (not (<= y 3600000000000.0))) (+ x (cos y)) (- (+ x 1.0) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6600000.0) || !(y <= 3600000000000.0)) {
tmp = x + cos(y);
} else {
tmp = (x + 1.0) - (y * 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 <= (-6600000.0d0)) .or. (.not. (y <= 3600000000000.0d0))) then
tmp = x + cos(y)
else
tmp = (x + 1.0d0) - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6600000.0) || !(y <= 3600000000000.0)) {
tmp = x + Math.cos(y);
} else {
tmp = (x + 1.0) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6600000.0) or not (y <= 3600000000000.0): tmp = x + math.cos(y) else: tmp = (x + 1.0) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6600000.0) || !(y <= 3600000000000.0)) tmp = Float64(x + cos(y)); else tmp = Float64(Float64(x + 1.0) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6600000.0) || ~((y <= 3600000000000.0))) tmp = x + cos(y); else tmp = (x + 1.0) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6600000.0], N[Not[LessEqual[y, 3600000000000.0]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6600000 \lor \neg \left(y \leq 3600000000000\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\end{array}
\end{array}
if y < -6.6e6 or 3.6e12 < y Initial program 99.9%
Taylor expanded in z around 0 64.9%
+-commutative64.9%
Simplified64.9%
if -6.6e6 < y < 3.6e12Initial program 100.0%
flip3--49.4%
clear-num49.4%
clear-num49.3%
flip3--99.7%
+-commutative99.7%
associate--l+99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 96.6%
associate-+r+96.6%
mul-1-neg96.6%
Simplified96.6%
unsub-neg96.6%
*-commutative96.6%
Applied egg-rr96.6%
Final simplification81.1%
(FPCore (x y z) :precision binary64 (if (<= x -1.05e-15) (+ x 1.0) (if (<= x 0.00095) (cos y) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.05e-15) {
tmp = x + 1.0;
} else if (x <= 0.00095) {
tmp = cos(y);
} else {
tmp = x + 1.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 (x <= (-1.05d-15)) then
tmp = x + 1.0d0
else if (x <= 0.00095d0) then
tmp = cos(y)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.05e-15) {
tmp = x + 1.0;
} else if (x <= 0.00095) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.05e-15: tmp = x + 1.0 elif x <= 0.00095: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.05e-15) tmp = Float64(x + 1.0); elseif (x <= 0.00095) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.05e-15) tmp = x + 1.0; elseif (x <= 0.00095) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.05e-15], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 0.00095], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-15}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 0.00095:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.0499999999999999e-15 or 9.49999999999999998e-4 < x Initial program 99.9%
Taylor expanded in y around 0 80.2%
+-commutative80.2%
Simplified80.2%
if -1.0499999999999999e-15 < x < 9.49999999999999998e-4Initial program 99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in z around 0 62.1%
Final simplification72.5%
(FPCore (x y z) :precision binary64 (if (<= y -2.5e+57) (+ x 1.0) (if (<= y 8000000000000.0) (- (+ x 1.0) (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.5e+57) {
tmp = x + 1.0;
} else if (y <= 8000000000000.0) {
tmp = (x + 1.0) - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-2.5d+57)) then
tmp = x + 1.0d0
else if (y <= 8000000000000.0d0) then
tmp = (x + 1.0d0) - (y * z)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.5e+57) {
tmp = x + 1.0;
} else if (y <= 8000000000000.0) {
tmp = (x + 1.0) - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.5e+57: tmp = x + 1.0 elif y <= 8000000000000.0: tmp = (x + 1.0) - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.5e+57) tmp = Float64(x + 1.0); elseif (y <= 8000000000000.0) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.5e+57) tmp = x + 1.0; elseif (y <= 8000000000000.0) tmp = (x + 1.0) - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.5e+57], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 8000000000000.0], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+57}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 8000000000000:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -2.49999999999999986e57 or 8e12 < y Initial program 99.9%
Taylor expanded in y around 0 44.5%
+-commutative44.5%
Simplified44.5%
if -2.49999999999999986e57 < y < 8e12Initial program 99.9%
flip3--48.7%
clear-num48.7%
clear-num48.7%
flip3--99.7%
+-commutative99.7%
associate--l+99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 92.4%
associate-+r+92.4%
mul-1-neg92.4%
Simplified92.4%
unsub-neg92.4%
*-commutative92.4%
Applied egg-rr92.4%
Final simplification70.9%
(FPCore (x y z) :precision binary64 (if (<= x -0.0066) (+ x 1.0) (if (<= x 1.15e+36) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.0066) {
tmp = x + 1.0;
} else if (x <= 1.15e+36) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.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 (x <= (-0.0066d0)) then
tmp = x + 1.0d0
else if (x <= 1.15d+36) then
tmp = 1.0d0 - (y * z)
else
tmp = x + 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -0.0066) {
tmp = x + 1.0;
} else if (x <= 1.15e+36) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.0066: tmp = x + 1.0 elif x <= 1.15e+36: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.0066) tmp = Float64(x + 1.0); elseif (x <= 1.15e+36) tmp = Float64(1.0 - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.0066) tmp = x + 1.0; elseif (x <= 1.15e+36) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.0066], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 1.15e+36], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0066:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{+36}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -0.0066 or 1.14999999999999998e36 < x Initial program 100.0%
Taylor expanded in y around 0 83.0%
+-commutative83.0%
Simplified83.0%
if -0.0066 < x < 1.14999999999999998e36Initial program 99.9%
flip3--75.7%
clear-num75.6%
clear-num75.6%
flip3--99.7%
+-commutative99.7%
associate--l+99.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 52.7%
associate-+r+52.7%
mul-1-neg52.7%
Simplified52.7%
Taylor expanded in x around 0 51.1%
Final simplification68.2%
(FPCore (x y z) :precision binary64 (if (<= z 1.3e+221) (+ x 1.0) (* z (- y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 1.3e+221) {
tmp = x + 1.0;
} 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 (z <= 1.3d+221) then
tmp = x + 1.0d0
else
tmp = z * -y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 1.3e+221) {
tmp = x + 1.0;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 1.3e+221: tmp = x + 1.0 else: tmp = z * -y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 1.3e+221) tmp = Float64(x + 1.0); else tmp = Float64(z * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 1.3e+221) tmp = x + 1.0; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 1.3e+221], N[(x + 1.0), $MachinePrecision], N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.3 \cdot 10^{+221}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < 1.30000000000000002e221Initial program 99.9%
Taylor expanded in y around 0 66.2%
+-commutative66.2%
Simplified66.2%
if 1.30000000000000002e221 < z Initial program 99.9%
Taylor expanded in z around inf 78.2%
mul-1-neg78.2%
distribute-rgt-neg-out78.2%
Simplified78.2%
Taylor expanded in y around 0 49.3%
associate-*r*49.3%
mul-1-neg49.3%
Simplified49.3%
Final simplification65.0%
(FPCore (x y z) :precision binary64 (if (<= x -0.0065) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.0065) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} 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.0065d0)) then
tmp = x
else if (x <= 1.0d0) then
tmp = 1.0d0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -0.0065) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.0065: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.0065) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.0065) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.0065], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0065:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.0064999999999999997 or 1 < x Initial program 99.9%
Taylor expanded in x around inf 80.3%
if -0.0064999999999999997 < x < 1Initial program 99.9%
Taylor expanded in x around 0 98.8%
Taylor expanded in y around 0 40.0%
Final simplification62.5%
(FPCore (x y z) :precision binary64 (+ x 1.0))
double code(double x, double y, double z) {
return x + 1.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 + 1.0d0
end function
public static double code(double x, double y, double z) {
return x + 1.0;
}
def code(x, y, z): return x + 1.0
function code(x, y, z) return Float64(x + 1.0) end
function tmp = code(x, y, z) tmp = x + 1.0; end
code[x_, y_, z_] := N[(x + 1.0), $MachinePrecision]
\begin{array}{l}
\\
x + 1
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 63.0%
+-commutative63.0%
Simplified63.0%
Final simplification63.0%
(FPCore (x y z) :precision binary64 1.0)
double code(double x, double y, double z) {
return 1.0;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.0d0
end function
public static double code(double x, double y, double z) {
return 1.0;
}
def code(x, y, z): return 1.0
function code(x, y, z) return 1.0 end
function tmp = code(x, y, z) tmp = 1.0; end
code[x_, y_, z_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 54.6%
Taylor expanded in y around 0 19.3%
Final simplification19.3%
herbie shell --seed 2023297
(FPCore (x y z)
:name "Graphics.Rasterific.Svg.PathConverter:segmentToBezier from rasterific-svg-0.2.3.1, B"
:precision binary64
(- (+ x (cos y)) (* z (sin y))))