
(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%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (sin y))))
(if (or (<= x -0.000175) (not (<= x 6e-35)))
(- (+ 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.000175) || !(x <= 6e-35)) {
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.000175d0)) .or. (.not. (x <= 6d-35))) 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.000175) || !(x <= 6e-35)) {
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.000175) or not (x <= 6e-35): 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.000175) || !(x <= 6e-35)) 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.000175) || ~((x <= 6e-35))) 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.000175], N[Not[LessEqual[x, 6e-35]], $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.000175 \lor \neg \left(x \leq 6 \cdot 10^{-35}\right):\\
\;\;\;\;\left(x + 1\right) - t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos y - t\_0\\
\end{array}
\end{array}
if x < -1.74999999999999998e-4 or 5.99999999999999978e-35 < x Initial program 100.0%
Taylor expanded in y around 0 100.0%
if -1.74999999999999998e-4 < x < 5.99999999999999978e-35Initial program 99.9%
Taylor expanded in x around 0 99.4%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -18000.0) (not (<= z 5.5e-24))) (- (+ x 1.0) (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -18000.0) || !(z <= 5.5e-24)) {
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 <= (-18000.0d0)) .or. (.not. (z <= 5.5d-24))) 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 <= -18000.0) || !(z <= 5.5e-24)) {
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 <= -18000.0) or not (z <= 5.5e-24): 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 <= -18000.0) || !(z <= 5.5e-24)) 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 <= -18000.0) || ~((z <= 5.5e-24))) 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, -18000.0], N[Not[LessEqual[z, 5.5e-24]], $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 -18000 \lor \neg \left(z \leq 5.5 \cdot 10^{-24}\right):\\
\;\;\;\;\left(x + 1\right) - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -18000 or 5.4999999999999999e-24 < z Initial program 99.8%
Taylor expanded in y around 0 99.5%
if -18000 < z < 5.4999999999999999e-24Initial program 100.0%
Taylor expanded in z around 0 99.6%
+-commutative99.6%
Simplified99.6%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.5e+16) (not (<= z 2.9e+19))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.5e+16) || !(z <= 2.9e+19)) {
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 <= (-3.5d+16)) .or. (.not. (z <= 2.9d+19))) 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 <= -3.5e+16) || !(z <= 2.9e+19)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.5e+16) or not (z <= 2.9e+19): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.5e+16) || !(z <= 2.9e+19)) 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 <= -3.5e+16) || ~((z <= 2.9e+19))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.5e+16], N[Not[LessEqual[z, 2.9e+19]], $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 -3.5 \cdot 10^{+16} \lor \neg \left(z \leq 2.9 \cdot 10^{+19}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -3.5e16 or 2.9e19 < z Initial program 99.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in x around inf 89.4%
if -3.5e16 < z < 2.9e19Initial program 100.0%
Taylor expanded in z around 0 98.2%
+-commutative98.2%
Simplified98.2%
Final simplification94.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.6e+193) (not (<= z 5.6e+117))) (* (sin y) (- z)) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.6e+193) || !(z <= 5.6e+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 <= (-1.6d+193)) .or. (.not. (z <= 5.6d+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 <= -1.6e+193) || !(z <= 5.6e+117)) {
tmp = Math.sin(y) * -z;
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.6e+193) or not (z <= 5.6e+117): tmp = math.sin(y) * -z else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.6e+193) || !(z <= 5.6e+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 <= -1.6e+193) || ~((z <= 5.6e+117))) tmp = sin(y) * -z; else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.6e+193], N[Not[LessEqual[z, 5.6e+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 -1.6 \cdot 10^{+193} \lor \neg \left(z \leq 5.6 \cdot 10^{+117}\right):\\
\;\;\;\;\sin y \cdot \left(-z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -1.60000000000000007e193 or 5.59999999999999995e117 < z Initial program 99.8%
Taylor expanded in z around inf 77.7%
mul-1-neg77.7%
*-commutative77.7%
distribute-rgt-neg-in77.7%
Simplified77.7%
if -1.60000000000000007e193 < z < 5.59999999999999995e117Initial program 100.0%
Taylor expanded in z around 0 89.5%
+-commutative89.5%
Simplified89.5%
Final simplification86.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -5.8e+14) (not (<= y 720.0))) (+ x (cos y)) (+ (+ x 1.0) (* y (- (* y -0.5) z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -5.8e+14) || !(y <= 720.0)) {
tmp = x + cos(y);
} else {
tmp = (x + 1.0) + (y * ((y * -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 <= (-5.8d+14)) .or. (.not. (y <= 720.0d0))) then
tmp = x + cos(y)
else
tmp = (x + 1.0d0) + (y * ((y * (-0.5d0)) - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -5.8e+14) || !(y <= 720.0)) {
tmp = x + Math.cos(y);
} else {
tmp = (x + 1.0) + (y * ((y * -0.5) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -5.8e+14) or not (y <= 720.0): tmp = x + math.cos(y) else: tmp = (x + 1.0) + (y * ((y * -0.5) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -5.8e+14) || !(y <= 720.0)) tmp = Float64(x + cos(y)); else tmp = Float64(Float64(x + 1.0) + Float64(y * Float64(Float64(y * -0.5) - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -5.8e+14) || ~((y <= 720.0))) tmp = x + cos(y); else tmp = (x + 1.0) + (y * ((y * -0.5) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -5.8e+14], N[Not[LessEqual[y, 720.0]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+14} \lor \neg \left(y \leq 720\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) + y \cdot \left(y \cdot -0.5 - z\right)\\
\end{array}
\end{array}
if y < -5.8e14 or 720 < y Initial program 99.8%
Taylor expanded in z around 0 61.8%
+-commutative61.8%
Simplified61.8%
if -5.8e14 < y < 720Initial program 100.0%
Taylor expanded in y around 0 98.8%
associate-+r+98.8%
+-commutative98.8%
*-commutative98.8%
Simplified98.8%
Final simplification82.3%
(FPCore (x y z)
:precision binary64
(if (<= x -0.000175)
(+ x 1.0)
(if (<= x 1.15e-82)
(cos y)
(if (<= x 1.42e-63) (- 1.0 (* y z)) (+ x 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= -0.000175) {
tmp = x + 1.0;
} else if (x <= 1.15e-82) {
tmp = cos(y);
} else if (x <= 1.42e-63) {
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 <= (-0.000175d0)) then
tmp = x + 1.0d0
else if (x <= 1.15d-82) then
tmp = cos(y)
else if (x <= 1.42d-63) 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 <= -0.000175) {
tmp = x + 1.0;
} else if (x <= 1.15e-82) {
tmp = Math.cos(y);
} else if (x <= 1.42e-63) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -0.000175: tmp = x + 1.0 elif x <= 1.15e-82: tmp = math.cos(y) elif x <= 1.42e-63: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -0.000175) tmp = Float64(x + 1.0); elseif (x <= 1.15e-82) tmp = cos(y); elseif (x <= 1.42e-63) 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 <= -0.000175) tmp = x + 1.0; elseif (x <= 1.15e-82) tmp = cos(y); elseif (x <= 1.42e-63) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -0.000175], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 1.15e-82], N[Cos[y], $MachinePrecision], If[LessEqual[x, 1.42e-63], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.000175:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-82}:\\
\;\;\;\;\cos y\\
\mathbf{elif}\;x \leq 1.42 \cdot 10^{-63}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -1.74999999999999998e-4 or 1.42e-63 < x Initial program 100.0%
Taylor expanded in y around 0 85.0%
+-commutative85.0%
Simplified85.0%
if -1.74999999999999998e-4 < x < 1.14999999999999998e-82Initial program 99.8%
Taylor expanded in x around 0 99.3%
Taylor expanded in z around 0 61.7%
if 1.14999999999999998e-82 < x < 1.42e-63Initial program 100.0%
Taylor expanded in x around 0 100.0%
Taylor expanded in y around 0 74.6%
mul-1-neg74.6%
unsub-neg74.6%
Simplified74.6%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.2e+53) (not (<= y 9.5e+29))) (+ x 1.0) (+ (+ x 1.0) (* y (- (* y -0.5) z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.2e+53) || !(y <= 9.5e+29)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) + (y * ((y * -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 <= (-1.2d+53)) .or. (.not. (y <= 9.5d+29))) then
tmp = x + 1.0d0
else
tmp = (x + 1.0d0) + (y * ((y * (-0.5d0)) - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.2e+53) || !(y <= 9.5e+29)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) + (y * ((y * -0.5) - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.2e+53) or not (y <= 9.5e+29): tmp = x + 1.0 else: tmp = (x + 1.0) + (y * ((y * -0.5) - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.2e+53) || !(y <= 9.5e+29)) tmp = Float64(x + 1.0); else tmp = Float64(Float64(x + 1.0) + Float64(y * Float64(Float64(y * -0.5) - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.2e+53) || ~((y <= 9.5e+29))) tmp = x + 1.0; else tmp = (x + 1.0) + (y * ((y * -0.5) - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.2e+53], N[Not[LessEqual[y, 9.5e+29]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+53} \lor \neg \left(y \leq 9.5 \cdot 10^{+29}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) + y \cdot \left(y \cdot -0.5 - z\right)\\
\end{array}
\end{array}
if y < -1.2e53 or 9.5000000000000003e29 < y Initial program 99.9%
Taylor expanded in y around 0 39.0%
+-commutative39.0%
Simplified39.0%
if -1.2e53 < y < 9.5000000000000003e29Initial program 99.9%
Taylor expanded in y around 0 93.9%
associate-+r+93.9%
+-commutative93.9%
*-commutative93.9%
Simplified93.9%
Final simplification72.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -9.5e+170) (not (<= y 6.5e+15))) (+ x 1.0) (+ x (- 1.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -9.5e+170) || !(y <= 6.5e+15)) {
tmp = x + 1.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) :: tmp
if ((y <= (-9.5d+170)) .or. (.not. (y <= 6.5d+15))) then
tmp = x + 1.0d0
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 <= -9.5e+170) || !(y <= 6.5e+15)) {
tmp = x + 1.0;
} else {
tmp = x + (1.0 - (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -9.5e+170) or not (y <= 6.5e+15): tmp = x + 1.0 else: tmp = x + (1.0 - (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -9.5e+170) || !(y <= 6.5e+15)) tmp = Float64(x + 1.0); 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 <= -9.5e+170) || ~((y <= 6.5e+15))) tmp = x + 1.0; else tmp = x + (1.0 - (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -9.5e+170], N[Not[LessEqual[y, 6.5e+15]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(x + N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+170} \lor \neg \left(y \leq 6.5 \cdot 10^{+15}\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -9.5000000000000005e170 or 6.5e15 < y Initial program 99.9%
Taylor expanded in y around 0 40.7%
+-commutative40.7%
Simplified40.7%
if -9.5000000000000005e170 < y < 6.5e15Initial program 99.9%
Taylor expanded in y around 0 86.3%
associate-+r+86.3%
+-commutative86.3%
associate-+l+86.3%
mul-1-neg86.3%
unsub-neg86.3%
Simplified86.3%
Final simplification71.9%
(FPCore (x y z) :precision binary64 (if (<= x -510000000.0) x (if (<= x 1.45e-63) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -510000000.0) {
tmp = x;
} else if (x <= 1.45e-63) {
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 <= (-510000000.0d0)) then
tmp = x
else if (x <= 1.45d-63) 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 <= -510000000.0) {
tmp = x;
} else if (x <= 1.45e-63) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -510000000.0: tmp = x elif x <= 1.45e-63: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -510000000.0) tmp = x; elseif (x <= 1.45e-63) 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 <= -510000000.0) tmp = x; elseif (x <= 1.45e-63) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -510000000.0], x, If[LessEqual[x, 1.45e-63], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -510000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-63}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -5.1e8Initial program 100.0%
Taylor expanded in x around inf 85.2%
if -5.1e8 < x < 1.44999999999999987e-63Initial program 99.8%
Taylor expanded in x around 0 98.9%
Taylor expanded in y around 0 53.1%
mul-1-neg53.1%
unsub-neg53.1%
Simplified53.1%
if 1.44999999999999987e-63 < x Initial program 100.0%
Taylor expanded in y around 0 88.9%
+-commutative88.9%
Simplified88.9%
(FPCore (x y z) :precision binary64 (if (<= x -14.5) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -14.5) {
tmp = x;
} else if (x <= 1.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 <= (-14.5d0)) then
tmp = x
else if (x <= 1.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 <= -14.5) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -14.5: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -14.5) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -14.5) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -14.5], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -14.5:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -14.5 or 1 < x Initial program 100.0%
Taylor expanded in x around inf 86.1%
if -14.5 < x < 1Initial program 99.9%
Taylor expanded in x around 0 98.9%
Taylor expanded in y around 0 40.5%
(FPCore (x y z) :precision binary64 (if (<= z 5e+150) (+ x 1.0) (* y (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= 5e+150) {
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+150) 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+150) {
tmp = x + 1.0;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= 5e+150: tmp = x + 1.0 else: tmp = y * -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= 5e+150) 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+150) tmp = x + 1.0; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, 5e+150], N[(x + 1.0), $MachinePrecision], N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5 \cdot 10^{+150}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 5.00000000000000009e150Initial program 99.9%
Taylor expanded in y around 0 67.6%
+-commutative67.6%
Simplified67.6%
if 5.00000000000000009e150 < z Initial program 99.9%
Taylor expanded in z around inf 75.8%
mul-1-neg75.8%
*-commutative75.8%
distribute-rgt-neg-in75.8%
Simplified75.8%
Taylor expanded in y around 0 44.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%
Taylor expanded in y around 0 61.8%
+-commutative61.8%
Simplified61.8%
(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 59.8%
Taylor expanded in y around 0 23.0%
herbie shell --seed 2024151
(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))))