
(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 -132000000.0) (not (<= x 1e-15)))
(- (+ 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 <= -132000000.0) || !(x <= 1e-15)) {
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 <= (-132000000.0d0)) .or. (.not. (x <= 1d-15))) 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 <= -132000000.0) || !(x <= 1e-15)) {
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 <= -132000000.0) or not (x <= 1e-15): 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 <= -132000000.0) || !(x <= 1e-15)) 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 <= -132000000.0) || ~((x <= 1e-15))) 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, -132000000.0], N[Not[LessEqual[x, 1e-15]], $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 -132000000 \lor \neg \left(x \leq 10^{-15}\right):\\
\;\;\;\;\left(x + 1\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t_0\\
\end{array}
\end{array}
if x < -1.32e8 or 1.0000000000000001e-15 < x Initial program 100.0%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
Simplified99.7%
if -1.32e8 < x < 1.0000000000000001e-15Initial program 99.9%
Taylor expanded in x around 0 99.2%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.5e+34) (not (<= z 9e-11))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.5e+34) || !(z <= 9e-11)) {
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 <= (-3.5d+34)) .or. (.not. (z <= 9d-11))) 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 <= -3.5e+34) || !(z <= 9e-11)) {
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 <= -3.5e+34) or not (z <= 9e-11): 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 <= -3.5e+34) || !(z <= 9e-11)) 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 <= -3.5e+34) || ~((z <= 9e-11))) 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, -3.5e+34], N[Not[LessEqual[z, 9e-11]], $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 -3.5 \cdot 10^{+34} \lor \neg \left(z \leq 9 \cdot 10^{-11}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -3.49999999999999998e34 or 8.9999999999999999e-11 < z Initial program 99.9%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
Simplified99.3%
if -3.49999999999999998e34 < z < 8.9999999999999999e-11Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
distribute-lft-neg-in100.0%
add-cube-cbrt100.0%
associate-*r*100.0%
fma-def100.0%
pow2100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 99.5%
Final simplification99.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.6e+40) (not (<= z 5.4e+81))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.6e+40) || !(z <= 5.4e+81)) {
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 <= (-1.6d+40)) .or. (.not. (z <= 5.4d+81))) 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 <= -1.6e+40) || !(z <= 5.4e+81)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.6e+40) or not (z <= 5.4e+81): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.6e+40) || !(z <= 5.4e+81)) 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 <= -1.6e+40) || ~((z <= 5.4e+81))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.6e+40], N[Not[LessEqual[z, 5.4e+81]], $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 -1.6 \cdot 10^{+40} \lor \neg \left(z \leq 5.4 \cdot 10^{+81}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.5999999999999999e40 or 5.3999999999999999e81 < z Initial program 99.9%
Taylor expanded in x around inf 95.5%
if -1.5999999999999999e40 < z < 5.3999999999999999e81Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
distribute-lft-neg-in100.0%
add-cube-cbrt99.9%
associate-*r*99.9%
fma-def99.9%
pow299.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 95.7%
Final simplification95.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -6.8e+146) (not (<= z 1.15e+117))) (* (sin y) (- z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.8e+146) || !(z <= 1.15e+117)) {
tmp = 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 ((z <= (-6.8d+146)) .or. (.not. (z <= 1.15d+117))) then
tmp = 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 ((z <= -6.8e+146) || !(z <= 1.15e+117)) {
tmp = Math.sin(y) * -z;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.8e+146) or not (z <= 1.15e+117): tmp = math.sin(y) * -z else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.8e+146) || !(z <= 1.15e+117)) tmp = Float64(sin(y) * Float64(-z)); else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.8e+146) || ~((z <= 1.15e+117))) tmp = sin(y) * -z; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.8e+146], N[Not[LessEqual[z, 1.15e+117]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{+146} \lor \neg \left(z \leq 1.15 \cdot 10^{+117}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -6.79999999999999981e146 or 1.14999999999999994e117 < z Initial program 99.9%
Taylor expanded in z around inf 72.6%
associate-*r*72.6%
neg-mul-172.6%
*-commutative72.6%
Simplified72.6%
if -6.79999999999999981e146 < z < 1.14999999999999994e117Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
distribute-lft-neg-in100.0%
add-cube-cbrt99.9%
associate-*r*99.9%
fma-def99.9%
pow299.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 93.2%
Final simplification86.3%
(FPCore (x y z) :precision binary64 (if (or (<= y -7.2e+20) (not (<= y 2.5e-5))) (+ x (cos y)) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -7.2e+20) || !(y <= 2.5e-5)) {
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 <= (-7.2d+20)) .or. (.not. (y <= 2.5d-5))) 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 <= -7.2e+20) || !(y <= 2.5e-5)) {
tmp = x + Math.cos(y);
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -7.2e+20) or not (y <= 2.5e-5): tmp = x + math.cos(y) else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -7.2e+20) || !(y <= 2.5e-5)) 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 <= -7.2e+20) || ~((y <= 2.5e-5))) tmp = x + cos(y); else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -7.2e+20], N[Not[LessEqual[y, 2.5e-5]], $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 -7.2 \cdot 10^{+20} \lor \neg \left(y \leq 2.5 \cdot 10^{-5}\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -7.2e20 or 2.50000000000000012e-5 < y Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.1%
associate-*r*99.1%
fma-def99.1%
pow299.1%
Applied egg-rr99.1%
Taylor expanded in z around 0 53.8%
if -7.2e20 < y < 2.50000000000000012e-5Initial program 100.0%
Taylor expanded in y around 0 98.7%
associate-+r+98.7%
+-commutative98.7%
mul-1-neg98.7%
unsub-neg98.7%
Simplified98.7%
Final simplification79.2%
(FPCore (x y z) :precision binary64 (if (<= y -1e+21) (+ x 1.0) (if (<= y 1.6e+52) (+ x (- 1.0 (* y z))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1e+21) {
tmp = x + 1.0;
} else if (y <= 1.6e+52) {
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 <= (-1d+21)) then
tmp = x + 1.0d0
else if (y <= 1.6d+52) 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 <= -1e+21) {
tmp = x + 1.0;
} else if (y <= 1.6e+52) {
tmp = x + (1.0 - (y * z));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1e+21: tmp = x + 1.0 elif y <= 1.6e+52: tmp = x + (1.0 - (y * z)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1e+21) tmp = Float64(x + 1.0); elseif (y <= 1.6e+52) 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 <= -1e+21) tmp = x + 1.0; elseif (y <= 1.6e+52) tmp = x + (1.0 - (y * z)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1e+21], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 1.6e+52], 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 -1 \cdot 10^{+21}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+52}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -1e21 or 1.6e52 < y Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.1%
associate-*r*99.2%
fma-def99.2%
pow299.2%
Applied egg-rr99.2%
Taylor expanded in y around 0 36.2%
if -1e21 < y < 1.6e52Initial program 100.0%
Taylor expanded in y around 0 94.5%
associate-+r+94.5%
+-commutative94.5%
mul-1-neg94.5%
unsub-neg94.5%
Simplified94.5%
Final simplification71.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.15e+220) (not (<= z 6.4e+93))) (- x (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.15e+220) || !(z <= 6.4e+93)) {
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 <= (-2.15d+220)) .or. (.not. (z <= 6.4d+93))) 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 <= -2.15e+220) || !(z <= 6.4e+93)) {
tmp = x - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.15e+220) or not (z <= 6.4e+93): tmp = x - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.15e+220) || !(z <= 6.4e+93)) 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 <= -2.15e+220) || ~((z <= 6.4e+93))) tmp = x - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.15e+220], N[Not[LessEqual[z, 6.4e+93]], $MachinePrecision]], N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.15 \cdot 10^{+220} \lor \neg \left(z \leq 6.4 \cdot 10^{+93}\right):\\
\;\;\;\;x - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -2.15e220 or 6.4000000000000003e93 < z Initial program 99.9%
Taylor expanded in x around inf 97.7%
Taylor expanded in y around 0 49.3%
if -2.15e220 < z < 6.4000000000000003e93Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
distribute-lft-neg-in100.0%
add-cube-cbrt99.7%
associate-*r*99.7%
fma-def99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 77.3%
Final simplification70.2%
(FPCore (x y z) :precision binary64 (if (<= x -132000000.0) (+ x 1.0) (if (<= x 2.1e-8) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -132000000.0) {
tmp = x + 1.0;
} else if (x <= 2.1e-8) {
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 <= (-132000000.0d0)) then
tmp = x + 1.0d0
else if (x <= 2.1d-8) 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 <= -132000000.0) {
tmp = x + 1.0;
} else if (x <= 2.1e-8) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -132000000.0: tmp = x + 1.0 elif x <= 2.1e-8: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -132000000.0) tmp = Float64(x + 1.0); elseif (x <= 2.1e-8) 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 <= -132000000.0) tmp = x + 1.0; elseif (x <= 2.1e-8) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -132000000.0], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 2.1e-8], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -132000000:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-8}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.32e8 or 2.09999999999999994e-8 < x Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
distribute-lft-neg-in100.0%
add-cube-cbrt99.7%
associate-*r*99.7%
fma-def99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in y around 0 80.6%
if -1.32e8 < x < 2.09999999999999994e-8Initial program 99.9%
Taylor expanded in x around 0 99.2%
Taylor expanded in y around 0 54.6%
mul-1-neg54.6%
unsub-neg54.6%
Simplified54.6%
Final simplification68.8%
(FPCore (x y z) :precision binary64 (if (<= x -132000000.0) x (if (<= x 315000.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -132000000.0) {
tmp = x;
} else if (x <= 315000.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 <= (-132000000.0d0)) then
tmp = x
else if (x <= 315000.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 <= -132000000.0) {
tmp = x;
} else if (x <= 315000.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -132000000.0: tmp = x elif x <= 315000.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -132000000.0) tmp = x; elseif (x <= 315000.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -132000000.0) tmp = x; elseif (x <= 315000.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -132000000.0], x, If[LessEqual[x, 315000.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -132000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 315000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.32e8 or 315000 < x Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
distribute-lft-neg-in100.0%
add-cube-cbrt99.7%
associate-*r*99.7%
fma-def99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in x around inf 80.9%
if -1.32e8 < x < 315000Initial program 99.9%
Taylor expanded in x around 0 97.7%
Taylor expanded in y around 0 43.5%
Final simplification63.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 99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.5%
associate-*r*99.4%
fma-def99.4%
pow299.4%
Applied egg-rr99.4%
Taylor expanded in y around 0 64.1%
Final simplification64.1%
(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 56.8%
Taylor expanded in y around 0 22.0%
Final simplification22.0%
herbie shell --seed 2023224
(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))))