
(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 99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -6e+24) (not (<= x 0.88))) (* x (- 1.0 (* z (/ (sin y) x)))) (- (cos y) (* z (sin y)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6e+24) || !(x <= 0.88)) {
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 <= (-6d+24)) .or. (.not. (x <= 0.88d0))) 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 <= -6e+24) || !(x <= 0.88)) {
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 <= -6e+24) or not (x <= 0.88): 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 <= -6e+24) || !(x <= 0.88)) 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 <= -6e+24) || ~((x <= 0.88))) 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, -6e+24], N[Not[LessEqual[x, 0.88]], $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 -6 \cdot 10^{+24} \lor \neg \left(x \leq 0.88\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 < -5.9999999999999999e24 or 0.880000000000000004 < x Initial program 99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-neg-in99.9%
add-cube-cbrt99.5%
associate-*r*99.6%
fma-define99.6%
pow299.6%
Applied egg-rr99.6%
Taylor expanded in x around inf 99.9%
+-commutative99.9%
mul-1-neg99.9%
sub-neg99.9%
*-commutative99.9%
div-sub99.9%
Simplified99.9%
Taylor expanded in z around inf 99.5%
mul-1-neg99.5%
associate-/l*99.5%
distribute-rgt-neg-in99.5%
distribute-neg-frac299.5%
Simplified99.5%
if -5.9999999999999999e24 < x < 0.880000000000000004Initial program 99.9%
Taylor expanded in x around 0 98.8%
Final simplification99.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- (sin y)))))
(if (<= z -7e+202)
t_0
(if (<= z -7.8e+64)
(+ x (- 1.0 (* y z)))
(if (or (<= z -1.6e+54) (not (<= z 4.6e+70))) t_0 (+ x (cos y)))))))
double code(double x, double y, double z) {
double t_0 = z * -sin(y);
double tmp;
if (z <= -7e+202) {
tmp = t_0;
} else if (z <= -7.8e+64) {
tmp = x + (1.0 - (y * z));
} else if ((z <= -1.6e+54) || !(z <= 4.6e+70)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = z * -sin(y)
if (z <= (-7d+202)) then
tmp = t_0
else if (z <= (-7.8d+64)) then
tmp = x + (1.0d0 - (y * z))
else if ((z <= (-1.6d+54)) .or. (.not. (z <= 4.6d+70))) then
tmp = t_0
else
tmp = x + cos(y)
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 (z <= -7e+202) {
tmp = t_0;
} else if (z <= -7.8e+64) {
tmp = x + (1.0 - (y * z));
} else if ((z <= -1.6e+54) || !(z <= 4.6e+70)) {
tmp = t_0;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): t_0 = z * -math.sin(y) tmp = 0 if z <= -7e+202: tmp = t_0 elif z <= -7.8e+64: tmp = x + (1.0 - (y * z)) elif (z <= -1.6e+54) or not (z <= 4.6e+70): tmp = t_0 else: tmp = x + math.cos(y) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(-sin(y))) tmp = 0.0 if (z <= -7e+202) tmp = t_0; elseif (z <= -7.8e+64) tmp = Float64(x + Float64(1.0 - Float64(y * z))); elseif ((z <= -1.6e+54) || !(z <= 4.6e+70)) tmp = t_0; else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * -sin(y); tmp = 0.0; if (z <= -7e+202) tmp = t_0; elseif (z <= -7.8e+64) tmp = x + (1.0 - (y * z)); elseif ((z <= -1.6e+54) || ~((z <= 4.6e+70))) tmp = t_0; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * (-N[Sin[y], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[z, -7e+202], t$95$0, If[LessEqual[z, -7.8e+64], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.6e+54], N[Not[LessEqual[z, 4.6e+70]], $MachinePrecision]], t$95$0, N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(-\sin y\right)\\
\mathbf{if}\;z \leq -7 \cdot 10^{+202}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -7.8 \cdot 10^{+64}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{+54} \lor \neg \left(z \leq 4.6 \cdot 10^{+70}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -6.99999999999999975e202 or -7.7999999999999996e64 < z < -1.6e54 or 4.59999999999999987e70 < z Initial program 99.7%
Taylor expanded in z around inf 81.2%
associate-*r*81.2%
neg-mul-181.2%
*-commutative81.2%
Simplified81.2%
if -6.99999999999999975e202 < z < -7.7999999999999996e64Initial program 99.9%
Taylor expanded in y around 0 65.2%
associate-+r+65.2%
+-commutative65.2%
associate-+l+65.2%
mul-1-neg65.2%
unsub-neg65.2%
Simplified65.2%
if -1.6e54 < z < 4.59999999999999987e70Initial program 100.0%
Taylor expanded in z around 0 95.2%
+-commutative95.2%
Simplified95.2%
Final simplification88.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -0.00325) (not (<= y 4.1e-8))) (* x (- 1.0 (* z (/ (sin y) x)))) (+ 1.0 (fma y (- (* y -0.5) z) x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -0.00325) || !(y <= 4.1e-8)) {
tmp = x * (1.0 - (z * (sin(y) / x)));
} else {
tmp = 1.0 + fma(y, ((y * -0.5) - z), x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((y <= -0.00325) || !(y <= 4.1e-8)) tmp = Float64(x * Float64(1.0 - Float64(z * Float64(sin(y) / x)))); else tmp = Float64(1.0 + fma(y, Float64(Float64(y * -0.5) - z), x)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[y, -0.00325], N[Not[LessEqual[y, 4.1e-8]], $MachinePrecision]], N[(x * N[(1.0 - N[(z * N[(N[Sin[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.00325 \lor \neg \left(y \leq 4.1 \cdot 10^{-8}\right):\\
\;\;\;\;x \cdot \left(1 - z \cdot \frac{\sin y}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;1 + \mathsf{fma}\left(y, y \cdot -0.5 - z, x\right)\\
\end{array}
\end{array}
if y < -0.00324999999999999985 or 4.10000000000000032e-8 < y Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
distribute-lft-neg-in99.8%
add-cube-cbrt99.0%
associate-*r*99.0%
fma-define99.0%
pow299.0%
Applied egg-rr99.0%
Taylor expanded in x around inf 88.1%
+-commutative88.1%
mul-1-neg88.1%
sub-neg88.1%
*-commutative88.1%
div-sub88.1%
Simplified88.1%
Taylor expanded in z around inf 69.6%
mul-1-neg69.6%
associate-/l*69.6%
distribute-rgt-neg-in69.6%
distribute-neg-frac269.6%
Simplified69.6%
if -0.00324999999999999985 < y < 4.10000000000000032e-8Initial program 100.0%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
fma-define100.0%
*-commutative100.0%
Simplified100.0%
Final simplification85.6%
(FPCore (x y z)
:precision binary64
(if (<= y -0.0035)
(* x (- 1.0 (* (sin y) (/ z x))))
(if (<= y 4.1e-8)
(+ 1.0 (fma y (- (* y -0.5) z) x))
(* x (- 1.0 (* z (/ (sin y) x)))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -0.0035) {
tmp = x * (1.0 - (sin(y) * (z / x)));
} else if (y <= 4.1e-8) {
tmp = 1.0 + fma(y, ((y * -0.5) - z), x);
} else {
tmp = x * (1.0 - (z * (sin(y) / x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -0.0035) tmp = Float64(x * Float64(1.0 - Float64(sin(y) * Float64(z / x)))); elseif (y <= 4.1e-8) tmp = Float64(1.0 + fma(y, Float64(Float64(y * -0.5) - z), x)); else tmp = Float64(x * Float64(1.0 - Float64(z * Float64(sin(y) / x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -0.0035], N[(x * N[(1.0 - N[(N[Sin[y], $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e-8], N[(1.0 + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z * N[(N[Sin[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -0.0035:\\
\;\;\;\;x \cdot \left(1 - \sin y \cdot \frac{z}{x}\right)\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-8}:\\
\;\;\;\;1 + \mathsf{fma}\left(y, y \cdot -0.5 - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - z \cdot \frac{\sin y}{x}\right)\\
\end{array}
\end{array}
if y < -0.00350000000000000007Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
distribute-lft-neg-in99.7%
add-cube-cbrt98.8%
associate-*r*98.9%
fma-define98.9%
pow298.9%
Applied egg-rr98.9%
Taylor expanded in x around inf 88.3%
+-commutative88.3%
mul-1-neg88.3%
sub-neg88.3%
*-commutative88.3%
div-sub88.3%
Simplified88.3%
Taylor expanded in z around inf 76.7%
*-commutative76.7%
associate-*r/76.7%
neg-mul-176.7%
distribute-rgt-neg-in76.7%
distribute-frac-neg76.7%
Simplified76.7%
if -0.00350000000000000007 < y < 4.10000000000000032e-8Initial program 100.0%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
fma-define100.0%
*-commutative100.0%
Simplified100.0%
if 4.10000000000000032e-8 < y Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
distribute-lft-neg-in99.8%
add-cube-cbrt99.2%
associate-*r*99.2%
fma-define99.2%
pow299.2%
Applied egg-rr99.2%
Taylor expanded in x around inf 87.9%
+-commutative87.9%
mul-1-neg87.9%
sub-neg87.9%
*-commutative87.9%
div-sub87.9%
Simplified87.9%
Taylor expanded in z around inf 61.1%
mul-1-neg61.1%
associate-/l*61.0%
distribute-rgt-neg-in61.0%
distribute-neg-frac261.0%
Simplified61.0%
Final simplification85.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.15e+19) (not (<= y 11000000.0))) (+ x (cos y)) (+ 1.0 (+ x (* y (- (* y (- (* (* y z) 0.16666666666666666) 0.5)) z))))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.15e+19) || !(y <= 11000000.0)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 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 <= (-3.15d+19)) .or. (.not. (y <= 11000000.0d0))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x + (y * ((y * (((y * z) * 0.16666666666666666d0) - 0.5d0)) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -3.15e+19) || !(y <= 11000000.0)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.15e+19) or not (y <= 11000000.0): tmp = x + math.cos(y) else: tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.15e+19) || !(y <= 11000000.0)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(Float64(Float64(y * z) * 0.16666666666666666) - 0.5)) - z)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.15e+19) || ~((y <= 11000000.0))) tmp = x + cos(y); else tmp = 1.0 + (x + (y * ((y * (((y * z) * 0.16666666666666666) - 0.5)) - z))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.15e+19], N[Not[LessEqual[y, 11000000.0]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.15 \cdot 10^{+19} \lor \neg \left(y \leq 11000000\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(\left(y \cdot z\right) \cdot 0.16666666666666666 - 0.5\right) - z\right)\right)\\
\end{array}
\end{array}
if y < -3.15e19 or 1.1e7 < y Initial program 99.8%
Taylor expanded in z around 0 52.7%
+-commutative52.7%
Simplified52.7%
if -3.15e19 < y < 1.1e7Initial program 100.0%
Taylor expanded in y around 0 97.0%
Final simplification77.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.3e+112) (not (<= z 1.05e+61))) (+ 1.0 (+ x (* y (- (* y -0.5) z)))) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.3e+112) || !(z <= 1.05e+61)) {
tmp = 1.0 + (x + (y * ((y * -0.5) - 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.3d+112)) .or. (.not. (z <= 1.05d+61))) then
tmp = 1.0d0 + (x + (y * ((y * (-0.5d0)) - 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.3e+112) || !(z <= 1.05e+61)) {
tmp = 1.0 + (x + (y * ((y * -0.5) - z)));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.3e+112) or not (z <= 1.05e+61): tmp = 1.0 + (x + (y * ((y * -0.5) - z))) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.3e+112) || !(z <= 1.05e+61)) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * -0.5) - z)))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.3e+112) || ~((z <= 1.05e+61))) tmp = 1.0 + (x + (y * ((y * -0.5) - z))); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.3e+112], N[Not[LessEqual[z, 1.05e+61]], $MachinePrecision]], N[(1.0 + N[(x + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{+112} \lor \neg \left(z \leq 1.05 \cdot 10^{+61}\right):\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot -0.5 - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -1.3e112 or 1.0500000000000001e61 < z Initial program 99.7%
Taylor expanded in y around 0 49.4%
if -1.3e112 < z < 1.0500000000000001e61Initial program 100.0%
Taylor expanded in y around 0 80.1%
+-commutative80.1%
Simplified80.1%
Final simplification69.1%
(FPCore (x y z) :precision binary64 (if (<= z -1.8e+112) (+ x (- 1.0 (* y z))) (if (<= z 1.9e+60) (+ x 1.0) (* z (- (/ (+ x 1.0) z) y)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.8e+112) {
tmp = x + (1.0 - (y * z));
} else if (z <= 1.9e+60) {
tmp = x + 1.0;
} else {
tmp = z * (((x + 1.0) / 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 <= (-1.8d+112)) then
tmp = x + (1.0d0 - (y * z))
else if (z <= 1.9d+60) then
tmp = x + 1.0d0
else
tmp = z * (((x + 1.0d0) / z) - y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.8e+112) {
tmp = x + (1.0 - (y * z));
} else if (z <= 1.9e+60) {
tmp = x + 1.0;
} else {
tmp = z * (((x + 1.0) / z) - y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.8e+112: tmp = x + (1.0 - (y * z)) elif z <= 1.9e+60: tmp = x + 1.0 else: tmp = z * (((x + 1.0) / z) - y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.8e+112) tmp = Float64(x + Float64(1.0 - Float64(y * z))); elseif (z <= 1.9e+60) tmp = Float64(x + 1.0); else tmp = Float64(z * Float64(Float64(Float64(x + 1.0) / z) - y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.8e+112) tmp = x + (1.0 - (y * z)); elseif (z <= 1.9e+60) tmp = x + 1.0; else tmp = z * (((x + 1.0) / z) - y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.8e+112], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e+60], N[(x + 1.0), $MachinePrecision], N[(z * N[(N[(N[(x + 1.0), $MachinePrecision] / z), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+112}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+60}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\frac{x + 1}{z} - y\right)\\
\end{array}
\end{array}
if z < -1.8e112Initial program 99.7%
Taylor expanded in y around 0 49.8%
associate-+r+49.8%
+-commutative49.8%
associate-+l+49.8%
mul-1-neg49.8%
unsub-neg49.8%
Simplified49.8%
if -1.8e112 < z < 1.90000000000000005e60Initial program 100.0%
Taylor expanded in y around 0 80.1%
+-commutative80.1%
Simplified80.1%
if 1.90000000000000005e60 < z Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
distribute-lft-neg-in99.8%
add-cube-cbrt98.2%
associate-*r*98.3%
fma-define98.3%
pow298.3%
Applied egg-rr98.3%
Taylor expanded in x around inf 82.7%
+-commutative82.7%
mul-1-neg82.7%
sub-neg82.7%
*-commutative82.7%
div-sub82.7%
Simplified82.7%
Taylor expanded in y around 0 43.0%
mul-1-neg43.0%
unsub-neg43.0%
Simplified43.0%
Taylor expanded in z around inf 49.0%
+-commutative49.0%
mul-1-neg49.0%
unsub-neg49.0%
+-commutative49.0%
distribute-lft-in49.0%
rgt-mult-inverse49.0%
*-rgt-identity49.0%
Simplified49.0%
Final simplification69.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -4.8e+113) (not (<= z 9e+60))) (+ x (- 1.0 (* y z))) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4.8e+113) || !(z <= 9e+60)) {
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 ((z <= (-4.8d+113)) .or. (.not. (z <= 9d+60))) 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 ((z <= -4.8e+113) || !(z <= 9e+60)) {
tmp = x + (1.0 - (y * z));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4.8e+113) or not (z <= 9e+60): tmp = x + (1.0 - (y * z)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4.8e+113) || !(z <= 9e+60)) 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 ((z <= -4.8e+113) || ~((z <= 9e+60))) tmp = x + (1.0 - (y * z)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4.8e+113], N[Not[LessEqual[z, 9e+60]], $MachinePrecision]], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+113} \lor \neg \left(z \leq 9 \cdot 10^{+60}\right):\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -4.79999999999999966e113 or 9.00000000000000026e60 < z Initial program 99.7%
Taylor expanded in y around 0 49.3%
associate-+r+49.3%
+-commutative49.3%
associate-+l+49.3%
mul-1-neg49.3%
unsub-neg49.3%
Simplified49.3%
if -4.79999999999999966e113 < z < 9.00000000000000026e60Initial program 100.0%
Taylor expanded in y around 0 80.1%
+-commutative80.1%
Simplified80.1%
Final simplification69.1%
(FPCore (x y z) :precision binary64 (if (<= x -2.9e+23) x (if (<= x 2.55e+38) (- 1.0 (* y z)) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -2.9e+23) {
tmp = x;
} else if (x <= 2.55e+38) {
tmp = 1.0 - (y * z);
} 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 <= (-2.9d+23)) then
tmp = x
else if (x <= 2.55d+38) then
tmp = 1.0d0 - (y * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2.9e+23) {
tmp = x;
} else if (x <= 2.55e+38) {
tmp = 1.0 - (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2.9e+23: tmp = x elif x <= 2.55e+38: tmp = 1.0 - (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2.9e+23) tmp = x; elseif (x <= 2.55e+38) tmp = Float64(1.0 - Float64(y * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2.9e+23) tmp = x; elseif (x <= 2.55e+38) tmp = 1.0 - (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2.9e+23], x, If[LessEqual[x, 2.55e+38], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{+23}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.55 \cdot 10^{+38}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.90000000000000013e23 or 2.5500000000000001e38 < x Initial program 99.9%
Taylor expanded in x around inf 81.0%
if -2.90000000000000013e23 < x < 2.5500000000000001e38Initial program 99.9%
Taylor expanded in x around 0 97.5%
Taylor expanded in y around 0 56.0%
mul-1-neg56.0%
unsub-neg56.0%
Simplified56.0%
Final simplification67.9%
(FPCore (x y z) :precision binary64 (if (<= x -0.00115) x (if (<= x 4.6e-10) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.00115) {
tmp = x;
} else if (x <= 4.6e-10) {
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.00115d0)) then
tmp = x
else if (x <= 4.6d-10) 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.00115) {
tmp = x;
} else if (x <= 4.6e-10) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.00115: tmp = x elif x <= 4.6e-10: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.00115) tmp = x; elseif (x <= 4.6e-10) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -0.00115) tmp = x; elseif (x <= 4.6e-10) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.00115], x, If[LessEqual[x, 4.6e-10], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.00115:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-10}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.00115 or 4.60000000000000014e-10 < x Initial program 99.9%
Taylor expanded in x around inf 73.9%
if -0.00115 < x < 4.60000000000000014e-10Initial program 99.9%
Taylor expanded in x around 0 99.3%
Taylor expanded in y around 0 44.9%
Final simplification60.3%
(FPCore (x y z) :precision binary64 (if (<= z 5e+204) (+ x 1.0) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 5e+204) {
tmp = x + 1.0;
} else {
tmp = 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 (z <= 5d+204) then
tmp = x + 1.0d0
else
tmp = y * -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= 5e+204) {
tmp = x + 1.0;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 5e+204: tmp = x + 1.0 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 5e+204) tmp = Float64(x + 1.0); else tmp = Float64(y * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= 5e+204) tmp = x + 1.0; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 5e+204], N[(x + 1.0), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5 \cdot 10^{+204}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 5.00000000000000008e204Initial program 99.9%
Taylor expanded in y around 0 66.0%
+-commutative66.0%
Simplified66.0%
if 5.00000000000000008e204 < z Initial program 99.8%
Taylor expanded in z around inf 85.3%
associate-*r*85.3%
neg-mul-185.3%
*-commutative85.3%
Simplified85.3%
Taylor expanded in y around 0 34.7%
mul-1-neg34.7%
distribute-rgt-neg-in34.7%
Simplified34.7%
Final simplification62.8%
(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 60.6%
+-commutative60.6%
Simplified60.6%
Final simplification60.6%
(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 60.8%
Taylor expanded in y around 0 22.4%
Final simplification22.4%
herbie shell --seed 2024079
(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))))