
(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 10 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(x + Float64(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[(x + N[(N[Cos[y], $MachinePrecision] - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\cos y - z \cdot \sin y\right)
\end{array}
Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= z -1.16e+32) (- x (* z (sin y))) (if (<= z 1.25e+41) (+ x (cos y)) (fma (sin y) (- z) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.16e+32) {
tmp = x - (z * sin(y));
} else if (z <= 1.25e+41) {
tmp = x + cos(y);
} else {
tmp = fma(sin(y), -z, x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -1.16e+32) tmp = Float64(x - Float64(z * sin(y))); elseif (z <= 1.25e+41) tmp = Float64(x + cos(y)); else tmp = fma(sin(y), Float64(-z), x); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -1.16e+32], N[(x - N[(z * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.25e+41], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * (-z) + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.16 \cdot 10^{+32}:\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+41}:\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sin y, -z, x\right)\\
\end{array}
\end{array}
if z < -1.16e32Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in z around inf 84.9%
neg-mul-184.9%
*-commutative84.9%
distribute-rgt-neg-in84.9%
Simplified84.9%
Taylor expanded in x around 0 84.9%
neg-mul-184.9%
sub-neg84.9%
Simplified84.9%
if -1.16e32 < z < 1.25000000000000006e41Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around 0 97.3%
+-commutative97.3%
Simplified97.3%
if 1.25000000000000006e41 < z Initial program 99.5%
associate--l+99.5%
Simplified99.5%
Taylor expanded in z around inf 86.8%
neg-mul-186.8%
*-commutative86.8%
distribute-rgt-neg-in86.8%
Simplified86.8%
Taylor expanded in x around 0 86.8%
neg-mul-186.8%
+-commutative86.8%
*-commutative86.8%
distribute-rgt-neg-in86.8%
neg-mul-186.8%
fma-def86.9%
neg-mul-186.9%
Simplified86.9%
Final simplification92.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (sin y) (- z))))
(if (<= z -2.1e+169)
t_0
(if (<= z -1.12e+104)
(- (+ x 1.0) (* y z))
(if (or (<= z -1.5e+95) (not (<= z 1.65e+67))) t_0 (+ x (cos y)))))))
double code(double x, double y, double z) {
double t_0 = sin(y) * -z;
double tmp;
if (z <= -2.1e+169) {
tmp = t_0;
} else if (z <= -1.12e+104) {
tmp = (x + 1.0) - (y * z);
} else if ((z <= -1.5e+95) || !(z <= 1.65e+67)) {
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 <= (-2.1d+169)) then
tmp = t_0
else if (z <= (-1.12d+104)) then
tmp = (x + 1.0d0) - (y * z)
else if ((z <= (-1.5d+95)) .or. (.not. (z <= 1.65d+67))) 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 <= -2.1e+169) {
tmp = t_0;
} else if (z <= -1.12e+104) {
tmp = (x + 1.0) - (y * z);
} else if ((z <= -1.5e+95) || !(z <= 1.65e+67)) {
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 <= -2.1e+169: tmp = t_0 elif z <= -1.12e+104: tmp = (x + 1.0) - (y * z) elif (z <= -1.5e+95) or not (z <= 1.65e+67): 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 <= -2.1e+169) tmp = t_0; elseif (z <= -1.12e+104) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); elseif ((z <= -1.5e+95) || !(z <= 1.65e+67)) 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 <= -2.1e+169) tmp = t_0; elseif (z <= -1.12e+104) tmp = (x + 1.0) - (y * z); elseif ((z <= -1.5e+95) || ~((z <= 1.65e+67))) 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, -2.1e+169], t$95$0, If[LessEqual[z, -1.12e+104], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -1.5e+95], N[Not[LessEqual[z, 1.65e+67]], $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 -2.1 \cdot 10^{+169}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.12 \cdot 10^{+104}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{+95} \lor \neg \left(z \leq 1.65 \cdot 10^{+67}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -2.1000000000000001e169 or -1.12000000000000003e104 < z < -1.49999999999999996e95 or 1.6500000000000001e67 < z Initial program 99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in z around inf 88.1%
neg-mul-188.1%
*-commutative88.1%
distribute-rgt-neg-in88.1%
Simplified88.1%
Taylor expanded in x around 0 88.1%
neg-mul-188.1%
+-commutative88.1%
*-commutative88.1%
distribute-rgt-neg-in88.1%
neg-mul-188.1%
fma-def88.1%
neg-mul-188.1%
Simplified88.1%
Taylor expanded in z around inf 69.1%
mul-1-neg69.1%
*-commutative69.1%
distribute-rgt-neg-in69.1%
Simplified69.1%
if -2.1000000000000001e169 < z < -1.12000000000000003e104Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 74.7%
mul-1-neg74.7%
Simplified74.7%
associate-+r+74.7%
unsub-neg74.7%
*-commutative74.7%
Applied egg-rr74.7%
if -1.49999999999999996e95 < z < 1.6500000000000001e67Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around 0 93.8%
+-commutative93.8%
Simplified93.8%
Final simplification86.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -6e+32) (not (<= z 3.1e+40))) (- x (* z (sin y))) (+ x (cos y))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6e+32) || !(z <= 3.1e+40)) {
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 <= (-6d+32)) .or. (.not. (z <= 3.1d+40))) 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 <= -6e+32) || !(z <= 3.1e+40)) {
tmp = x - (z * Math.sin(y));
} else {
tmp = x + Math.cos(y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6e+32) or not (z <= 3.1e+40): tmp = x - (z * math.sin(y)) else: tmp = x + math.cos(y) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6e+32) || !(z <= 3.1e+40)) 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 <= -6e+32) || ~((z <= 3.1e+40))) tmp = x - (z * sin(y)); else tmp = x + cos(y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6e+32], N[Not[LessEqual[z, 3.1e+40]], $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 -6 \cdot 10^{+32} \lor \neg \left(z \leq 3.1 \cdot 10^{+40}\right):\\
\;\;\;\;x - z \cdot \sin y\\
\mathbf{else}:\\
\;\;\;\;x + \cos y\\
\end{array}
\end{array}
if z < -6e32 or 3.0999999999999998e40 < z Initial program 99.7%
associate--l+99.7%
Simplified99.7%
Taylor expanded in z around inf 85.8%
neg-mul-185.8%
*-commutative85.8%
distribute-rgt-neg-in85.8%
Simplified85.8%
Taylor expanded in x around 0 85.8%
neg-mul-185.8%
sub-neg85.8%
Simplified85.8%
if -6e32 < z < 3.0999999999999998e40Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in z around 0 97.3%
+-commutative97.3%
Simplified97.3%
Final simplification92.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -3.4e-7) (not (<= y 2400.0))) (+ x (cos y)) (- (+ x 1.0) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -3.4e-7) || !(y <= 2400.0)) {
tmp = x + cos(y);
} 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 <= (-3.4d-7)) .or. (.not. (y <= 2400.0d0))) then
tmp = x + cos(y)
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 <= -3.4e-7) || !(y <= 2400.0)) {
tmp = x + Math.cos(y);
} else {
tmp = (x + 1.0) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -3.4e-7) or not (y <= 2400.0): tmp = x + math.cos(y) else: tmp = (x + 1.0) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -3.4e-7) || !(y <= 2400.0)) tmp = Float64(x + cos(y)); else tmp = Float64(Float64(x + 1.0) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -3.4e-7) || ~((y <= 2400.0))) tmp = x + cos(y); else tmp = (x + 1.0) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -3.4e-7], N[Not[LessEqual[y, 2400.0]], $MachinePrecision]], N[(x + N[Cos[y], $MachinePrecision]), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{-7} \lor \neg \left(y \leq 2400\right):\\
\;\;\;\;x + \cos y\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\end{array}
\end{array}
if y < -3.39999999999999974e-7 or 2400 < y Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in z around 0 65.5%
+-commutative65.5%
Simplified65.5%
if -3.39999999999999974e-7 < y < 2400Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
Simplified99.2%
associate-+r+99.2%
unsub-neg99.2%
*-commutative99.2%
Applied egg-rr99.2%
Final simplification81.3%
(FPCore (x y z) :precision binary64 (if (<= x -3.2e-19) (- (+ x 1.0) (* y z)) (if (<= x 3.9e-22) (cos y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.2e-19) {
tmp = (x + 1.0) - (y * z);
} else if (x <= 3.9e-22) {
tmp = cos(y);
} 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 <= (-3.2d-19)) then
tmp = (x + 1.0d0) - (y * z)
else if (x <= 3.9d-22) then
tmp = cos(y)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -3.2e-19) {
tmp = (x + 1.0) - (y * z);
} else if (x <= 3.9e-22) {
tmp = Math.cos(y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.2e-19: tmp = (x + 1.0) - (y * z) elif x <= 3.9e-22: tmp = math.cos(y) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.2e-19) tmp = Float64(Float64(x + 1.0) - Float64(y * z)); elseif (x <= 3.9e-22) tmp = cos(y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -3.2e-19) tmp = (x + 1.0) - (y * z); elseif (x <= 3.9e-22) tmp = cos(y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.2e-19], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.9e-22], N[Cos[y], $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-19}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{-22}:\\
\;\;\;\;\cos y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.19999999999999982e-19Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 75.9%
mul-1-neg75.9%
Simplified75.9%
associate-+r+75.9%
unsub-neg75.9%
*-commutative75.9%
Applied egg-rr75.9%
if -3.19999999999999982e-19 < x < 3.89999999999999998e-22Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in z around 0 70.6%
+-commutative70.6%
Simplified70.6%
Taylor expanded in x around 0 70.6%
if 3.89999999999999998e-22 < x Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 82.4%
Final simplification75.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.05e+42) (not (<= y 18000.0))) (+ x 1.0) (- (+ x 1.0) (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.05e+42) || !(y <= 18000.0)) {
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 <= (-2.05d+42)) .or. (.not. (y <= 18000.0d0))) 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 <= -2.05e+42) || !(y <= 18000.0)) {
tmp = x + 1.0;
} else {
tmp = (x + 1.0) - (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.05e+42) or not (y <= 18000.0): tmp = x + 1.0 else: tmp = (x + 1.0) - (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.05e+42) || !(y <= 18000.0)) tmp = Float64(x + 1.0); else tmp = Float64(Float64(x + 1.0) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.05e+42) || ~((y <= 18000.0))) tmp = x + 1.0; else tmp = (x + 1.0) - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.05e+42], N[Not[LessEqual[y, 18000.0]], $MachinePrecision]], N[(x + 1.0), $MachinePrecision], N[(N[(x + 1.0), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.05 \cdot 10^{+42} \lor \neg \left(y \leq 18000\right):\\
\;\;\;\;x + 1\\
\mathbf{else}:\\
\;\;\;\;\left(x + 1\right) - y \cdot z\\
\end{array}
\end{array}
if y < -2.05e42 or 18000 < y Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in y around 0 38.7%
if -2.05e42 < y < 18000Initial program 100.0%
associate--l+100.0%
Simplified100.0%
Taylor expanded in y around 0 95.2%
mul-1-neg95.2%
Simplified95.2%
associate-+r+95.2%
unsub-neg95.2%
*-commutative95.2%
Applied egg-rr95.2%
Final simplification68.3%
(FPCore (x y z) :precision binary64 (if (<= x -1.35e-12) (+ x 1.0) (if (<= x 4.4e-14) (- 1.0 (* y z)) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.35e-12) {
tmp = x + 1.0;
} else if (x <= 4.4e-14) {
tmp = 1.0 - (y * z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= (-1.35d-12)) then
tmp = x + 1.0d0
else if (x <= 4.4d-14) then
tmp = 1.0d0 - (y * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.35e-12) {
tmp = x + 1.0;
} else if (x <= 4.4e-14) {
tmp = 1.0 - (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.35e-12: tmp = x + 1.0 elif x <= 4.4e-14: tmp = 1.0 - (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.35e-12) tmp = Float64(x + 1.0); elseif (x <= 4.4e-14) tmp = Float64(1.0 - Float64(y * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.35e-12) tmp = x + 1.0; elseif (x <= 4.4e-14) tmp = 1.0 - (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.35e-12], N[(x + 1.0), $MachinePrecision], If[LessEqual[x, 4.4e-14], N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{-12}:\\
\;\;\;\;x + 1\\
\mathbf{elif}\;x \leq 4.4 \cdot 10^{-14}:\\
\;\;\;\;1 - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.3499999999999999e-12Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 77.6%
if -1.3499999999999999e-12 < x < 4.4000000000000002e-14Initial program 99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in y around 0 50.4%
mul-1-neg50.4%
Simplified50.4%
Taylor expanded in x around 0 50.4%
*-commutative50.4%
Simplified50.4%
if 4.4000000000000002e-14 < x Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 83.7%
Final simplification65.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%
associate--l+99.9%
Simplified99.9%
Taylor expanded in y around 0 61.6%
Final simplification61.6%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
associate--l+99.9%
Simplified99.9%
Taylor expanded in x around inf 40.8%
Final simplification40.8%
herbie shell --seed 2023315
(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))))