
(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
(let* ((t_0 (* z (sin y))))
(if (or (<= x -3.7e-16) (not (<= x 2.65e-6)))
(- (+ 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 <= -3.7e-16) || !(x <= 2.65e-6)) {
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 <= (-3.7d-16)) .or. (.not. (x <= 2.65d-6))) 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 <= -3.7e-16) || !(x <= 2.65e-6)) {
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 <= -3.7e-16) or not (x <= 2.65e-6): 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 <= -3.7e-16) || !(x <= 2.65e-6)) 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 <= -3.7e-16) || ~((x <= 2.65e-6))) 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, -3.7e-16], N[Not[LessEqual[x, 2.65e-6]], $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 -3.7 \cdot 10^{-16} \lor \neg \left(x \leq 2.65 \cdot 10^{-6}\right):\\
\;\;\;\;\left(x + 1\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t_0\\
\end{array}
\end{array}
if x < -3.7e-16 or 2.65e-6 < x Initial program 99.9%
Taylor expanded in y around 0 98.7%
+-commutative98.7%
Simplified98.7%
if -3.7e-16 < x < 2.65e-6Initial program 99.9%
Taylor expanded in x around 0 99.6%
Final simplification99.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (* z (sin y)))))
(if (<= z -6e+57)
t_0
(if (<= z 1.2e+29)
(+ x (cos y))
(if (<= z 2.4e+73)
t_0
(if (<= z 3.95e+149)
(+ x 1.0)
(if (or (<= z 2.4e+220) (not (<= z 1.45e+249)))
t_0
(+ x (- 1.0 (* y z))))))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (z * sin(y));
double tmp;
if (z <= -6e+57) {
tmp = t_0;
} else if (z <= 1.2e+29) {
tmp = x + cos(y);
} else if (z <= 2.4e+73) {
tmp = t_0;
} else if (z <= 3.95e+149) {
tmp = x + 1.0;
} else if ((z <= 2.4e+220) || !(z <= 1.45e+249)) {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 - (z * sin(y))
if (z <= (-6d+57)) then
tmp = t_0
else if (z <= 1.2d+29) then
tmp = x + cos(y)
else if (z <= 2.4d+73) then
tmp = t_0
else if (z <= 3.95d+149) then
tmp = x + 1.0d0
else if ((z <= 2.4d+220) .or. (.not. (z <= 1.45d+249))) then
tmp = t_0
else
tmp = x + (1.0d0 - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 1.0 - (z * Math.sin(y));
double tmp;
if (z <= -6e+57) {
tmp = t_0;
} else if (z <= 1.2e+29) {
tmp = x + Math.cos(y);
} else if (z <= 2.4e+73) {
tmp = t_0;
} else if (z <= 3.95e+149) {
tmp = x + 1.0;
} else if ((z <= 2.4e+220) || !(z <= 1.45e+249)) {
tmp = t_0;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (z * math.sin(y)) tmp = 0 if z <= -6e+57: tmp = t_0 elif z <= 1.2e+29: tmp = x + math.cos(y) elif z <= 2.4e+73: tmp = t_0 elif z <= 3.95e+149: tmp = x + 1.0 elif (z <= 2.4e+220) or not (z <= 1.45e+249): tmp = t_0 else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(z * sin(y))) tmp = 0.0 if (z <= -6e+57) tmp = t_0; elseif (z <= 1.2e+29) tmp = Float64(x + cos(y)); elseif (z <= 2.4e+73) tmp = t_0; elseif (z <= 3.95e+149) tmp = Float64(x + 1.0); elseif ((z <= 2.4e+220) || !(z <= 1.45e+249)) tmp = t_0; else tmp = Float64(x + Float64(1.0 - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (z * sin(y)); tmp = 0.0; if (z <= -6e+57) tmp = t_0; elseif (z <= 1.2e+29) tmp = x + cos(y); elseif (z <= 2.4e+73) tmp = t_0; elseif (z <= 3.95e+149) tmp = x + 1.0; elseif ((z <= 2.4e+220) || ~((z <= 1.45e+249))) tmp = t_0; else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(1.0 - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6e+57], t$95$0, If[LessEqual[z, 1.2e+29], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.4e+73], t$95$0, If[LessEqual[z, 3.95e+149], N[(x + 1.0), $MachinePrecision], If[Or[LessEqual[z, 2.4e+220], N[Not[LessEqual[z, 1.45e+249]], $MachinePrecision]], t$95$0, N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - z \cdot \sin y\\
\mathbf{if}\;z \leq -6 \cdot 10^{+57}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+29}:\\
\;\;\;\;x + \cos y\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+73}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 3.95 \cdot 10^{+149}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+220} \lor \neg \left(z \leq 1.45 \cdot 10^{+249}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if z < -5.9999999999999999e57 or 1.2e29 < z < 2.40000000000000002e73 or 3.94999999999999982e149 < z < 2.3999999999999998e220 or 1.45000000000000008e249 < z Initial program 99.7%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around 0 80.4%
if -5.9999999999999999e57 < z < 1.2e29Initial program 100.0%
associate--l+100.0%
flip-+76.2%
pow176.2%
pow176.2%
pow-prod-up76.2%
metadata-eval76.2%
Applied egg-rr76.2%
clear-num76.0%
inv-pow76.0%
clear-num76.0%
unpow276.0%
flip-+99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 97.0%
if 2.40000000000000002e73 < z < 3.94999999999999982e149Initial program 99.9%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 74.5%
+-commutative74.5%
Simplified74.5%
if 2.3999999999999998e220 < z < 1.45000000000000008e249Initial program 100.0%
Taylor expanded in y around 0 91.5%
associate-+r+91.5%
+-commutative91.5%
mul-1-neg91.5%
unsub-neg91.5%
Simplified91.5%
Final simplification89.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) (- z))))
(if (<= z -2.5e+116)
t_0
(if (<= z 2.8e+30)
(+ x (cos y))
(if (or (<= z 4.4e+69) (not (<= z 3.8e+150))) t_0 (+ x 1.0))))))
double code(double x, double y, double z) {
double t_0 = sin(y) * -z;
double tmp;
if (z <= -2.5e+116) {
tmp = t_0;
} else if (z <= 2.8e+30) {
tmp = x + cos(y);
} else if ((z <= 4.4e+69) || !(z <= 3.8e+150)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = sin(y) * -z
if (z <= (-2.5d+116)) then
tmp = t_0
else if (z <= 2.8d+30) then
tmp = x + cos(y)
else if ((z <= 4.4d+69) .or. (.not. (z <= 3.8d+150))) then
tmp = t_0
else
tmp = x + 1.0d0
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 <= -2.5e+116) {
tmp = t_0;
} else if (z <= 2.8e+30) {
tmp = x + Math.cos(y);
} else if ((z <= 4.4e+69) || !(z <= 3.8e+150)) {
tmp = t_0;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * -z tmp = 0 if z <= -2.5e+116: tmp = t_0 elif z <= 2.8e+30: tmp = x + math.cos(y) elif (z <= 4.4e+69) or not (z <= 3.8e+150): tmp = t_0 else: tmp = x + 1.0 return tmp
function code(x, y, z) t_0 = Float64(sin(y) * Float64(-z)) tmp = 0.0 if (z <= -2.5e+116) tmp = t_0; elseif (z <= 2.8e+30) tmp = Float64(x + cos(y)); elseif ((z <= 4.4e+69) || !(z <= 3.8e+150)) tmp = t_0; else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * -z; tmp = 0.0; if (z <= -2.5e+116) tmp = t_0; elseif (z <= 2.8e+30) tmp = x + cos(y); elseif ((z <= 4.4e+69) || ~((z <= 3.8e+150))) tmp = t_0; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision]}, If[LessEqual[z, -2.5e+116], t$95$0, If[LessEqual[z, 2.8e+30], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 4.4e+69], N[Not[LessEqual[z, 3.8e+150]], $MachinePrecision]], t$95$0, N[(x + 1.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+116}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+30}:\\
\;\;\;\;x + \cos y\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+69} \lor \neg \left(z \leq 3.8 \cdot 10^{+150}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -2.50000000000000013e116 or 2.79999999999999983e30 < z < 4.4000000000000003e69 or 3.79999999999999989e150 < z Initial program 99.8%
Taylor expanded in z around inf 70.6%
associate-*r*70.6%
neg-mul-170.6%
*-commutative70.6%
Simplified70.6%
if -2.50000000000000013e116 < z < 2.79999999999999983e30Initial program 100.0%
associate--l+100.0%
flip-+77.2%
pow177.2%
pow177.2%
pow-prod-up77.2%
metadata-eval77.2%
Applied egg-rr77.2%
clear-num76.9%
inv-pow76.9%
clear-num77.0%
unpow277.0%
flip-+99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 95.8%
if 4.4000000000000003e69 < z < 3.79999999999999989e150Initial program 99.9%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 74.5%
+-commutative74.5%
Simplified74.5%
Final simplification85.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -22.5) (not (<= z 6e-26))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -22.5) || !(z <= 6e-26)) {
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 <= (-22.5d0)) .or. (.not. (z <= 6d-26))) 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 <= -22.5) || !(z <= 6e-26)) {
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 <= -22.5) or not (z <= 6e-26): 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 <= -22.5) || !(z <= 6e-26)) 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 <= -22.5) || ~((z <= 6e-26))) 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, -22.5], N[Not[LessEqual[z, 6e-26]], $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 -22.5 \lor \neg \left(z \leq 6 \cdot 10^{-26}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -22.5 or 6.00000000000000023e-26 < z Initial program 99.8%
Taylor expanded in y around 0 98.0%
+-commutative98.0%
Simplified98.0%
if -22.5 < z < 6.00000000000000023e-26Initial program 100.0%
associate--l+100.0%
flip-+78.8%
pow178.8%
pow178.8%
pow-prod-up78.8%
metadata-eval78.8%
Applied egg-rr78.8%
clear-num78.5%
inv-pow78.5%
clear-num78.6%
unpow278.6%
flip-+99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 99.5%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -1400000000.0) (not (<= z 8e+29))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1400000000.0) || !(z <= 8e+29)) {
tmp = 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 <= (-1400000000.0d0)) .or. (.not. (z <= 8d+29))) then
tmp = 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 <= -1400000000.0) || !(z <= 8e+29)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1400000000.0) or not (z <= 8e+29): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1400000000.0) || !(z <= 8e+29)) tmp = Float64(x - 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 <= -1400000000.0) || ~((z <= 8e+29))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1400000000.0], N[Not[LessEqual[z, 8e+29]], $MachinePrecision]], N[(x - 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 -1400000000 \lor \neg \left(z \leq 8 \cdot 10^{+29}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.4e9 or 7.99999999999999931e29 < z Initial program 99.8%
Taylor expanded in x around inf 89.9%
if -1.4e9 < z < 7.99999999999999931e29Initial program 100.0%
associate--l+100.0%
flip-+78.8%
pow178.8%
pow178.8%
pow-prod-up78.8%
metadata-eval78.8%
Applied egg-rr78.8%
clear-num78.5%
inv-pow78.5%
clear-num78.6%
unpow278.6%
flip-+99.6%
Applied egg-rr99.6%
Taylor expanded in z around 0 97.6%
Final simplification94.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.5e+23) (not (<= y 7.8e-16))) (+ x (cos y)) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.5e+23) || !(y <= 7.8e-16)) {
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 <= (-4.5d+23)) .or. (.not. (y <= 7.8d-16))) 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 <= -4.5e+23) || !(y <= 7.8e-16)) {
tmp = x + Math.cos(y);
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.5e+23) or not (y <= 7.8e-16): tmp = x + math.cos(y) else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.5e+23) || !(y <= 7.8e-16)) 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 <= -4.5e+23) || ~((y <= 7.8e-16))) tmp = x + cos(y); else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.5e+23], N[Not[LessEqual[y, 7.8e-16]], $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 -4.5 \cdot 10^{+23} \lor \neg \left(y \leq 7.8 \cdot 10^{-16}\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -4.49999999999999979e23 or 7.79999999999999954e-16 < y Initial program 99.8%
associate--l+99.8%
flip-+58.1%
pow158.1%
pow158.1%
pow-prod-up58.1%
metadata-eval58.1%
Applied egg-rr58.1%
clear-num57.8%
inv-pow57.8%
clear-num57.8%
unpow257.8%
flip-+99.5%
Applied egg-rr99.5%
Taylor expanded in z around 0 62.7%
if -4.49999999999999979e23 < y < 7.79999999999999954e-16Initial program 100.0%
Taylor expanded in y around 0 96.1%
associate-+r+96.1%
+-commutative96.1%
mul-1-neg96.1%
unsub-neg96.1%
Simplified96.1%
Final simplification79.4%
(FPCore (x y z) :precision binary64 (if (<= y -2.15e+60) (+ x 1.0) (if (<= y 1.16e+77) (+ x (- 1.0 (* y z))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.15e+60) {
tmp = x + 1.0;
} else if (y <= 1.16e+77) {
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.15d+60)) then
tmp = x + 1.0d0
else if (y <= 1.16d+77) 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.15e+60) {
tmp = x + 1.0;
} else if (y <= 1.16e+77) {
tmp = x + (1.0 - (y * z));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.15e+60: tmp = x + 1.0 elif y <= 1.16e+77: tmp = x + (1.0 - (y * z)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.15e+60) tmp = Float64(x + 1.0); elseif (y <= 1.16e+77) tmp = Float64(x + 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 (y <= -2.15e+60) tmp = x + 1.0; elseif (y <= 1.16e+77) tmp = x + (1.0 - (y * z)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.15e+60], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1.16e+77], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+60}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 1.16 \cdot 10^{+77}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -2.14999999999999986e60 or 1.1600000000000001e77 < y Initial program 99.8%
Taylor expanded in y around 0 71.3%
+-commutative71.3%
Simplified71.3%
Taylor expanded in z around 0 34.3%
+-commutative34.3%
Simplified34.3%
if -2.14999999999999986e60 < y < 1.1600000000000001e77Initial program 100.0%
Taylor expanded in y around 0 86.9%
associate-+r+86.9%
+-commutative86.9%
mul-1-neg86.9%
unsub-neg86.9%
Simplified86.9%
Final simplification66.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.7e+126) (not (<= z 7.2e+191))) (- x (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.7e+126) || !(z <= 7.2e+191)) {
tmp = x - (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 <= (-3.7d+126)) .or. (.not. (z <= 7.2d+191))) then
tmp = x - (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 <= -3.7e+126) || !(z <= 7.2e+191)) {
tmp = x - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.7e+126) or not (z <= 7.2e+191): tmp = x - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.7e+126) || !(z <= 7.2e+191)) tmp = Float64(x - Float64(y * z)); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.7e+126) || ~((z <= 7.2e+191))) tmp = x - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.7e+126], N[Not[LessEqual[z, 7.2e+191]], $MachinePrecision]], N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+126} \lor \neg \left(z \leq 7.2 \cdot 10^{+191}\right):\\
\;\;\;\;x - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -3.6999999999999998e126 or 7.1999999999999999e191 < z Initial program 99.8%
Taylor expanded in y around 0 53.4%
Taylor expanded in x around inf 47.3%
if -3.6999999999999998e126 < z < 7.1999999999999999e191Initial program 99.9%
Taylor expanded in y around 0 79.9%
+-commutative79.9%
Simplified79.9%
Taylor expanded in z around 0 67.7%
+-commutative67.7%
Simplified67.7%
Final simplification62.1%
(FPCore (x y z) :precision binary64 (if (<= x -3.7e-16) (+ x 1.0) (if (<= x 1.1e-39) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.7e-16) {
tmp = x + 1.0;
} else if (x <= 1.1e-39) {
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 <= (-3.7d-16)) then
tmp = x + 1.0d0
else if (x <= 1.1d-39) 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 <= -3.7e-16) {
tmp = x + 1.0;
} else if (x <= 1.1e-39) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.7e-16: tmp = x + 1.0 elif x <= 1.1e-39: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.7e-16) tmp = Float64(x + 1.0); elseif (x <= 1.1e-39) 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 <= -3.7e-16) tmp = x + 1.0; elseif (x <= 1.1e-39) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.7e-16], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 1.1e-39], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.7 \cdot 10^{-16}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-39}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -3.7e-16 or 1.1e-39 < x Initial program 99.9%
Taylor expanded in y around 0 97.5%
+-commutative97.5%
Simplified97.5%
Taylor expanded in z around 0 72.1%
+-commutative72.1%
Simplified72.1%
if -3.7e-16 < x < 1.1e-39Initial program 99.9%
Taylor expanded in y around 0 74.0%
+-commutative74.0%
Simplified74.0%
Taylor expanded in x around 0 74.0%
Taylor expanded in y around 0 52.6%
Final simplification62.0%
(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 85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in z around 0 56.5%
+-commutative56.5%
Simplified56.5%
Final simplification56.5%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
associate--l+99.9%
flip-+65.1%
pow165.1%
pow165.1%
pow-prod-up65.1%
metadata-eval65.1%
Applied egg-rr65.1%
Taylor expanded in z around inf 99.9%
Taylor expanded in x around inf 35.1%
Final simplification35.1%
herbie shell --seed 2023196
(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))))