
(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 (fma (sin y) (- z) (+ x (cos y))))
double code(double x, double y, double z) {
return fma(sin(y), -z, (x + cos(y)));
}
function code(x, y, z) return fma(sin(y), Float64(-z), Float64(x + cos(y))) end
code[x_, y_, z_] := N[(N[Sin[y], $MachinePrecision] * (-z) + N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\sin y, -z, x + \cos y\right)
\end{array}
Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= x -1650000.0) x (if (<= x 2.3e-15) (- (cos y) (* (sin y) z)) (+ x (cos y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1650000.0) {
tmp = x;
} else if (x <= 2.3e-15) {
tmp = cos(y) - (sin(y) * z);
} 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 (x <= (-1650000.0d0)) then
tmp = x
else if (x <= 2.3d-15) then
tmp = cos(y) - (sin(y) * z)
else
tmp = x + cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1650000.0) {
tmp = x;
} else if (x <= 2.3e-15) {
tmp = Math.cos(y) - (Math.sin(y) * z);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1650000.0: tmp = x elif x <= 2.3e-15: tmp = math.cos(y) - (math.sin(y) * z) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1650000.0) tmp = x; elseif (x <= 2.3e-15) tmp = Float64(cos(y) - Float64(sin(y) * z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1650000.0) tmp = x; elseif (x <= 2.3e-15) tmp = cos(y) - (sin(y) * z); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1650000.0], x, If[LessEqual[x, 2.3e-15], N[(N[Cos[y], $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1650000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-15}:\\
\;\;\;\;\cos y - \sin y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if x < -1.65e6Initial program 100.0%
Taylor expanded in x around inf 95.6%
if -1.65e6 < x < 2.2999999999999999e-15Initial program 99.9%
Taylor expanded in x around 0 99.0%
if 2.2999999999999999e-15 < x Initial program 99.9%
Taylor expanded in z around 0 84.5%
+-commutative84.5%
Simplified84.5%
Final simplification93.9%
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* (sin y) z)))
double code(double x, double y, double z) {
return (x + cos(y)) - (sin(y) * 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 + cos(y)) - (sin(y) * z)
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (Math.sin(y) * z);
}
def code(x, y, z): return (x + math.cos(y)) - (math.sin(y) * z)
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(sin(y) * z)) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (sin(y) * z); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[y], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - \sin y \cdot z
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) (- z))))
(if (<= z -1.66e+208)
t_0
(if (<= z -1.14e+70)
(+ x (+ 1.0 (* y (- (* y -0.5) z))))
(if (<= z 1.2e+99) (+ x (cos y)) t_0)))))
double code(double x, double y, double z) {
double t_0 = sin(y) * -z;
double tmp;
if (z <= -1.66e+208) {
tmp = t_0;
} else if (z <= -1.14e+70) {
tmp = x + (1.0 + (y * ((y * -0.5) - z)));
} else if (z <= 1.2e+99) {
tmp = x + cos(y);
} 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 = sin(y) * -z
if (z <= (-1.66d+208)) then
tmp = t_0
else if (z <= (-1.14d+70)) then
tmp = x + (1.0d0 + (y * ((y * (-0.5d0)) - z)))
else if (z <= 1.2d+99) then
tmp = x + cos(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) * -z;
double tmp;
if (z <= -1.66e+208) {
tmp = t_0;
} else if (z <= -1.14e+70) {
tmp = x + (1.0 + (y * ((y * -0.5) - z)));
} else if (z <= 1.2e+99) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * -z tmp = 0 if z <= -1.66e+208: tmp = t_0 elif z <= -1.14e+70: tmp = x + (1.0 + (y * ((y * -0.5) - z))) elif z <= 1.2e+99: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(sin(y) * Float64(-z)) tmp = 0.0 if (z <= -1.66e+208) tmp = t_0; elseif (z <= -1.14e+70) tmp = Float64(x + Float64(1.0 + Float64(y * Float64(Float64(y * -0.5) - z)))); elseif (z <= 1.2e+99) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * -z; tmp = 0.0; if (z <= -1.66e+208) tmp = t_0; elseif (z <= -1.14e+70) tmp = x + (1.0 + (y * ((y * -0.5) - z))); elseif (z <= 1.2e+99) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision]}, If[LessEqual[z, -1.66e+208], t$95$0, If[LessEqual[z, -1.14e+70], N[(x + N[(1.0 + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e+99], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -1.66 \cdot 10^{+208}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.14 \cdot 10^{+70}:\\
\;\;\;\;x + \left(1 + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+99}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1.66e208 or 1.2000000000000001e99 < z Initial program 99.7%
Taylor expanded in z around inf 69.7%
associate-*r*69.7%
neg-mul-169.7%
*-commutative69.7%
Simplified69.7%
if -1.66e208 < z < -1.14e70Initial program 99.9%
Taylor expanded in y around 0 79.2%
associate-+r+79.2%
+-commutative79.2%
associate-+l+79.2%
+-commutative79.2%
mul-1-neg79.2%
unsub-neg79.2%
*-commutative79.2%
unpow279.2%
associate-*l*79.2%
distribute-lft-out--79.4%
Simplified79.4%
if -1.14e70 < z < 1.2000000000000001e99Initial program 100.0%
Taylor expanded in z around 0 93.7%
+-commutative93.7%
Simplified93.7%
Final simplification86.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.0011) (not (<= y 0.0002))) (+ x (cos y)) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0011) || !(y <= 0.0002)) {
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 <= (-0.0011d0)) .or. (.not. (y <= 0.0002d0))) 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 <= -0.0011) || !(y <= 0.0002)) {
tmp = x + Math.cos(y);
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.0011) or not (y <= 0.0002): tmp = x + math.cos(y) else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.0011) || !(y <= 0.0002)) tmp = Float64(x + cos(y)); else tmp = Float64(x + Float64(1.0 - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.0011) || ~((y <= 0.0002))) tmp = x + cos(y); else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.0011], N[Not[LessEqual[y, 0.0002]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0011 \lor \neg \left(y \leq 0.0002\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -0.00110000000000000007 or 2.0000000000000001e-4 < y Initial program 99.8%
Taylor expanded in z around 0 64.9%
+-commutative64.9%
Simplified64.9%
if -0.00110000000000000007 < y < 2.0000000000000001e-4Initial program 100.0%
Taylor expanded in y around 0 100.0%
associate-+r+100.0%
+-commutative100.0%
associate-+l+100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification82.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -1e-12) (not (<= x 6e-11))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1e-12) || !(x <= 6e-11)) {
tmp = x + 1.0;
} else {
tmp = 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 <= (-1d-12)) .or. (.not. (x <= 6d-11))) then
tmp = x + 1.0d0
else
tmp = cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1e-12) || !(x <= 6e-11)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1e-12) or not (x <= 6e-11): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1e-12) || !(x <= 6e-11)) tmp = Float64(x + 1.0); else tmp = cos(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1e-12) || ~((x <= 6e-11))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1e-12], N[Not[LessEqual[x, 6e-11]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-12} \lor \neg \left(x \leq 6 \cdot 10^{-11}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -9.9999999999999998e-13 or 6e-11 < x Initial program 100.0%
Taylor expanded in y around 0 88.0%
+-commutative88.0%
Simplified88.0%
if -9.9999999999999998e-13 < x < 6e-11Initial program 99.9%
Taylor expanded in x around 0 99.8%
Taylor expanded in z around 0 60.6%
Final simplification76.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -880.0) (not (<= y 1.85e+81))) (+ x 1.0) (+ x (+ 1.0 (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -880.0) || !(y <= 1.85e+81)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 + (y * ((y * -0.5) - 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 <= (-880.0d0)) .or. (.not. (y <= 1.85d+81))) then
tmp = x + 1.0d0
else
tmp = x + (1.0d0 + (y * ((y * (-0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -880.0) || !(y <= 1.85e+81)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 + (y * ((y * -0.5) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -880.0) or not (y <= 1.85e+81): tmp = x + 1.0 else: tmp = x + (1.0 + (y * ((y * -0.5) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -880.0) || !(y <= 1.85e+81)) tmp = Float64(x + 1.0); else tmp = Float64(x + Float64(1.0 + Float64(y * Float64(Float64(y * -0.5) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -880.0) || ~((y <= 1.85e+81))) tmp = x + 1.0; else tmp = x + (1.0 + (y * ((y * -0.5) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -880.0], N[Not[LessEqual[y, 1.85e+81]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(x + N[(1.0 + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -880 \lor \neg \left(y \leq 1.85 \cdot 10^{+81}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\end{array}
\end{array}
if y < -880 or 1.85e81 < y Initial program 99.8%
Taylor expanded in y around 0 45.6%
+-commutative45.6%
Simplified45.6%
if -880 < y < 1.85e81Initial program 100.0%
Taylor expanded in y around 0 94.6%
associate-+r+94.6%
+-commutative94.6%
associate-+l+94.6%
+-commutative94.6%
mul-1-neg94.6%
unsub-neg94.6%
*-commutative94.6%
unpow294.6%
associate-*l*94.6%
distribute-lft-out--94.6%
Simplified94.6%
Final simplification72.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.9e+135) (not (<= y 2.9e+81))) (+ x 1.0) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.9e+135) || !(y <= 2.9e+81)) {
tmp = x + 1.0;
} 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 <= (-2.9d+135)) .or. (.not. (y <= 2.9d+81))) then
tmp = x + 1.0d0
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 <= -2.9e+135) || !(y <= 2.9e+81)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.9e+135) or not (y <= 2.9e+81): tmp = x + 1.0 else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.9e+135) || !(y <= 2.9e+81)) tmp = Float64(x + 1.0); else tmp = Float64(x + Float64(1.0 - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.9e+135) || ~((y <= 2.9e+81))) tmp = x + 1.0; else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.9e+135], N[Not[LessEqual[y, 2.9e+81]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+135} \lor \neg \left(y \leq 2.9 \cdot 10^{+81}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -2.8999999999999999e135 or 2.9e81 < y Initial program 99.8%
Taylor expanded in y around 0 47.3%
+-commutative47.3%
Simplified47.3%
if -2.8999999999999999e135 < y < 2.9e81Initial program 100.0%
Taylor expanded in y around 0 84.9%
associate-+r+84.9%
+-commutative84.9%
associate-+l+84.9%
mul-1-neg84.9%
unsub-neg84.9%
Simplified84.9%
Final simplification72.7%
(FPCore (x y z) :precision binary64 (if (<= x -1900.0) x (if (<= x 5.2e-100) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1900.0) {
tmp = x;
} else if (x <= 5.2e-100) {
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 <= (-1900.0d0)) then
tmp = x
else if (x <= 5.2d-100) 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 <= -1900.0) {
tmp = x;
} else if (x <= 5.2e-100) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1900.0: tmp = x elif x <= 5.2e-100: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1900.0) tmp = x; elseif (x <= 5.2e-100) 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 <= -1900.0) tmp = x; elseif (x <= 5.2e-100) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1900.0], x, If[LessEqual[x, 5.2e-100], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1900:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-100}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1900Initial program 100.0%
Taylor expanded in x around inf 95.6%
if -1900 < x < 5.1999999999999997e-100Initial program 99.9%
Taylor expanded in y around 0 51.0%
associate-+r+51.0%
+-commutative51.0%
associate-+l+51.0%
mul-1-neg51.0%
unsub-neg51.0%
Simplified51.0%
Taylor expanded in x around 0 50.1%
if 5.1999999999999997e-100 < x Initial program 99.9%
Taylor expanded in y around 0 76.5%
+-commutative76.5%
Simplified76.5%
Final simplification70.9%
(FPCore (x y z) :precision binary64 (if (<= x -1860.0) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1860.0) {
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 <= (-1860.0d0)) 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 <= -1860.0) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1860.0: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1860.0) 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 <= -1860.0) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1860.0], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1860:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1860 or 1 < x Initial program 100.0%
Taylor expanded in x around inf 88.2%
if -1860 < x < 1Initial program 99.9%
Taylor expanded in x around 0 97.9%
Taylor expanded in y around 0 39.0%
Final simplification65.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 66.4%
+-commutative66.4%
Simplified66.4%
Final simplification66.4%
(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 52.4%
Taylor expanded in y around 0 19.7%
Final simplification19.7%
herbie shell --seed 2024018
(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))))