
(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 13 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 (or (<= x -0.00047) (not (<= x 0.56))) (* x (- 1.0 (* z (/ (sin y) x)))) (- (cos y) (* z (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -0.00047) || !(x <= 0.56)) {
tmp = x * (1.0 - (z * (sin(y) / x)));
} else {
tmp = cos(y) - (z * 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 ((x <= (-0.00047d0)) .or. (.not. (x <= 0.56d0))) then
tmp = x * (1.0d0 - (z * (sin(y) / x)))
else
tmp = cos(y) - (z * sin(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -0.00047) || !(x <= 0.56)) {
tmp = x * (1.0 - (z * (Math.sin(y) / x)));
} else {
tmp = Math.cos(y) - (z * Math.sin(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -0.00047) or not (x <= 0.56): tmp = x * (1.0 - (z * (math.sin(y) / x))) else: tmp = math.cos(y) - (z * math.sin(y)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -0.00047) || !(x <= 0.56)) tmp = Float64(x * Float64(1.0 - Float64(z * Float64(sin(y) / x)))); else tmp = Float64(cos(y) - Float64(z * sin(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -0.00047) || ~((x <= 0.56))) tmp = x * (1.0 - (z * (sin(y) / x))); else tmp = cos(y) - (z * sin(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -0.00047], N[Not[LessEqual[x, 0.56]], $MachinePrecision]], N[(x * N[(1.0 - N[(z * N[(N[Sin[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00047 \lor \neg \left(x \leq 0.56\right):\\
\;\;\;\;x \cdot \left(1 - z \cdot \frac{\sin y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\cos y - z \cdot \sin y\\
\end{array}
\end{array}
if x < -4.69999999999999986e-4 or 0.56000000000000005 < x Initial program 99.9%
Taylor expanded in z around -inf 80.8%
mul-1-neg80.8%
distribute-rgt-neg-in80.8%
distribute-lft-out--80.8%
mul-1-neg80.8%
remove-double-neg80.8%
+-commutative80.8%
Simplified80.8%
Taylor expanded in x around inf 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 99.3%
mul-1-neg99.3%
distribute-neg-frac299.3%
associate-*r/99.3%
Simplified99.3%
if -4.69999999999999986e-4 < x < 0.56000000000000005Initial program 99.9%
Taylor expanded in x around 0 97.9%
Final simplification98.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))))
(if (<= y -0.0135)
t_0
(if (<= y 0.114)
(+ 1.0 (- x (* y z)))
(if (or (<= y 3.9e+214) (not (<= y 1e+243))) t_0 (* z (- (sin y))))))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -0.0135) {
tmp = t_0;
} else if (y <= 0.114) {
tmp = 1.0 + (x - (y * z));
} else if ((y <= 3.9e+214) || !(y <= 1e+243)) {
tmp = t_0;
} else {
tmp = z * -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) :: t_0
real(8) :: tmp
t_0 = x + cos(y)
if (y <= (-0.0135d0)) then
tmp = t_0
else if (y <= 0.114d0) then
tmp = 1.0d0 + (x - (y * z))
else if ((y <= 3.9d+214) .or. (.not. (y <= 1d+243))) then
tmp = t_0
else
tmp = z * -sin(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + Math.cos(y);
double tmp;
if (y <= -0.0135) {
tmp = t_0;
} else if (y <= 0.114) {
tmp = 1.0 + (x - (y * z));
} else if ((y <= 3.9e+214) || !(y <= 1e+243)) {
tmp = t_0;
} else {
tmp = z * -Math.sin(y);
}
return tmp;
}
def code(x, y, z): t_0 = x + math.cos(y) tmp = 0 if y <= -0.0135: tmp = t_0 elif y <= 0.114: tmp = 1.0 + (x - (y * z)) elif (y <= 3.9e+214) or not (y <= 1e+243): tmp = t_0 else: tmp = z * -math.sin(y) return tmp
function code(x, y, z) t_0 = Float64(x + cos(y)) tmp = 0.0 if (y <= -0.0135) tmp = t_0; elseif (y <= 0.114) tmp = Float64(1.0 + Float64(x - Float64(y * z))); elseif ((y <= 3.9e+214) || !(y <= 1e+243)) tmp = t_0; else tmp = Float64(z * Float64(-sin(y))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + cos(y); tmp = 0.0; if (y <= -0.0135) tmp = t_0; elseif (y <= 0.114) tmp = 1.0 + (x - (y * z)); elseif ((y <= 3.9e+214) || ~((y <= 1e+243))) tmp = t_0; else tmp = z * -sin(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.0135], t$95$0, If[LessEqual[y, 0.114], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 3.9e+214], N[Not[LessEqual[y, 1e+243]], $MachinePrecision]], t$95$0, N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -0.0135:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 0.114:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{+214} \lor \neg \left(y \leq 10^{+243}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\end{array}
\end{array}
if y < -0.0134999999999999998 or 0.114000000000000004 < y < 3.90000000000000013e214 or 1.0000000000000001e243 < y Initial program 99.9%
Taylor expanded in z around 0 75.3%
+-commutative75.3%
Simplified75.3%
if -0.0134999999999999998 < y < 0.114000000000000004Initial program 100.0%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
if 3.90000000000000013e214 < y < 1.0000000000000001e243Initial program 99.4%
Taylor expanded in z around inf 94.4%
associate-*r*94.4%
neg-mul-194.4%
*-commutative94.4%
Simplified94.4%
Final simplification88.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.3e+36) (not (<= z 1.02e+24))) (* z (- (/ x z) (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.3e+36) || !(z <= 1.02e+24)) {
tmp = z * ((x / 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 <= (-4.3d+36)) .or. (.not. (z <= 1.02d+24))) then
tmp = z * ((x / 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 <= -4.3e+36) || !(z <= 1.02e+24)) {
tmp = z * ((x / z) - Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.3e+36) or not (z <= 1.02e+24): tmp = z * ((x / z) - math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.3e+36) || !(z <= 1.02e+24)) tmp = Float64(z * Float64(Float64(x / 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 <= -4.3e+36) || ~((z <= 1.02e+24))) tmp = z * ((x / z) - sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.3e+36], N[Not[LessEqual[z, 1.02e+24]], $MachinePrecision]], N[(z * N[(N[(x / z), $MachinePrecision] - N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.3 \cdot 10^{+36} \lor \neg \left(z \leq 1.02 \cdot 10^{+24}\right):\\
\;\;\;\;z \cdot \left(\frac{x}{z} - \sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -4.30000000000000005e36 or 1.02000000000000004e24 < z Initial program 99.8%
Taylor expanded in z around -inf 99.7%
mul-1-neg99.7%
distribute-rgt-neg-in99.7%
distribute-lft-out--99.7%
mul-1-neg99.7%
remove-double-neg99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 91.1%
if -4.30000000000000005e36 < z < 1.02000000000000004e24Initial program 100.0%
Taylor expanded in z around 0 99.2%
+-commutative99.2%
Simplified99.2%
Final simplification95.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.0185) (not (<= y 0.00027))) (+ x (cos y)) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0185) || !(y <= 0.00027)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x - (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.0185d0)) .or. (.not. (y <= 0.00027d0))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -0.0185) || !(y <= 0.00027)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -0.0185) or not (y <= 0.00027): tmp = x + math.cos(y) else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -0.0185) || !(y <= 0.00027)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -0.0185) || ~((y <= 0.00027))) tmp = x + cos(y); else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.0185], N[Not[LessEqual[y, 0.00027]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0185 \lor \neg \left(y \leq 0.00027\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -0.0184999999999999991 or 2.70000000000000003e-4 < y Initial program 99.8%
Taylor expanded in z around 0 70.7%
+-commutative70.7%
Simplified70.7%
if -0.0184999999999999991 < y < 2.70000000000000003e-4Initial program 100.0%
Taylor expanded in y around 0 100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Final simplification85.8%
(FPCore (x y z) :precision binary64 (if (<= x -0.00047) x (if (<= x 7.8e-16) (cos y) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.00047) {
tmp = x;
} else if (x <= 7.8e-16) {
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 <= (-0.00047d0)) then
tmp = x
else if (x <= 7.8d-16) 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 <= -0.00047) {
tmp = x;
} else if (x <= 7.8e-16) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.00047: tmp = x elif x <= 7.8e-16: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.00047) tmp = x; elseif (x <= 7.8e-16) 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 <= -0.00047) tmp = x; elseif (x <= 7.8e-16) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.00047], x, If[LessEqual[x, 7.8e-16], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00047:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{-16}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -4.69999999999999986e-4Initial program 100.0%
Taylor expanded in x around inf 89.4%
if -4.69999999999999986e-4 < x < 7.79999999999999954e-16Initial program 99.9%
Taylor expanded in x around 0 99.3%
Taylor expanded in z around 0 66.1%
if 7.79999999999999954e-16 < x Initial program 99.9%
Taylor expanded in y around 0 82.0%
+-commutative82.0%
Simplified82.0%
Final simplification77.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -18000000.0) (not (<= y 11.0))) (+ x 1.0) (+ 1.0 (+ x (* y (- (* y -0.5) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -18000000.0) || !(y <= 11.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (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 <= (-18000000.0d0)) .or. (.not. (y <= 11.0d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x + (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 <= -18000000.0) || !(y <= 11.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -18000000.0) or not (y <= 11.0): tmp = x + 1.0 else: tmp = 1.0 + (x + (y * ((y * -0.5) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -18000000.0) || !(y <= 11.0)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -18000000.0) || ~((y <= 11.0))) tmp = x + 1.0; else tmp = 1.0 + (x + (y * ((y * -0.5) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -18000000.0], N[Not[LessEqual[y, 11.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -18000000 \lor \neg \left(y \leq 11\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\end{array}
\end{array}
if y < -1.8e7 or 11 < y Initial program 99.9%
Taylor expanded in y around 0 46.5%
+-commutative46.5%
Simplified46.5%
if -1.8e7 < y < 11Initial program 100.0%
Taylor expanded in y around 0 98.3%
Final simplification73.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -900000000.0) (not (<= y 22.0))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -900000000.0) || !(y <= 22.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (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 <= (-900000000.0d0)) .or. (.not. (y <= 22.0d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -900000000.0) || !(y <= 22.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -900000000.0) or not (y <= 22.0): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -900000000.0) || !(y <= 22.0)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -900000000.0) || ~((y <= 22.0))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -900000000.0], N[Not[LessEqual[y, 22.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -900000000 \lor \neg \left(y \leq 22\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -9e8 or 22 < y Initial program 99.9%
Taylor expanded in y around 0 46.5%
+-commutative46.5%
Simplified46.5%
if -9e8 < y < 22Initial program 100.0%
Taylor expanded in y around 0 98.2%
mul-1-neg98.2%
unsub-neg98.2%
Simplified98.2%
Final simplification73.7%
(FPCore (x y z) :precision binary64 (if (<= x -850000.0) x (if (<= x 7.5e-6) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -850000.0) {
tmp = x;
} else if (x <= 7.5e-6) {
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 <= (-850000.0d0)) then
tmp = x
else if (x <= 7.5d-6) 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 <= -850000.0) {
tmp = x;
} else if (x <= 7.5e-6) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -850000.0: tmp = x elif x <= 7.5e-6: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -850000.0) tmp = x; elseif (x <= 7.5e-6) 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 <= -850000.0) tmp = x; elseif (x <= 7.5e-6) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -850000.0], x, If[LessEqual[x, 7.5e-6], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -850000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-6}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -8.5e5Initial program 100.0%
Taylor expanded in x around inf 91.8%
if -8.5e5 < x < 7.50000000000000019e-6Initial program 99.9%
Taylor expanded in y around 0 52.4%
mul-1-neg52.4%
unsub-neg52.4%
Simplified52.4%
Taylor expanded in x around 0 52.0%
if 7.50000000000000019e-6 < x Initial program 99.9%
Taylor expanded in y around 0 82.6%
+-commutative82.6%
Simplified82.6%
Final simplification71.5%
(FPCore (x y z) :precision binary64 (if (<= x -0.00047) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.00047) {
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.00047d0)) 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.00047) {
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.00047: 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.00047) 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.00047) 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.00047], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00047:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.69999999999999986e-4 or 1 < x Initial program 99.9%
Taylor expanded in x around inf 85.2%
if -4.69999999999999986e-4 < x < 1Initial program 99.9%
Taylor expanded in x around 0 97.9%
Taylor expanded in y around 0 38.7%
Final simplification64.5%
(FPCore (x y z) :precision binary64 (if (<= z 4.4e+266) (+ x 1.0) (* z (- y))))
double code(double x, double y, double z) {
double tmp;
if (z <= 4.4e+266) {
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 <= 4.4d+266) 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 <= 4.4e+266) {
tmp = x + 1.0;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 4.4e+266: tmp = x + 1.0 else: tmp = z * -y return tmp
function code(x, y, z) tmp = 0.0 if (z <= 4.4e+266) 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 <= 4.4e+266) tmp = x + 1.0; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 4.4e+266], N[(x + 1.0), $MachinePrecision], N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.4 \cdot 10^{+266}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if z < 4.3999999999999998e266Initial program 99.9%
Taylor expanded in y around 0 67.7%
+-commutative67.7%
Simplified67.7%
if 4.3999999999999998e266 < z Initial program 99.7%
Taylor expanded in z around inf 91.1%
associate-*r*91.1%
neg-mul-191.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in y around 0 56.8%
mul-1-neg56.8%
distribute-rgt-neg-in56.8%
Simplified56.8%
Final simplification67.3%
(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 65.5%
+-commutative65.5%
Simplified65.5%
Final simplification65.5%
(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 51.9%
Taylor expanded in y around 0 18.9%
Final simplification18.9%
herbie shell --seed 2024059
(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))))