
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
(FPCore (x y z) :precision binary64 (- (+ x (cos y)) (* z (sin y))))
double code(double x, double y, double z) {
return (x + cos(y)) - (z * sin(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x + cos(y)) - (z * sin(y))
end function
public static double code(double x, double y, double z) {
return (x + Math.cos(y)) - (z * Math.sin(y));
}
def code(x, y, z): return (x + math.cos(y)) - (z * math.sin(y))
function code(x, y, z) return Float64(Float64(x + cos(y)) - Float64(z * sin(y))) end
function tmp = code(x, y, z) tmp = (x + cos(y)) - (z * sin(y)); end
code[x_, y_, z_] := N[(N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \cos y\right) - z \cdot \sin y
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (or (<= x -0.0148) (not (<= x 2.9e-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 <= -0.0148) || !(x <= 2.9e-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 <= (-0.0148d0)) .or. (.not. (x <= 2.9d-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 <= -0.0148) || !(x <= 2.9e-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 <= -0.0148) or not (x <= 2.9e-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 <= -0.0148) || !(x <= 2.9e-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 <= -0.0148) || ~((x <= 2.9e-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, -0.0148], N[Not[LessEqual[x, 2.9e-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 -0.0148 \lor \neg \left(x \leq 2.9 \cdot 10^{-6}\right):\\
\;\;\;\;\left(x + 1\right) - t_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t_0\\
\end{array}
\end{array}
if x < -0.014800000000000001 or 2.9000000000000002e-6 < x Initial program 99.9%
Taylor expanded in y around 0 99.5%
if -0.014800000000000001 < x < 2.9000000000000002e-6Initial program 99.8%
Taylor expanded in x around 0 98.1%
Final simplification98.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- 1.0 (* z (sin y)))))
(if (<= z -5.5e+116)
t_0
(if (<= z -4.4e+70)
(+ x 1.0)
(if (<= z -5.2e+32)
(* (sin y) (- z))
(if (<= z 2.7e+97) (+ x (cos y)) t_0))))))
double code(double x, double y, double z) {
double t_0 = 1.0 - (z * sin(y));
double tmp;
if (z <= -5.5e+116) {
tmp = t_0;
} else if (z <= -4.4e+70) {
tmp = x + 1.0;
} else if (z <= -5.2e+32) {
tmp = sin(y) * -z;
} else if (z <= 2.7e+97) {
tmp = x + cos(y);
} else {
tmp = 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 = 1.0d0 - (z * sin(y))
if (z <= (-5.5d+116)) then
tmp = t_0
else if (z <= (-4.4d+70)) then
tmp = x + 1.0d0
else if (z <= (-5.2d+32)) then
tmp = sin(y) * -z
else if (z <= 2.7d+97) then
tmp = x + cos(y)
else
tmp = t_0
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 <= -5.5e+116) {
tmp = t_0;
} else if (z <= -4.4e+70) {
tmp = x + 1.0;
} else if (z <= -5.2e+32) {
tmp = Math.sin(y) * -z;
} else if (z <= 2.7e+97) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 1.0 - (z * math.sin(y)) tmp = 0 if z <= -5.5e+116: tmp = t_0 elif z <= -4.4e+70: tmp = x + 1.0 elif z <= -5.2e+32: tmp = math.sin(y) * -z elif z <= 2.7e+97: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(1.0 - Float64(z * sin(y))) tmp = 0.0 if (z <= -5.5e+116) tmp = t_0; elseif (z <= -4.4e+70) tmp = Float64(x + 1.0); elseif (z <= -5.2e+32) tmp = Float64(sin(y) * Float64(-z)); elseif (z <= 2.7e+97) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 1.0 - (z * sin(y)); tmp = 0.0; if (z <= -5.5e+116) tmp = t_0; elseif (z <= -4.4e+70) tmp = x + 1.0; elseif (z <= -5.2e+32) tmp = sin(y) * -z; elseif (z <= 2.7e+97) tmp = x + cos(y); else tmp = t_0; 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, -5.5e+116], t$95$0, If[LessEqual[z, -4.4e+70], N[(x + 1.0), $MachinePrecision], If[LessEqual[z, -5.2e+32], N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[z, 2.7e+97], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - z \cdot \sin y\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{+116}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -4.4 \cdot 10^{+70}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{+32}:\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+97}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -5.50000000000000035e116 or 2.69999999999999993e97 < z Initial program 99.8%
Taylor expanded in x around 0 73.4%
Taylor expanded in y around 0 73.4%
if -5.50000000000000035e116 < z < -4.40000000000000001e70Initial program 99.8%
Taylor expanded in y around 0 78.6%
+-commutative78.6%
Simplified78.6%
if -4.40000000000000001e70 < z < -5.2000000000000004e32Initial program 99.4%
Taylor expanded in z around inf 87.4%
neg-mul-187.4%
*-commutative87.4%
distribute-rgt-neg-in87.4%
Simplified87.4%
if -5.2000000000000004e32 < z < 2.69999999999999993e97Initial program 100.0%
Taylor expanded in z around 0 94.2%
+-commutative94.2%
Simplified94.2%
Final simplification87.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) (- z))))
(if (<= z -1.06e+178)
t_0
(if (<= z -5.1e+70)
(+ x 1.0)
(if (or (<= z -5.2e+32) (not (<= z 2e+129))) t_0 (+ x (cos y)))))))
double code(double x, double y, double z) {
double t_0 = sin(y) * -z;
double tmp;
if (z <= -1.06e+178) {
tmp = t_0;
} else if (z <= -5.1e+70) {
tmp = x + 1.0;
} else if ((z <= -5.2e+32) || !(z <= 2e+129)) {
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 = sin(y) * -z
if (z <= (-1.06d+178)) then
tmp = t_0
else if (z <= (-5.1d+70)) then
tmp = x + 1.0d0
else if ((z <= (-5.2d+32)) .or. (.not. (z <= 2d+129))) 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 = Math.sin(y) * -z;
double tmp;
if (z <= -1.06e+178) {
tmp = t_0;
} else if (z <= -5.1e+70) {
tmp = x + 1.0;
} else if ((z <= -5.2e+32) || !(z <= 2e+129)) {
tmp = t_0;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * -z tmp = 0 if z <= -1.06e+178: tmp = t_0 elif z <= -5.1e+70: tmp = x + 1.0 elif (z <= -5.2e+32) or not (z <= 2e+129): tmp = t_0 else: tmp = x + math.cos(y) return tmp
function code(x, y, z) t_0 = Float64(sin(y) * Float64(-z)) tmp = 0.0 if (z <= -1.06e+178) tmp = t_0; elseif (z <= -5.1e+70) tmp = Float64(x + 1.0); elseif ((z <= -5.2e+32) || !(z <= 2e+129)) tmp = t_0; else tmp = Float64(x + cos(y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * -z; tmp = 0.0; if (z <= -1.06e+178) tmp = t_0; elseif (z <= -5.1e+70) tmp = x + 1.0; elseif ((z <= -5.2e+32) || ~((z <= 2e+129))) tmp = t_0; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision]}, If[LessEqual[z, -1.06e+178], t$95$0, If[LessEqual[z, -5.1e+70], N[(x + 1.0), $MachinePrecision], If[Or[LessEqual[z, -5.2e+32], N[Not[LessEqual[z, 2e+129]], $MachinePrecision]], t$95$0, N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -1.06 \cdot 10^{+178}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -5.1 \cdot 10^{+70}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{+32} \lor \neg \left(z \leq 2 \cdot 10^{+129}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.05999999999999994e178 or -5.10000000000000014e70 < z < -5.2000000000000004e32 or 2e129 < z Initial program 99.8%
Taylor expanded in z around inf 73.6%
neg-mul-173.6%
*-commutative73.6%
distribute-rgt-neg-in73.6%
Simplified73.6%
if -1.05999999999999994e178 < z < -5.10000000000000014e70Initial program 99.8%
Taylor expanded in y around 0 66.0%
+-commutative66.0%
Simplified66.0%
if -5.2000000000000004e32 < z < 2e129Initial program 100.0%
Taylor expanded in z around 0 93.2%
+-commutative93.2%
Simplified93.2%
Final simplification85.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.7) (not (<= z 0.5))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.7) || !(z <= 0.5)) {
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 <= (-0.7d0)) .or. (.not. (z <= 0.5d0))) 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 <= -0.7) || !(z <= 0.5)) {
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 <= -0.7) or not (z <= 0.5): 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 <= -0.7) || !(z <= 0.5)) 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 <= -0.7) || ~((z <= 0.5))) 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, -0.7], N[Not[LessEqual[z, 0.5]], $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 -0.7 \lor \neg \left(z \leq 0.5\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -0.69999999999999996 or 0.5 < z Initial program 99.8%
Taylor expanded in y around 0 98.7%
if -0.69999999999999996 < z < 0.5Initial program 100.0%
Taylor expanded in z around 0 98.8%
+-commutative98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.4e-5) (not (<= y 0.45))) (+ x (cos y)) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.4e-5) || !(y <= 0.45)) {
tmp = x + cos(y);
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-6.4d-5)) .or. (.not. (y <= 0.45d0))) then
tmp = x + cos(y)
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.4e-5) || !(y <= 0.45)) {
tmp = x + Math.cos(y);
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.4e-5) or not (y <= 0.45): tmp = x + math.cos(y) else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.4e-5) || !(y <= 0.45)) tmp = Float64(x + cos(y)); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.4e-5) || ~((y <= 0.45))) tmp = x + cos(y); else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.4e-5], N[Not[LessEqual[y, 0.45]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.4 \cdot 10^{-5} \lor \neg \left(y \leq 0.45\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -6.39999999999999971e-5 or 0.450000000000000011 < y Initial program 99.8%
Taylor expanded in z around 0 65.9%
+-commutative65.9%
Simplified65.9%
if -6.39999999999999971e-5 < y < 0.450000000000000011Initial program 100.0%
Taylor expanded in y around 0 98.9%
mul-1-neg98.9%
unsub-neg98.9%
Simplified98.9%
Final simplification81.6%
(FPCore (x y z) :precision binary64 (if (or (<= x -0.0148) (not (<= x 0.013))) (+ x 1.0) (cos y)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -0.0148) || !(x <= 0.013)) {
tmp = x + 1.0;
} else {
tmp = 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 ((x <= (-0.0148d0)) .or. (.not. (x <= 0.013d0))) then
tmp = x + 1.0d0
else
tmp = cos(y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -0.0148) || !(x <= 0.013)) {
tmp = x + 1.0;
} else {
tmp = Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -0.0148) or not (x <= 0.013): tmp = x + 1.0 else: tmp = math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -0.0148) || !(x <= 0.013)) tmp = Float64(x + 1.0); else tmp = cos(y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -0.0148) || ~((x <= 0.013))) tmp = x + 1.0; else tmp = cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -0.0148], N[Not[LessEqual[x, 0.013]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[Cos[y], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0148 \lor \neg \left(x \leq 0.013\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\cos y\\
\end{array}
\end{array}
if x < -0.014800000000000001 or 0.0129999999999999994 < x Initial program 99.9%
Taylor expanded in y around 0 83.9%
+-commutative83.9%
Simplified83.9%
if -0.014800000000000001 < x < 0.0129999999999999994Initial program 99.8%
Taylor expanded in z around 0 60.8%
+-commutative60.8%
Simplified60.8%
Taylor expanded in x around 0 59.1%
Final simplification72.2%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.36e+51) (not (<= y 2.1e+23))) (+ x 1.0) (+ 1.0 (- x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.36e+51) || !(y <= 2.1e+23)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1.36d+51)) .or. (.not. (y <= 2.1d+23))) then
tmp = x + 1.0d0
else
tmp = 1.0d0 + (x - (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.36e+51) || !(y <= 2.1e+23)) {
tmp = x + 1.0;
} else {
tmp = 1.0 + (x - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.36e+51) or not (y <= 2.1e+23): tmp = x + 1.0 else: tmp = 1.0 + (x - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.36e+51) || !(y <= 2.1e+23)) tmp = Float64(x + 1.0); else tmp = Float64(1.0 + Float64(x - Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.36e+51) || ~((y <= 2.1e+23))) tmp = x + 1.0; else tmp = 1.0 + (x - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.36e+51], N[Not[LessEqual[y, 2.1e+23]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 + N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.36 \cdot 10^{+51} \lor \neg \left(y \leq 2.1 \cdot 10^{+23}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x - y \cdot z\right)\\
\end{array}
\end{array}
if y < -1.3599999999999999e51 or 2.1000000000000001e23 < y Initial program 99.9%
Taylor expanded in y around 0 49.0%
+-commutative49.0%
Simplified49.0%
if -1.3599999999999999e51 < y < 2.1000000000000001e23Initial program 99.9%
Taylor expanded in y around 0 89.6%
mul-1-neg89.6%
unsub-neg89.6%
Simplified89.6%
Final simplification71.9%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.85e-16) (not (<= x 6e-19))) (+ x 1.0) (- 1.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.85e-16) || !(x <= 6e-19)) {
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 <= (-1.85d-16)) .or. (.not. (x <= 6d-19))) 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 <= -1.85e-16) || !(x <= 6e-19)) {
tmp = x + 1.0;
} else {
tmp = 1.0 - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.85e-16) or not (x <= 6e-19): tmp = x + 1.0 else: tmp = 1.0 - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.85e-16) || !(x <= 6e-19)) 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 <= -1.85e-16) || ~((x <= 6e-19))) tmp = x + 1.0; else tmp = 1.0 - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.85e-16], N[Not[LessEqual[x, 6e-19]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.85 \cdot 10^{-16} \lor \neg \left(x \leq 6 \cdot 10^{-19}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot z\\
\end{array}
\end{array}
if x < -1.85e-16 or 5.99999999999999985e-19 < x Initial program 99.9%
Taylor expanded in y around 0 78.8%
+-commutative78.8%
Simplified78.8%
if -1.85e-16 < x < 5.99999999999999985e-19Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-def99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Taylor expanded in y around 0 54.0%
mul-1-neg54.0%
unsub-neg54.0%
Simplified54.0%
Final simplification68.1%
(FPCore (x y z) :precision binary64 (if (<= z -1.36e+188) (* y (- z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.36e+188) {
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.36d+188)) 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.36e+188) {
tmp = y * -z;
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.36e+188: tmp = y * -z else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.36e+188) 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.36e+188) tmp = y * -z; else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.36e+188], N[(y * (-z)), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.36 \cdot 10^{+188}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -1.36e188Initial program 99.9%
Taylor expanded in z around inf 72.2%
neg-mul-172.2%
*-commutative72.2%
distribute-rgt-neg-in72.2%
Simplified72.2%
Taylor expanded in y around 0 47.7%
mul-1-neg47.7%
distribute-rgt-neg-in47.7%
Simplified47.7%
if -1.36e188 < z Initial program 99.9%
Taylor expanded in y around 0 67.1%
+-commutative67.1%
Simplified67.1%
Final simplification65.4%
(FPCore (x y z) :precision binary64 (if (<= x -1.0) x (if (<= x 2.85e-6) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.0) {
tmp = x;
} else if (x <= 2.85e-6) {
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 <= (-1.0d0)) then
tmp = x
else if (x <= 2.85d-6) 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 <= -1.0) {
tmp = x;
} else if (x <= 2.85e-6) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.0: tmp = x elif x <= 2.85e-6: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.0) tmp = x; elseif (x <= 2.85e-6) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.0) tmp = x; elseif (x <= 2.85e-6) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.0], x, If[LessEqual[x, 2.85e-6], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.85 \cdot 10^{-6}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1 or 2.8499999999999998e-6 < x Initial program 99.9%
Taylor expanded in x around inf 81.7%
if -1 < x < 2.8499999999999998e-6Initial program 99.8%
cancel-sign-sub-inv99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
sin-neg99.8%
fma-def99.8%
sin-neg99.8%
Simplified99.8%
Taylor expanded in x around 0 97.9%
Taylor expanded in y around 0 50.7%
mul-1-neg50.7%
unsub-neg50.7%
Simplified50.7%
Taylor expanded in y around 0 40.9%
Final simplification62.6%
(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 63.4%
+-commutative63.4%
Simplified63.4%
Final simplification63.4%
(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%
cancel-sign-sub-inv99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
sin-neg99.9%
fma-def99.9%
sin-neg99.9%
Simplified99.9%
Taylor expanded in x around 0 55.5%
Taylor expanded in y around 0 28.7%
mul-1-neg28.7%
unsub-neg28.7%
Simplified28.7%
Taylor expanded in y around 0 20.6%
Final simplification20.6%
herbie shell --seed 2023333
(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))))