
(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 (+ x (cos y)))
(t_1 (* z (sin y)))
(t_2 (- t_0 t_1))
(t_3 (- x t_1)))
(if (<= t_2 -100000000000.0) t_3 (if (<= t_2 40000000000000.0) t_0 t_3))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double t_1 = z * sin(y);
double t_2 = t_0 - t_1;
double t_3 = x - t_1;
double tmp;
if (t_2 <= -100000000000.0) {
tmp = t_3;
} else if (t_2 <= 40000000000000.0) {
tmp = t_0;
} else {
tmp = t_3;
}
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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = x + cos(y)
t_1 = z * sin(y)
t_2 = t_0 - t_1
t_3 = x - t_1
if (t_2 <= (-100000000000.0d0)) then
tmp = t_3
else if (t_2 <= 40000000000000.0d0) then
tmp = t_0
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + Math.cos(y);
double t_1 = z * Math.sin(y);
double t_2 = t_0 - t_1;
double t_3 = x - t_1;
double tmp;
if (t_2 <= -100000000000.0) {
tmp = t_3;
} else if (t_2 <= 40000000000000.0) {
tmp = t_0;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z): t_0 = x + math.cos(y) t_1 = z * math.sin(y) t_2 = t_0 - t_1 t_3 = x - t_1 tmp = 0 if t_2 <= -100000000000.0: tmp = t_3 elif t_2 <= 40000000000000.0: tmp = t_0 else: tmp = t_3 return tmp
function code(x, y, z) t_0 = Float64(x + cos(y)) t_1 = Float64(z * sin(y)) t_2 = Float64(t_0 - t_1) t_3 = Float64(x - t_1) tmp = 0.0 if (t_2 <= -100000000000.0) tmp = t_3; elseif (t_2 <= 40000000000000.0) tmp = t_0; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + cos(y); t_1 = z * sin(y); t_2 = t_0 - t_1; t_3 = x - t_1; tmp = 0.0; if (t_2 <= -100000000000.0) tmp = t_3; elseif (t_2 <= 40000000000000.0) tmp = t_0; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(x - t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -100000000000.0], t$95$3, If[LessEqual[t$95$2, 40000000000000.0], t$95$0, t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
t_1 := z \cdot \sin y\\
t_2 := t\_0 - t\_1\\
t_3 := x - t\_1\\
\mathbf{if}\;t\_2 \leq -100000000000:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 40000000000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < -1e11 or 4e13 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) Initial program 99.9%
Taylor expanded in x around inf
Simplified99.8%
if -1e11 < (-.f64 (+.f64 x (cos.f64 y)) (*.f64 z (sin.f64 y))) < 4e13Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f6498.2
Simplified98.2%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* (sin y) (- z)))) (if (<= z -3.6e+181) t_0 (if (<= z 8e+66) (+ x (cos y)) t_0))))
double code(double x, double y, double z) {
double t_0 = sin(y) * -z;
double tmp;
if (z <= -3.6e+181) {
tmp = t_0;
} else if (z <= 8e+66) {
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 = sin(y) * -z
if (z <= (-3.6d+181)) then
tmp = t_0
else if (z <= 8d+66) 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 = Math.sin(y) * -z;
double tmp;
if (z <= -3.6e+181) {
tmp = t_0;
} else if (z <= 8e+66) {
tmp = x + Math.cos(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) * -z tmp = 0 if z <= -3.6e+181: tmp = t_0 elif z <= 8e+66: tmp = x + math.cos(y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(sin(y) * Float64(-z)) tmp = 0.0 if (z <= -3.6e+181) tmp = t_0; elseif (z <= 8e+66) tmp = Float64(x + cos(y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) * -z; tmp = 0.0; if (z <= -3.6e+181) tmp = t_0; elseif (z <= 8e+66) tmp = x + cos(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * (-z)), $MachinePrecision]}, If[LessEqual[z, -3.6e+181], t$95$0, If[LessEqual[z, 8e+66], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot \left(-z\right)\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+181}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+66}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.59999999999999985e181 or 7.99999999999999956e66 < z Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f64N/A
sin-lowering-sin.f6473.0
Simplified73.0%
if -3.59999999999999985e181 < z < 7.99999999999999956e66Initial program 100.0%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f6490.7
Simplified90.7%
Final simplification84.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ x (cos y)))) (if (<= y -0.023) t_0 (if (<= y 19000.0) (+ 1.0 (fma y (- z) x)) t_0))))
double code(double x, double y, double z) {
double t_0 = x + cos(y);
double tmp;
if (y <= -0.023) {
tmp = t_0;
} else if (y <= 19000.0) {
tmp = 1.0 + fma(y, -z, x);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(x + cos(y)) tmp = 0.0 if (y <= -0.023) tmp = t_0; elseif (y <= 19000.0) tmp = Float64(1.0 + fma(y, Float64(-z), x)); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.023], t$95$0, If[LessEqual[y, 19000.0], N[(1.0 + N[(y * (-z) + x), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \cos y\\
\mathbf{if}\;y \leq -0.023:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 19000:\\
\;\;\;\;1 + \mathsf{fma}\left(y, -z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -0.023 or 19000 < y Initial program 99.9%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
cos-lowering-cos.f6463.9
Simplified63.9%
if -0.023 < y < 19000Initial program 100.0%
Taylor expanded in y around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
neg-lowering-neg.f6499.1
Simplified99.1%
Taylor expanded in y around 0
mul-1-negN/A
neg-lowering-neg.f6499.2
Simplified99.2%
Final simplification79.9%
(FPCore (x y z)
:precision binary64
(if (<= y -6.5e+44)
(+ x 1.0)
(if (<= y 6e+71)
(+ 1.0 (fma y (fma y (* y (* z 0.16666666666666666)) (- z)) x))
(+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6.5e+44) {
tmp = x + 1.0;
} else if (y <= 6e+71) {
tmp = 1.0 + fma(y, fma(y, (y * (z * 0.16666666666666666)), -z), x);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -6.5e+44) tmp = Float64(x + 1.0); elseif (y <= 6e+71) tmp = Float64(1.0 + fma(y, fma(y, Float64(y * Float64(z * 0.16666666666666666)), Float64(-z)), x)); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -6.5e+44], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 6e+71], N[(1.0 + N[(y * N[(y * N[(y * N[(z * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + (-z)), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+44}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+71}:\\
\;\;\;\;1 + \mathsf{fma}\left(y, \mathsf{fma}\left(y, y \cdot \left(z \cdot 0.16666666666666666\right), -z\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -6.50000000000000018e44 or 6.00000000000000025e71 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6443.2
Simplified43.2%
if -6.50000000000000018e44 < y < 6.00000000000000025e71Initial program 100.0%
Taylor expanded in y around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
neg-lowering-neg.f6484.5
Simplified84.5%
Taylor expanded in y around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6486.3
Simplified86.3%
(FPCore (x y z) :precision binary64 (if (<= y -47.0) (+ x 1.0) (if (<= y 300000000.0) (fma y (- (* y -0.5) z) (+ x 1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -47.0) {
tmp = x + 1.0;
} else if (y <= 300000000.0) {
tmp = fma(y, ((y * -0.5) - z), (x + 1.0));
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -47.0) tmp = Float64(x + 1.0); elseif (y <= 300000000.0) tmp = fma(y, Float64(Float64(y * -0.5) - z), Float64(x + 1.0)); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -47.0], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 300000000.0], N[(y * N[(N[(y * -0.5), $MachinePrecision] - z), $MachinePrecision] + N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -47:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 300000000:\\
\;\;\;\;\mathsf{fma}\left(y, y \cdot -0.5 - z, x + 1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -47 or 3e8 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6441.1
Simplified41.1%
if -47 < y < 3e8Initial program 100.0%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6497.8
Simplified97.8%
(FPCore (x y z) :precision binary64 (if (<= y -3.5e+40) (+ x 1.0) (if (<= y 2.7e+60) (+ 1.0 (fma y (- z) x)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.5e+40) {
tmp = x + 1.0;
} else if (y <= 2.7e+60) {
tmp = 1.0 + fma(y, -z, x);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -3.5e+40) tmp = Float64(x + 1.0); elseif (y <= 2.7e+60) tmp = Float64(1.0 + fma(y, Float64(-z), x)); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -3.5e+40], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 2.7e+60], N[(1.0 + N[(y * (-z) + x), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+40}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+60}:\\
\;\;\;\;1 + \mathsf{fma}\left(y, -z, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -3.4999999999999999e40 or 2.6999999999999999e60 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6441.5
Simplified41.5%
if -3.4999999999999999e40 < y < 2.6999999999999999e60Initial program 100.0%
Taylor expanded in y around 0
+-lowering-+.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
neg-lowering-neg.f6487.4
Simplified87.4%
Taylor expanded in y around 0
mul-1-negN/A
neg-lowering-neg.f6489.3
Simplified89.3%
(FPCore (x y z) :precision binary64 (if (<= y -4.4e+40) (+ x 1.0) (if (<= y 2.7e+60) (- x (fma y z -1.0)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e+40) {
tmp = x + 1.0;
} else if (y <= 2.7e+60) {
tmp = x - fma(y, z, -1.0);
} else {
tmp = x + 1.0;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= -4.4e+40) tmp = Float64(x + 1.0); elseif (y <= 2.7e+60) tmp = Float64(x - fma(y, z, -1.0)); else tmp = Float64(x + 1.0); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, -4.4e+40], N[(x + 1.0), $MachinePrecision], If[LessEqual[y, 2.7e+60], N[(x - N[(y * z + -1.0), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+40}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+60}:\\
\;\;\;\;x - \mathsf{fma}\left(y, z, -1\right)\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if y < -4.3999999999999998e40 or 2.6999999999999999e60 < y Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6441.5
Simplified41.5%
if -4.3999999999999998e40 < y < 2.6999999999999999e60Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6489.3
Simplified89.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- x (* y z)))) (if (<= z -2.2e+181) t_0 (if (<= z 4.7e+234) (+ x 1.0) t_0))))
double code(double x, double y, double z) {
double t_0 = x - (y * z);
double tmp;
if (z <= -2.2e+181) {
tmp = t_0;
} else if (z <= 4.7e+234) {
tmp = x + 1.0;
} 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 - (y * z)
if (z <= (-2.2d+181)) then
tmp = t_0
else if (z <= 4.7d+234) then
tmp = x + 1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x - (y * z);
double tmp;
if (z <= -2.2e+181) {
tmp = t_0;
} else if (z <= 4.7e+234) {
tmp = x + 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x - (y * z) tmp = 0 if z <= -2.2e+181: tmp = t_0 elif z <= 4.7e+234: tmp = x + 1.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x - Float64(y * z)) tmp = 0.0 if (z <= -2.2e+181) tmp = t_0; elseif (z <= 4.7e+234) tmp = Float64(x + 1.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x - (y * z); tmp = 0.0; if (z <= -2.2e+181) tmp = t_0; elseif (z <= 4.7e+234) tmp = x + 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.2e+181], t$95$0, If[LessEqual[z, 4.7e+234], N[(x + 1.0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x - y \cdot z\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+181}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{+234}:\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -2.2000000000000001e181 or 4.6999999999999999e234 < z Initial program 99.8%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6452.8
Simplified52.8%
Taylor expanded in y around inf
*-lowering-*.f6450.6
Simplified50.6%
if -2.2000000000000001e181 < z < 4.6999999999999999e234Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6466.8
Simplified66.8%
(FPCore (x y z) :precision binary64 (if (<= x -4e-5) (+ x 1.0) (if (<= x 1.25e-54) (- 1.0 (* y z)) (+ x 1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4e-5) {
tmp = x + 1.0;
} else if (x <= 1.25e-54) {
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 <= (-4d-5)) then
tmp = x + 1.0d0
else if (x <= 1.25d-54) 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 <= -4e-5) {
tmp = x + 1.0;
} else if (x <= 1.25e-54) {
tmp = 1.0 - (y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -4e-5: tmp = x + 1.0 elif x <= 1.25e-54: tmp = 1.0 - (y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -4e-5) tmp = Float64(x + 1.0); elseif (x <= 1.25e-54) 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 <= -4e-5) tmp = x + 1.0; elseif (x <= 1.25e-54) tmp = 1.0 - (y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -4e-5], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 1.25e-54], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], N[(x + 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-5}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-54}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if x < -4.00000000000000033e-5 or 1.25000000000000004e-54 < x Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6476.6
Simplified76.6%
if -4.00000000000000033e-5 < x < 1.25000000000000004e-54Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6445.9
Simplified45.9%
Taylor expanded in x around 0
--lowering--.f64N/A
*-lowering-*.f6445.9
Simplified45.9%
(FPCore (x y z) :precision binary64 (if (<= z -6e+196) (- (* y z)) (+ x 1.0)))
double code(double x, double y, double z) {
double tmp;
if (z <= -6e+196) {
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 <= (-6d+196)) 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 <= -6e+196) {
tmp = -(y * z);
} else {
tmp = x + 1.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -6e+196: tmp = -(y * z) else: tmp = x + 1.0 return tmp
function code(x, y, z) tmp = 0.0 if (z <= -6e+196) tmp = Float64(-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 <= -6e+196) tmp = -(y * z); else tmp = x + 1.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -6e+196], (-N[(y * z), $MachinePrecision]), N[(x + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+196}:\\
\;\;\;\;-y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + 1\\
\end{array}
\end{array}
if z < -5.9999999999999997e196Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6450.5
Simplified50.5%
Taylor expanded in y around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f6445.4
Simplified45.4%
if -5.9999999999999997e196 < z Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
+-lowering-+.f6462.7
Simplified62.7%
Final simplification61.2%
(FPCore (x y z) :precision binary64 (if (<= x -150.0) x (if (<= x 1.0) 1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -150.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 <= (-150.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 <= -150.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 <= -150.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 <= -150.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 <= -150.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, -150.0], x, If[LessEqual[x, 1.0], 1.0, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -150:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -150 or 1 < x Initial program 99.9%
Taylor expanded in x around inf
Simplified78.5%
if -150 < x < 1Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6445.6
Simplified45.6%
Taylor expanded in y around 0
Simplified33.7%
Taylor expanded in x around 0
Simplified32.3%
(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-+.f6457.7
Simplified57.7%
(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
mul-1-negN/A
unsub-negN/A
associate-+l-N/A
--lowering--.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f6461.3
Simplified61.3%
Taylor expanded in y around 0
Simplified57.7%
Taylor expanded in x around 0
Simplified17.0%
herbie shell --seed 2024205
(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))))