
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
double code(double x, double y, double z) {
return (x * (sin(y) / y)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * (sin(y) / y)) / z
end function
public static double code(double x, double y, double z) {
return (x * (Math.sin(y) / y)) / z;
}
def code(x, y, z): return (x * (math.sin(y) / y)) / z
function code(x, y, z) return Float64(Float64(x * Float64(sin(y) / y)) / z) end
function tmp = code(x, y, z) tmp = (x * (sin(y) / y)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\sin y}{y}}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (/ (sin y) y)) z))
double code(double x, double y, double z) {
return (x * (sin(y) / y)) / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (x * (sin(y) / y)) / z
end function
public static double code(double x, double y, double z) {
return (x * (Math.sin(y) / y)) / z;
}
def code(x, y, z): return (x * (math.sin(y) / y)) / z
function code(x, y, z) return Float64(Float64(x * Float64(sin(y) / y)) / z) end
function tmp = code(x, y, z) tmp = (x * (sin(y) / y)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\sin y}{y}}{z}
\end{array}
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (sin y) y))) (if (<= (* x t_0) -2e-264) (/ (/ x (/ y (sin y))) z) (/ x (/ z t_0)))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double tmp;
if ((x * t_0) <= -2e-264) {
tmp = (x / (y / sin(y))) / z;
} else {
tmp = x / (z / 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) / y
if ((x * t_0) <= (-2d-264)) then
tmp = (x / (y / sin(y))) / z
else
tmp = x / (z / t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) / y;
double tmp;
if ((x * t_0) <= -2e-264) {
tmp = (x / (y / Math.sin(y))) / z;
} else {
tmp = x / (z / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y tmp = 0 if (x * t_0) <= -2e-264: tmp = (x / (y / math.sin(y))) / z else: tmp = x / (z / t_0) return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) tmp = 0.0 if (Float64(x * t_0) <= -2e-264) tmp = Float64(Float64(x / Float64(y / sin(y))) / z); else tmp = Float64(x / Float64(z / t_0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) / y; tmp = 0.0; if ((x * t_0) <= -2e-264) tmp = (x / (y / sin(y))) / z; else tmp = x / (z / t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[N[(x * t$95$0), $MachinePrecision], -2e-264], N[(N[(x / N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(x / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
\mathbf{if}\;x \cdot t_0 \leq -2 \cdot 10^{-264}:\\
\;\;\;\;\frac{\frac{x}{\frac{y}{\sin y}}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\end{array}
\end{array}
if (*.f64 x (/.f64 (sin.f64 y) y)) < -2e-264Initial program 99.8%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
if -2e-264 < (*.f64 x (/.f64 (sin.f64 y) y)) Initial program 92.6%
associate-/l*98.6%
Simplified98.6%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (sin y) y)) (t_1 (* x t_0))) (if (<= t_1 -2e-264) (/ t_1 z) (/ x (/ z t_0)))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double t_1 = x * t_0;
double tmp;
if (t_1 <= -2e-264) {
tmp = t_1 / z;
} else {
tmp = x / (z / 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) :: t_1
real(8) :: tmp
t_0 = sin(y) / y
t_1 = x * t_0
if (t_1 <= (-2d-264)) then
tmp = t_1 / z
else
tmp = x / (z / t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) / y;
double t_1 = x * t_0;
double tmp;
if (t_1 <= -2e-264) {
tmp = t_1 / z;
} else {
tmp = x / (z / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y t_1 = x * t_0 tmp = 0 if t_1 <= -2e-264: tmp = t_1 / z else: tmp = x / (z / t_0) return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) t_1 = Float64(x * t_0) tmp = 0.0 if (t_1 <= -2e-264) tmp = Float64(t_1 / z); else tmp = Float64(x / Float64(z / t_0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) / y; t_1 = x * t_0; tmp = 0.0; if (t_1 <= -2e-264) tmp = t_1 / z; else tmp = x / (z / t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(x * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-264], N[(t$95$1 / z), $MachinePrecision], N[(x / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
t_1 := x \cdot t_0\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{-264}:\\
\;\;\;\;\frac{t_1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\end{array}
\end{array}
if (*.f64 x (/.f64 (sin.f64 y) y)) < -2e-264Initial program 99.8%
if -2e-264 < (*.f64 x (/.f64 (sin.f64 y) y)) Initial program 92.6%
associate-/l*98.6%
Simplified98.6%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (if (<= y 2.6e-5) (/ x (* z (+ 1.0 (* y (* y 0.16666666666666666))))) (* (sin y) (/ x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.6e-5) {
tmp = x / (z * (1.0 + (y * (y * 0.16666666666666666))));
} else {
tmp = sin(y) * (x / (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 2.6d-5) then
tmp = x / (z * (1.0d0 + (y * (y * 0.16666666666666666d0))))
else
tmp = sin(y) * (x / (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.6e-5) {
tmp = x / (z * (1.0 + (y * (y * 0.16666666666666666))));
} else {
tmp = Math.sin(y) * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.6e-5: tmp = x / (z * (1.0 + (y * (y * 0.16666666666666666)))) else: tmp = math.sin(y) * (x / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.6e-5) tmp = Float64(x / Float64(z * Float64(1.0 + Float64(y * Float64(y * 0.16666666666666666))))); else tmp = Float64(sin(y) * Float64(x / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.6e-5) tmp = x / (z * (1.0 + (y * (y * 0.16666666666666666)))); else tmp = sin(y) * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.6e-5], N[(x / N[(z * N[(1.0 + N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{z \cdot \left(1 + y \cdot \left(y \cdot 0.16666666666666666\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 2.59999999999999984e-5Initial program 98.2%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in y around 0 82.8%
*-commutative82.8%
unpow282.8%
Simplified82.8%
Taylor expanded in z around 0 82.8%
unpow282.8%
*-commutative82.8%
associate-*l*82.8%
Simplified82.8%
if 2.59999999999999984e-5 < y Initial program 87.5%
associate-/l*96.6%
associate-/r/96.5%
associate-/l/87.5%
associate-/r/87.4%
associate-/r*96.6%
Simplified96.6%
Final simplification86.2%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (sin y) y))) (if (<= z -1e+49) (* t_0 (/ x z)) (/ x (/ z t_0)))))
double code(double x, double y, double z) {
double t_0 = sin(y) / y;
double tmp;
if (z <= -1e+49) {
tmp = t_0 * (x / z);
} else {
tmp = x / (z / 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) / y
if (z <= (-1d+49)) then
tmp = t_0 * (x / z)
else
tmp = x / (z / t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.sin(y) / y;
double tmp;
if (z <= -1e+49) {
tmp = t_0 * (x / z);
} else {
tmp = x / (z / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = math.sin(y) / y tmp = 0 if z <= -1e+49: tmp = t_0 * (x / z) else: tmp = x / (z / t_0) return tmp
function code(x, y, z) t_0 = Float64(sin(y) / y) tmp = 0.0 if (z <= -1e+49) tmp = Float64(t_0 * Float64(x / z)); else tmp = Float64(x / Float64(z / t_0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = sin(y) / y; tmp = 0.0; if (z <= -1e+49) tmp = t_0 * (x / z); else tmp = x / (z / t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[z, -1e+49], N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin y}{y}\\
\mathbf{if}\;z \leq -1 \cdot 10^{+49}:\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\end{array}
\end{array}
if z < -9.99999999999999946e48Initial program 99.9%
*-commutative99.9%
associate-*r/99.9%
Simplified99.9%
if -9.99999999999999946e48 < z Initial program 94.3%
associate-/l*97.9%
Simplified97.9%
Final simplification98.4%
(FPCore (x y z) :precision binary64 (* (/ (sin y) y) (/ x z)))
double code(double x, double y, double z) {
return (sin(y) / y) * (x / z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (sin(y) / y) * (x / z)
end function
public static double code(double x, double y, double z) {
return (Math.sin(y) / y) * (x / z);
}
def code(x, y, z): return (math.sin(y) / y) * (x / z)
function code(x, y, z) return Float64(Float64(sin(y) / y) * Float64(x / z)) end
function tmp = code(x, y, z) tmp = (sin(y) / y) * (x / z); end
code[x_, y_, z_] := N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin y}{y} \cdot \frac{x}{z}
\end{array}
Initial program 95.5%
*-commutative95.5%
associate-*r/95.7%
Simplified95.7%
Final simplification95.7%
(FPCore (x y z) :precision binary64 (if (<= y 2.65) (/ x z) (* 6.0 (/ x (* z (* y y))))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.65) {
tmp = x / z;
} else {
tmp = 6.0 * (x / (z * (y * 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 (y <= 2.65d0) then
tmp = x / z
else
tmp = 6.0d0 * (x / (z * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.65) {
tmp = x / z;
} else {
tmp = 6.0 * (x / (z * (y * y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.65: tmp = x / z else: tmp = 6.0 * (x / (z * (y * y))) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.65) tmp = Float64(x / z); else tmp = Float64(6.0 * Float64(x / Float64(z * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.65) tmp = x / z; else tmp = 6.0 * (x / (z * (y * y))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.65], N[(x / z), $MachinePrecision], N[(6.0 * N[(x / N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.65:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \frac{x}{z \cdot \left(y \cdot y\right)}\\
\end{array}
\end{array}
if y < 2.64999999999999991Initial program 98.2%
associate-/l*96.1%
associate-/r/81.7%
associate-/l/78.2%
associate-/r/78.1%
associate-/r*76.9%
Simplified76.9%
Taylor expanded in y around 0 75.6%
if 2.64999999999999991 < y Initial program 87.1%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in y around 0 31.0%
*-commutative31.0%
unpow231.0%
Simplified31.0%
Taylor expanded in y around inf 31.0%
unpow231.0%
*-commutative31.0%
Simplified31.0%
Final simplification65.0%
(FPCore (x y z) :precision binary64 (/ x (* z (+ 1.0 (* y (* y 0.16666666666666666))))))
double code(double x, double y, double z) {
return x / (z * (1.0 + (y * (y * 0.16666666666666666))));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x / (z * (1.0d0 + (y * (y * 0.16666666666666666d0))))
end function
public static double code(double x, double y, double z) {
return x / (z * (1.0 + (y * (y * 0.16666666666666666))));
}
def code(x, y, z): return x / (z * (1.0 + (y * (y * 0.16666666666666666))))
function code(x, y, z) return Float64(x / Float64(z * Float64(1.0 + Float64(y * Float64(y * 0.16666666666666666))))) end
function tmp = code(x, y, z) tmp = x / (z * (1.0 + (y * (y * 0.16666666666666666)))); end
code[x_, y_, z_] := N[(x / N[(z * N[(1.0 + N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z \cdot \left(1 + y \cdot \left(y \cdot 0.16666666666666666\right)\right)}
\end{array}
Initial program 95.5%
associate-/l*96.2%
Simplified96.2%
Taylor expanded in y around 0 70.5%
*-commutative70.5%
unpow270.5%
Simplified70.5%
Taylor expanded in z around 0 70.5%
unpow270.5%
*-commutative70.5%
associate-*l*70.5%
Simplified70.5%
Final simplification70.5%
(FPCore (x y z) :precision binary64 (if (<= y 2.15e-5) (/ x z) (* y (/ x (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.15e-5) {
tmp = x / z;
} else {
tmp = y * (x / (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 2.15d-5) then
tmp = x / z
else
tmp = y * (x / (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 2.15e-5) {
tmp = x / z;
} else {
tmp = y * (x / (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 2.15e-5: tmp = x / z else: tmp = y * (x / (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 2.15e-5) tmp = Float64(x / z); else tmp = Float64(y * Float64(x / Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 2.15e-5) tmp = x / z; else tmp = y * (x / (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 2.15e-5], N[(x / z), $MachinePrecision], N[(y * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.15 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{y \cdot z}\\
\end{array}
\end{array}
if y < 2.1500000000000001e-5Initial program 98.2%
associate-/l*96.0%
associate-/r/81.4%
associate-/l/77.8%
associate-/r/77.7%
associate-/r*76.5%
Simplified76.5%
Taylor expanded in y around 0 75.8%
if 2.1500000000000001e-5 < y Initial program 87.7%
associate-/l*96.6%
Simplified96.6%
*-un-lft-identity96.6%
associate-/r/96.6%
times-frac87.6%
Applied egg-rr87.6%
Taylor expanded in y around 0 25.7%
*-commutative25.7%
clear-num25.7%
un-div-inv25.8%
Applied egg-rr25.8%
associate-/r/32.1%
associate-/l/30.5%
Applied egg-rr30.5%
Final simplification64.5%
(FPCore (x y z) :precision binary64 (if (<= y 5.6e-31) (/ x z) (/ y (* z (/ y x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 5.6e-31) {
tmp = x / z;
} else {
tmp = y / (z * (y / 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 (y <= 5.6d-31) then
tmp = x / z
else
tmp = y / (z * (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 5.6e-31) {
tmp = x / z;
} else {
tmp = y / (z * (y / x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 5.6e-31: tmp = x / z else: tmp = y / (z * (y / x)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 5.6e-31) tmp = Float64(x / z); else tmp = Float64(y / Float64(z * Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 5.6e-31) tmp = x / z; else tmp = y / (z * (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 5.6e-31], N[(x / z), $MachinePrecision], N[(y / N[(z * N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.6 \cdot 10^{-31}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z \cdot \frac{y}{x}}\\
\end{array}
\end{array}
if y < 5.5999999999999998e-31Initial program 98.2%
associate-/l*96.0%
associate-/r/81.2%
associate-/l/77.6%
associate-/r/77.5%
associate-/r*76.3%
Simplified76.3%
Taylor expanded in y around 0 75.8%
if 5.5999999999999998e-31 < y Initial program 88.0%
associate-/l*96.7%
Simplified96.7%
*-un-lft-identity96.7%
associate-/r/96.7%
times-frac88.0%
Applied egg-rr88.0%
Taylor expanded in y around 0 27.3%
*-commutative27.3%
clear-num27.3%
frac-times33.4%
*-un-lft-identity33.4%
Applied egg-rr33.4%
Final simplification64.9%
(FPCore (x y z) :precision binary64 (/ x z))
double code(double x, double y, double z) {
return x / z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x / z
end function
public static double code(double x, double y, double z) {
return x / z;
}
def code(x, y, z): return x / z
function code(x, y, z) return Float64(x / z) end
function tmp = code(x, y, z) tmp = x / z; end
code[x_, y_, z_] := N[(x / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z}
\end{array}
Initial program 95.5%
associate-/l*96.2%
associate-/r/85.2%
associate-/l/80.3%
associate-/r/80.2%
associate-/r*81.5%
Simplified81.5%
Taylor expanded in y around 0 61.5%
Final simplification61.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ y (sin y))) (t_1 (/ (* x (/ 1.0 t_0)) z)))
(if (< z -4.2173720203427147e-29)
t_1
(if (< z 4.446702369113811e+64) (/ x (* z t_0)) t_1))))
double code(double x, double y, double z) {
double t_0 = y / sin(y);
double t_1 = (x * (1.0 / t_0)) / z;
double tmp;
if (z < -4.2173720203427147e-29) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x / (z * 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 = y / sin(y)
t_1 = (x * (1.0d0 / t_0)) / z
if (z < (-4.2173720203427147d-29)) then
tmp = t_1
else if (z < 4.446702369113811d+64) then
tmp = x / (z * 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 = y / Math.sin(y);
double t_1 = (x * (1.0 / t_0)) / z;
double tmp;
if (z < -4.2173720203427147e-29) {
tmp = t_1;
} else if (z < 4.446702369113811e+64) {
tmp = x / (z * t_0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = y / math.sin(y) t_1 = (x * (1.0 / t_0)) / z tmp = 0 if z < -4.2173720203427147e-29: tmp = t_1 elif z < 4.446702369113811e+64: tmp = x / (z * t_0) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(y / sin(y)) t_1 = Float64(Float64(x * Float64(1.0 / t_0)) / z) tmp = 0.0 if (z < -4.2173720203427147e-29) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = Float64(x / Float64(z * t_0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = y / sin(y); t_1 = (x * (1.0 / t_0)) / z; tmp = 0.0; if (z < -4.2173720203427147e-29) tmp = t_1; elseif (z < 4.446702369113811e+64) tmp = x / (z * t_0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[Less[z, -4.2173720203427147e-29], t$95$1, If[Less[z, 4.446702369113811e+64], N[(x / N[(z * t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{\sin y}\\
t_1 := \frac{x \cdot \frac{1}{t_0}}{z}\\
\mathbf{if}\;z < -4.2173720203427147 \cdot 10^{-29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z < 4.446702369113811 \cdot 10^{+64}:\\
\;\;\;\;\frac{x}{z \cdot t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023279
(FPCore (x y z)
:name "Linear.Quaternion:$ctanh from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< z -4.2173720203427147e-29) (/ (* x (/ 1.0 (/ y (sin y)))) z) (if (< z 4.446702369113811e+64) (/ x (* z (/ y (sin y)))) (/ (* x (/ 1.0 (/ y (sin y)))) z)))
(/ (* x (/ (sin y) y)) z))