
(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%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* z (sin y))) (t_1 (- x t_0))) (if (<= x -1.0) t_1 (if (<= x 0.82) (- (cos y) t_0) t_1))))
double code(double x, double y, double z) {
double t_0 = z * sin(y);
double t_1 = x - t_0;
double tmp;
if (x <= -1.0) {
tmp = t_1;
} else if (x <= 0.82) {
tmp = cos(y) - t_0;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_0 = z * sin(y)
t_1 = x - t_0
if (x <= (-1.0d0)) then
tmp = t_1
else if (x <= 0.82d0) then
tmp = cos(y) - t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * Math.sin(y);
double t_1 = x - t_0;
double tmp;
if (x <= -1.0) {
tmp = t_1;
} else if (x <= 0.82) {
tmp = Math.cos(y) - t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = z * math.sin(y) t_1 = x - t_0 tmp = 0 if x <= -1.0: tmp = t_1 elif x <= 0.82: tmp = math.cos(y) - t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(z * sin(y)) t_1 = Float64(x - t_0) tmp = 0.0 if (x <= -1.0) tmp = t_1; elseif (x <= 0.82) tmp = Float64(cos(y) - t_0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * sin(y); t_1 = x - t_0; tmp = 0.0; if (x <= -1.0) tmp = t_1; elseif (x <= 0.82) tmp = cos(y) - t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - t$95$0), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$1, If[LessEqual[x, 0.82], N[(N[Cos[y], $MachinePrecision] - t$95$0), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \sin y\\
t_1 := x - t\_0\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 0.82:\\
\;\;\;\;\cos y - t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1 or 0.819999999999999951 < x Initial program 99.9%
Taylor expanded in x around inf
Simplified99.0%
if -1 < x < 0.819999999999999951Initial program 99.9%
Taylor expanded in x around 0
--lowering--.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6499.2%
Simplified99.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- x (* z (sin y))))) (if (<= z -100.0) t_0 (if (<= z 2e+38) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = x - (z * sin(y));
double tmp;
if (z <= -100.0) {
tmp = t_0;
} else if (z <= 2e+38) {
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 = x - (z * sin(y))
if (z <= (-100.0d0)) then
tmp = t_0
else if (z <= 2d+38) 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 = x - (z * Math.sin(y));
double tmp;
if (z <= -100.0) {
tmp = t_0;
} else if (z <= 2e+38) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x - (z * math.sin(y)) tmp = 0 if z <= -100.0: tmp = t_0 elif z <= 2e+38: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x - Float64(z * sin(y))) tmp = 0.0 if (z <= -100.0) tmp = t_0; elseif (z <= 2e+38) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x - (z * sin(y)); tmp = 0.0; if (z <= -100.0) tmp = t_0; elseif (z <= 2e+38) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -100.0], t$95$0, If[LessEqual[z, 2e+38], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - z \cdot \sin y\\
\mathbf{if}\;z \leq -100:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+38}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -100 or 1.99999999999999995e38 < z Initial program 99.9%
Taylor expanded in x around inf
Simplified89.1%
if -100 < z < 1.99999999999999995e38Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f6498.0%
Simplified98.0%
Final simplification94.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (cos y))))
(if (<= y -0.125)
t_0
(if (<= y 2e+17)
(+ 1.0 (+ x (* y (- (* y (+ -0.5 (* (* y z) 0.16666666666666666))) z))))
t_0))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -0.125) {
tmp = t_0;
} else if (y <= 2e+17) {
tmp = 1.0 + (x + (y * ((y * (-0.5 + ((y * z) * 0.16666666666666666))) - z)));
} 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 = x + cos(y)
if (y <= (-0.125d0)) then
tmp = t_0
else if (y <= 2d+17) then
tmp = 1.0d0 + (x + (y * ((y * ((-0.5d0) + ((y * z) * 0.16666666666666666d0))) - z)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + Math.cos(y);
double tmp;
if (y <= -0.125) {
tmp = t_0;
} else if (y <= 2e+17) {
tmp = 1.0 + (x + (y * ((y * (-0.5 + ((y * z) * 0.16666666666666666))) - z)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x + math.cos(y) tmp = 0 if y <= -0.125: tmp = t_0 elif y <= 2e+17: tmp = 1.0 + (x + (y * ((y * (-0.5 + ((y * z) * 0.16666666666666666))) - z))) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x + cos(y)) tmp = 0.0 if (y <= -0.125) tmp = t_0; elseif (y <= 2e+17) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(-0.5 + Float64(Float64(y * z) * 0.16666666666666666))) - z)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + cos(y); tmp = 0.0; if (y <= -0.125) tmp = t_0; elseif (y <= 2e+17) tmp = 1.0 + (x + (y * ((y * (-0.5 + ((y * z) * 0.16666666666666666))) - z))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.125], t$95$0, If[LessEqual[y, 2e+17], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(-0.5 + N[(N[(y * z), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -0.125:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+17}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(-0.5 + \left(y \cdot z\right) \cdot 0.16666666666666666\right) - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.125 or 2e17 < y Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f6459.7%
Simplified59.7%
if -0.125 < y < 2e17Initial program 100.0%
Taylor expanded in y around 0
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6498.7%
Simplified98.7%
Final simplification81.2%
(FPCore (x y z) :precision binary64 (if (<= x -46000000000.0) x (if (<= x 1.4e-15) (cos y) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -46000000000.0) {
tmp = x;
} else if (x <= 1.4e-15) {
tmp = cos(y);
} 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 <= (-46000000000.0d0)) then
tmp = x
else if (x <= 1.4d-15) then
tmp = cos(y)
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 <= -46000000000.0) {
tmp = x;
} else if (x <= 1.4e-15) {
tmp = Math.cos(y);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -46000000000.0: tmp = x elif x <= 1.4e-15: tmp = math.cos(y) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -46000000000.0) tmp = x; elseif (x <= 1.4e-15) tmp = cos(y); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -46000000000.0) tmp = x; elseif (x <= 1.4e-15) tmp = cos(y); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -46000000000.0], x, If[LessEqual[x, 1.4e-15], N[Cos[y], $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -46000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-15}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -4.6e10Initial program 99.9%
Taylor expanded in x around inf
Simplified82.2%
if -4.6e10 < x < 1.40000000000000007e-15Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f6460.1%
Simplified60.1%
Taylor expanded in x around 0
cos-lowering-cos.f6460.1%
Simplified60.1%
if 1.40000000000000007e-15 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6491.8%
Simplified91.8%
(FPCore (x y z)
:precision binary64
(if (<= y -61.0)
(+ x 1.0)
(if (<= y 2e+17)
(+ 1.0 (+ x (* y (- (* y (+ -0.5 (* (* y z) 0.16666666666666666))) z))))
(+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -61.0) {
tmp = x + 1.0;
} else if (y <= 2e+17) {
tmp = 1.0 + (x + (y * ((y * (-0.5 + ((y * z) * 0.16666666666666666))) - 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 <= (-61.0d0)) then
tmp = x + 1.0d0
else if (y <= 2d+17) then
tmp = 1.0d0 + (x + (y * ((y * ((-0.5d0) + ((y * z) * 0.16666666666666666d0))) - 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 <= -61.0) {
tmp = x + 1.0;
} else if (y <= 2e+17) {
tmp = 1.0 + (x + (y * ((y * (-0.5 + ((y * z) * 0.16666666666666666))) - z)));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -61.0: tmp = x + 1.0 elif y <= 2e+17: tmp = 1.0 + (x + (y * ((y * (-0.5 + ((y * z) * 0.16666666666666666))) - z))) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -61.0) tmp = Float64(x + 1.0); elseif (y <= 2e+17) tmp = Float64(1.0 + Float64(x + Float64(y * Float64(Float64(y * Float64(-0.5 + Float64(Float64(y * z) * 0.16666666666666666))) - z)))); else tmp = Float64(x + 1.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -61.0) tmp = x + 1.0; elseif (y <= 2e+17) tmp = 1.0 + (x + (y * ((y * (-0.5 + ((y * z) * 0.16666666666666666))) - z))); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -61.0], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 2e+17], N[(1.0 + N[(x + N[(y * N[(N[(y * N[(-0.5 + N[(N[(y * z), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -61:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+17}:\\
\;\;\;\;1 + \left(x + y \cdot \left(y \cdot \left(-0.5 + \left(y \cdot z\right) \cdot 0.16666666666666666\right) - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -61 or 2e17 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6440.5%
Simplified40.5%
if -61 < y < 2e17Initial program 100.0%
Taylor expanded in y around 0
+-lowering-+.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6498.7%
Simplified98.7%
(FPCore (x y z) :precision binary64 (if (<= y -4.7) (+ x 1.0) (if (<= y 4.8) (+ (+ x 1.0) (* y (- (* y -0.5) z))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.7) {
tmp = x + 1.0;
} else if (y <= 4.8) {
tmp = (x + 1.0) + (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 (y <= (-4.7d0)) then
tmp = x + 1.0d0
else if (y <= 4.8d0) then
tmp = (x + 1.0d0) + (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 (y <= -4.7) {
tmp = x + 1.0;
} else if (y <= 4.8) {
tmp = (x + 1.0) + (y * ((y * -0.5) - z));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.7: tmp = x + 1.0 elif y <= 4.8: tmp = (x + 1.0) + (y * ((y * -0.5) - z)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.7) tmp = Float64(x + 1.0); elseif (y <= 4.8) tmp = Float64(Float64(x + 1.0) + 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 (y <= -4.7) tmp = x + 1.0; elseif (y <= 4.8) tmp = (x + 1.0) + (y * ((y * -0.5) - z)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.7], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 4.8], N[(N[(x + 1.0), $MachinePrecision] + N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.7:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 4.8:\\
\;\;\;\;\left(x + 1\right) + y \cdot \left(y \cdot -0.5 - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -4.70000000000000018 or 4.79999999999999982 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6440.9%
Simplified40.9%
if -4.70000000000000018 < y < 4.79999999999999982Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-lowering-+.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f64100.0%
Simplified100.0%
(FPCore (x y z) :precision binary64 (if (<= y -4.4e+146) (+ x 1.0) (if (<= y 2e-22) (+ x (- 1.0 (* y z))) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e+146) {
tmp = x + 1.0;
} else if (y <= 2e-22) {
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 <= (-4.4d+146)) then
tmp = x + 1.0d0
else if (y <= 2d-22) 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 <= -4.4e+146) {
tmp = x + 1.0;
} else if (y <= 2e-22) {
tmp = x + (1.0 - (y * z));
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.4e+146: tmp = x + 1.0 elif y <= 2e-22: tmp = x + (1.0 - (y * z)) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.4e+146) tmp = Float64(x + 1.0); elseif (y <= 2e-22) 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 <= -4.4e+146) tmp = x + 1.0; elseif (y <= 2e-22) tmp = x + (1.0 - (y * z)); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.4e+146], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 2e-22], 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 -4.4 \cdot 10^{+146}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-22}:\\
\;\;\;\;x + \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -4.3999999999999996e146 or 2.0000000000000001e-22 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6439.8%
Simplified39.8%
if -4.3999999999999996e146 < y < 2.0000000000000001e-22Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-lowering-*.f6492.3%
Simplified92.3%
(FPCore (x y z) :precision binary64 (if (<= x -46000000000.0) x (if (<= x 5.2e-16) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -46000000000.0) {
tmp = x;
} else if (x <= 5.2e-16) {
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 <= (-46000000000.0d0)) then
tmp = x
else if (x <= 5.2d-16) 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 <= -46000000000.0) {
tmp = x;
} else if (x <= 5.2e-16) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -46000000000.0: tmp = x elif x <= 5.2e-16: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -46000000000.0) tmp = x; elseif (x <= 5.2e-16) 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 <= -46000000000.0) tmp = x; elseif (x <= 5.2e-16) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -46000000000.0], x, If[LessEqual[x, 5.2e-16], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -46000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-16}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -4.6e10Initial program 99.9%
Taylor expanded in x around inf
Simplified82.2%
if -4.6e10 < x < 5.1999999999999997e-16Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-lowering-*.f6454.1%
Simplified54.1%
Taylor expanded in x around 0
--lowering--.f64N/A
*-lowering-*.f6454.0%
Simplified54.0%
if 5.1999999999999997e-16 < x Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6491.8%
Simplified91.8%
(FPCore (x y z) :precision binary64 (if (<= x -46000000000.0) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -46000000000.0) {
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 <= (-46000000000.0d0)) 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 <= -46000000000.0) {
tmp = x;
} else if (x <= 1.0) {
tmp = 1.0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -46000000000.0: tmp = x elif x <= 1.0: tmp = 1.0 else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -46000000000.0) 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 <= -46000000000.0) tmp = x; elseif (x <= 1.0) tmp = 1.0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -46000000000.0], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -46000000000:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.6e10 or 1 < x Initial program 100.0%
Taylor expanded in x around inf
Simplified86.1%
if -4.6e10 < x < 1Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6442.3%
Simplified42.3%
Taylor expanded in x around 0
Simplified41.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
+-commutativeN/A
+-lowering-+.f6465.0%
Simplified65.0%
(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 y around 0
+-commutativeN/A
+-lowering-+.f6465.0%
Simplified65.0%
Taylor expanded in x around 0
Simplified22.0%
herbie shell --seed 2024138
(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))))