
(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 14 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 100.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (or (<= x -4e-6) (not (<= x 4.8e-33)))
(- (+ x 1.0) t_0)
(- (cos y) t_0))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double tmp;
if ((x <= -4e-6) || !(x <= 4.8e-33)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = cos(y) - 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 * sin(y)
if ((x <= (-4d-6)) .or. (.not. (x <= 4.8d-33))) then
tmp = (x + 1.0d0) - t_0
else
tmp = cos(y) - t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double tmp;
if ((x <= -4e-6) || !(x <= 4.8e-33)) {
tmp = (x + 1.0) - t_0;
} else {
tmp = Math.cos(y) - t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) tmp = 0 if (x <= -4e-6) or not (x <= 4.8e-33): tmp = (x + 1.0) - t_0 else: tmp = math.cos(y) - t_0 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) tmp = 0.0 if ((x <= -4e-6) || !(x <= 4.8e-33)) tmp = Float64(Float64(x + 1.0) - t_0); else tmp = Float64(cos(y) - t_0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); tmp = 0.0; if ((x <= -4e-6) || ~((x <= 4.8e-33))) tmp = (x + 1.0) - t_0; else tmp = cos(y) - t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -4e-6], N[Not[LessEqual[x, 4.8e-33]], $MachinePrecision]], N[(N[(x + 1.0), $MachinePrecision] - t$95$0), $MachinePrecision], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
\mathbf{if}\;x \leq -4 \cdot 10^{-6} \lor \neg \left(x \leq 4.8 \cdot 10^{-33}\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -3.99999999999999982e-6 or 4.8e-33 < x Initial program 100.0%
Taylor expanded in y around 0 99.1%
if -3.99999999999999982e-6 < x < 4.8e-33Initial program 99.9%
Taylor expanded in x around 0 99.8%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -115000000.0) (not (<= z 2.4e-6))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -115000000.0) || !(z <= 2.4e-6)) {
tmp = (x + 1.0) - (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 <= (-115000000.0d0)) .or. (.not. (z <= 2.4d-6))) then
tmp = (x + 1.0d0) - (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 <= -115000000.0) || !(z <= 2.4e-6)) {
tmp = (x + 1.0) - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -115000000.0) or not (z <= 2.4e-6): tmp = (x + 1.0) - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -115000000.0) || !(z <= 2.4e-6)) tmp = Float64(Float64(x + 1.0) - 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 <= -115000000.0) || ~((z <= 2.4e-6))) tmp = (x + 1.0) - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -115000000.0], N[Not[LessEqual[z, 2.4e-6]], $MachinePrecision]], N[(N[(x + 1.0), $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 -115000000 \lor \neg \left(z \leq 2.4 \cdot 10^{-6}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.15e8 or 2.3999999999999999e-6 < z Initial program 99.9%
Taylor expanded in y around 0 98.7%
if -1.15e8 < z < 2.3999999999999999e-6Initial program 100.0%
Taylor expanded in z around 0 100.0%
+-commutative100.0%
Simplified100.0%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -8.4e+77) (not (<= z 2.7e+128))) (- 1.0 (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8.4e+77) || !(z <= 2.7e+128)) {
tmp = 1.0 - (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 <= (-8.4d+77)) .or. (.not. (z <= 2.7d+128))) then
tmp = 1.0d0 - (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 <= -8.4e+77) || !(z <= 2.7e+128)) {
tmp = 1.0 - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8.4e+77) or not (z <= 2.7e+128): tmp = 1.0 - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8.4e+77) || !(z <= 2.7e+128)) tmp = Float64(1.0 - 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 <= -8.4e+77) || ~((z <= 2.7e+128))) tmp = 1.0 - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8.4e+77], N[Not[LessEqual[z, 2.7e+128]], $MachinePrecision]], N[(1.0 - 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 -8.4 \cdot 10^{+77} \lor \neg \left(z \leq 2.7 \cdot 10^{+128}\right):\\
\;\;\;\;1 - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -8.3999999999999995e77 or 2.70000000000000001e128 < z Initial program 99.9%
Taylor expanded in x around 0 72.2%
Taylor expanded in y around 0 72.2%
if -8.3999999999999995e77 < z < 2.70000000000000001e128Initial program 100.0%
Taylor expanded in z around 0 91.7%
+-commutative91.7%
Simplified91.7%
Final simplification85.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.6e+160) (not (<= z 1.02e+130))) (* z (- (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.6e+160) || !(z <= 1.02e+130)) {
tmp = 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 <= (-3.6d+160)) .or. (.not. (z <= 1.02d+130))) then
tmp = 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 <= -3.6e+160) || !(z <= 1.02e+130)) {
tmp = z * -Math.sin(y);
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.6e+160) or not (z <= 1.02e+130): tmp = z * -math.sin(y) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.6e+160) || !(z <= 1.02e+130)) tmp = Float64(z * Float64(-sin(y))); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.6e+160) || ~((z <= 1.02e+130))) tmp = z * -sin(y); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.6e+160], N[Not[LessEqual[z, 1.02e+130]], $MachinePrecision]], N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+160} \lor \neg \left(z \leq 1.02 \cdot 10^{+130}\right):\\
\;\;\;\;z \cdot \left(-\sin y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -3.60000000000000021e160 or 1.01999999999999999e130 < z Initial program 99.9%
Taylor expanded in z around inf 70.5%
mul-1-neg70.5%
distribute-rgt-neg-out70.5%
Simplified70.5%
if -3.60000000000000021e160 < z < 1.01999999999999999e130Initial program 100.0%
Taylor expanded in z around 0 89.6%
+-commutative89.6%
Simplified89.6%
Final simplification84.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.2e-6) (not (<= y 1.32e+14))) (+ x (cos y)) (+ 1.0 (+ x (* y (- (* y (* (* y z) 0.16666666666666666)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.2e-6) || !(y <= 1.32e+14)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * ((y * z) * 0.16666666666666666)) - 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 <= (-6.2d-6)) .or. (.not. (y <= 1.32d+14))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x + (y * ((y * ((y * z) * 0.16666666666666666d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.2e-6) || !(y <= 1.32e+14)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * ((y * z) * 0.16666666666666666)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.2e-6) or not (y <= 1.32e+14): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * ((y * z) * 0.16666666666666666)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.2e-6) || !(y <= 1.32e+14)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(y * z) * 0.16666666666666666)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.2e-6) || ~((y <= 1.32e+14))) tmp = x + cos(y); else tmp = 1.0 + (x + (y * ((y * ((y * z) * 0.16666666666666666)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.2e-6], N[Not[LessEqual[y, 1.32e+14]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(y * z), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-6} \lor \neg \left(y \leq 1.32 \cdot 10^{+14}\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(\left(y \cdot z\right) \cdot 0.16666666666666666\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -6.1999999999999999e-6 or 1.32e14 < y Initial program 99.9%
Taylor expanded in z around 0 68.2%
+-commutative68.2%
Simplified68.2%
if -6.1999999999999999e-6 < y < 1.32e14Initial program 100.0%
Taylor expanded in y around 0 97.1%
Taylor expanded in y around inf 97.1%
*-commutative97.1%
Simplified97.1%
Final simplification82.6%
(FPCore (x y z)
:precision binary64
(if (<= y -8200000000000.0)
(+ x 1.0)
(if (<= y 1.32e+14)
(+ 1.0 (+ x (* y (- (* y (- (* (* y z) 0.16666666666666666) 0.5)) z))))
(* x (+ 1.0 (/ 1.0 x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -8200000000000.0) {
tmp = x + 1.0;
} else if (y <= 1.32e+14) {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z)));
} else {
tmp = x * (1.0 + (1.0 / 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 <= (-8200000000000.0d0)) then
tmp = x + 1.0d0
else if (y <= 1.32d+14) then
tmp = 1.0d0 + (x + (y * ((y * (((y * z) * 0.16666666666666666d0) - 0.5d0)) - z)))
else
tmp = x * (1.0d0 + (1.0d0 / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -8200000000000.0) {
tmp = x + 1.0;
} else if (y <= 1.32e+14) {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z)));
} else {
tmp = x * (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -8200000000000.0: tmp = x + 1.0 elif y <= 1.32e+14: tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))) else: tmp = x * (1.0 + (1.0 / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -8200000000000.0) tmp = Float64(x + 1.0); elseif (y <= 1.32e+14) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(Float64(y * z) * 0.16666666666666666) - 0.5)) - z)))); else tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -8200000000000.0) tmp = x + 1.0; elseif (y <= 1.32e+14) tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))); else tmp = x * (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -8200000000000.0], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1.32e+14], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(N[(N[(y * z), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8200000000000:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 1.32 \cdot 10^{+14}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(\left(y \cdot z\right) \cdot 0.16666666666666666 - 0.5\right) - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\end{array}
\end{array}
if y < -8.2e12Initial program 99.9%
Taylor expanded in y around 0 48.4%
+-commutative48.4%
Simplified48.4%
if -8.2e12 < y < 1.32e14Initial program 100.0%
Taylor expanded in y around 0 96.5%
if 1.32e14 < y Initial program 99.9%
Taylor expanded in x around inf 83.5%
associate--l+83.5%
div-sub83.5%
Simplified83.5%
Taylor expanded in y around 0 47.2%
Final simplification72.5%
(FPCore (x y z)
:precision binary64
(if (<= y -1.1e+73)
(+ x 1.0)
(if (<= y 12000000.0)
(+ (+ x 1.0) (* y (- (* y -0.5) z)))
(* x (+ 1.0 (/ 1.0 x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.1e+73) {
tmp = x + 1.0;
} else if (y <= 12000000.0) {
tmp = (x + 1.0) + (y * ((y * -0.5) - z));
} else {
tmp = x * (1.0 + (1.0 / 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.1d+73)) then
tmp = x + 1.0d0
else if (y <= 12000000.0d0) then
tmp = (x + 1.0d0) + (y * ((y * (-0.5d0)) - z))
else
tmp = x * (1.0d0 + (1.0d0 / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.1e+73) {
tmp = x + 1.0;
} else if (y <= 12000000.0) {
tmp = (x + 1.0) + (y * ((y * -0.5) - z));
} else {
tmp = x * (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.1e+73: tmp = x + 1.0 elif y <= 12000000.0: tmp = (x + 1.0) + (y * ((y * -0.5) - z)) else: tmp = x * (1.0 + (1.0 / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.1e+73) tmp = Float64(x + 1.0); elseif (y <= 12000000.0) tmp = Float64(Float64(x + 1.0) + Float64(y * Float64(Float64(y * -0.5) - z))); else tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.1e+73) tmp = x + 1.0; elseif (y <= 12000000.0) tmp = (x + 1.0) + (y * ((y * -0.5) - z)); else tmp = x * (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.1e+73], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 12000000.0], N[(N[(x + 1.0), $MachinePrecision] + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{+73}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 12000000:\\
\;\;\;\;\left(x + 1\right) + y \cdot \left(y \cdot -0.5 - z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\end{array}
\end{array}
if y < -1.1e73Initial program 99.9%
Taylor expanded in y around 0 52.9%
+-commutative52.9%
Simplified52.9%
if -1.1e73 < y < 1.2e7Initial program 100.0%
Taylor expanded in y around 0 91.3%
associate-+r+91.3%
+-commutative91.3%
*-commutative91.3%
Simplified91.3%
if 1.2e7 < y Initial program 99.9%
Taylor expanded in x around inf 82.7%
associate--l+82.7%
div-sub82.7%
Simplified82.7%
Taylor expanded in y around 0 45.0%
(FPCore (x y z) :precision binary64 (if (<= y -2.05e+105) (+ x 1.0) (if (<= y 26000000.0) (+ 1.0 (- x (* y z))) (* x (+ 1.0 (/ 1.0 x))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.05e+105) {
tmp = x + 1.0;
} else if (y <= 26000000.0) {
tmp = 1.0 + (x - (y * z));
} else {
tmp = x * (1.0 + (1.0 / 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 <= (-2.05d+105)) then
tmp = x + 1.0d0
else if (y <= 26000000.0d0) then
tmp = 1.0d0 + (x - (y * z))
else
tmp = x * (1.0d0 + (1.0d0 / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.05e+105) {
tmp = x + 1.0;
} else if (y <= 26000000.0) {
tmp = 1.0 + (x - (y * z));
} else {
tmp = x * (1.0 + (1.0 / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.05e+105: tmp = x + 1.0 elif y <= 26000000.0: tmp = 1.0 + (x - (y * z)) else: tmp = x * (1.0 + (1.0 / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.05e+105) tmp = Float64(x + 1.0); elseif (y <= 26000000.0) tmp = Float64(1.0 + Float64(x - Float64(y * z))); else tmp = Float64(x * Float64(1.0 + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.05e+105) tmp = x + 1.0; elseif (y <= 26000000.0) tmp = 1.0 + (x - (y * z)); else tmp = x * (1.0 + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.05e+105], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 26000000.0], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{+105}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 26000000:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + \frac{1}{x}\right)\\
\end{array}
\end{array}
if y < -2.0500000000000001e105Initial program 99.9%
Taylor expanded in y around 0 54.9%
+-commutative54.9%
Simplified54.9%
if -2.0500000000000001e105 < y < 2.6e7Initial program 100.0%
Taylor expanded in y around 0 88.5%
mul-1-neg88.5%
unsub-neg88.5%
Simplified88.5%
if 2.6e7 < y Initial program 99.9%
Taylor expanded in x around inf 82.7%
associate--l+82.7%
div-sub82.7%
Simplified82.7%
Taylor expanded in y around 0 45.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -550000000000.0) (not (<= x 2600000.0))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -550000000000.0) || !(x <= 2600000.0)) {
tmp = x + 1.0;
} else {
tmp = 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 ((x <= (-550000000000.0d0)) .or. (.not. (x <= 2600000.0d0))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -550000000000.0) || !(x <= 2600000.0)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -550000000000.0) or not (x <= 2600000.0): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -550000000000.0) || !(x <= 2600000.0)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -550000000000.0) || ~((x <= 2600000.0))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -550000000000.0], N[Not[LessEqual[x, 2600000.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -550000000000 \lor \neg \left(x \leq 2600000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -5.5e11 or 2.6e6 < x Initial program 100.0%
Taylor expanded in y around 0 87.8%
+-commutative87.8%
Simplified87.8%
if -5.5e11 < x < 2.6e6Initial program 99.9%
Taylor expanded in x around 0 98.1%
Taylor expanded in y around 0 52.3%
mul-1-neg52.3%
unsub-neg52.3%
Simplified52.3%
Final simplification69.2%
(FPCore (x y z) :precision binary64 (if (<= x -550000000000.0) x (if (<= x 2600000.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -550000000000.0) {
tmp = x;
} else if (x <= 2600000.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 <= (-550000000000.0d0)) then
tmp = x
else if (x <= 2600000.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 <= -550000000000.0) {
tmp = x;
} else if (x <= 2600000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -550000000000.0: tmp = x elif x <= 2600000.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -550000000000.0) tmp = x; elseif (x <= 2600000.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -550000000000.0) tmp = x; elseif (x <= 2600000.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -550000000000.0], x, If[LessEqual[x, 2600000.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -550000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2600000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -5.5e11 or 2.6e6 < x Initial program 100.0%
Taylor expanded in x around inf 87.5%
if -5.5e11 < x < 2.6e6Initial program 99.9%
Taylor expanded in z around -inf 99.8%
mul-1-neg99.8%
distribute-rgt-neg-in99.8%
distribute-lft-out--99.8%
mul-1-neg99.8%
remove-double-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 42.3%
+-commutative42.3%
Simplified42.3%
Taylor expanded in x around 0 41.4%
(FPCore (x y z) :precision binary64 (if (<= z -1.4e+259) (* y (- z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.4e+259) {
tmp = 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 (z <= (-1.4d+259)) then
tmp = 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 (z <= -1.4e+259) {
tmp = y * -z;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.4e+259: tmp = y * -z else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.4e+259) tmp = Float64(y * Float64(-z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.4e+259) tmp = y * -z; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.4e+259], N[(y * (-z)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+259}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -1.4e259Initial program 99.9%
Taylor expanded in z around inf 99.9%
mul-1-neg99.9%
distribute-rgt-neg-out99.9%
Simplified99.9%
Taylor expanded in y around 0 49.0%
mul-1-neg49.0%
Simplified49.0%
if -1.4e259 < z Initial program 100.0%
Taylor expanded in y around 0 67.3%
+-commutative67.3%
Simplified67.3%
Final simplification66.4%
(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 100.0%
Taylor expanded in y around 0 64.0%
+-commutative64.0%
Simplified64.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 100.0%
Taylor expanded in z around -inf 86.3%
mul-1-neg86.3%
distribute-rgt-neg-in86.3%
distribute-lft-out--86.3%
mul-1-neg86.3%
remove-double-neg86.3%
+-commutative86.3%
Simplified86.3%
Taylor expanded in y around 0 50.5%
+-commutative50.5%
Simplified50.5%
Taylor expanded in x around 0 23.1%
herbie shell --seed 2024139
(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))))