
(FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
t_0 = cos((k / 2.0d0))
code = (((-2.0d0) * j) * t_0) * sqrt((1.0d0 + ((u / ((2.0d0 * j) * t_0)) ** 2.0d0)))
end function
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
return ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
}
def code(J, K, U): t_0 = math.cos((K / 2.0)) return ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0)))) end
function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0))); end
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(-2 \cdot J\right) \cdot t\_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t\_0}\right)}^{2}}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (J K U) :precision binary64 (let* ((t_0 (cos (/ K 2.0)))) (* (* (* -2.0 J) t_0) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
return ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
}
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: t_0
t_0 = cos((k / 2.0d0))
code = (((-2.0d0) * j) * t_0) * sqrt((1.0d0 + ((u / ((2.0d0 * j) * t_0)) ** 2.0d0)))
end function
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
return ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
}
def code(J, K, U): t_0 = math.cos((K / 2.0)) return ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
function code(J, K, U) t_0 = cos(Float64(K / 2.0)) return Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0)))) end
function tmp = code(J, K, U) t_0 = cos((K / 2.0)); tmp = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0))); end
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(-2 \cdot J\right) \cdot t\_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t\_0}\right)}^{2}}
\end{array}
\end{array}
U_m = (fabs.f64 U)
J\_m = (fabs.f64 J)
J\_s = (copysign.f64 #s(literal 1 binary64) J)
(FPCore (J_s J_m K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* t_0 (* -2.0 J_m))
(sqrt (+ 1.0 (pow (/ U_m (* t_0 (* J_m 2.0))) 2.0))))))
(* J_s (if (<= t_1 (- INFINITY)) (- U_m) (if (<= t_1 INFINITY) t_1 U_m)))))U_m = fabs(U);
J\_m = fabs(J);
J\_s = copysign(1.0, J);
double code(double J_s, double J_m, double K, double U_m) {
double t_0 = cos((K / 2.0));
double t_1 = (t_0 * (-2.0 * J_m)) * sqrt((1.0 + pow((U_m / (t_0 * (J_m * 2.0))), 2.0)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = -U_m;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = U_m;
}
return J_s * tmp;
}
U_m = Math.abs(U);
J\_m = Math.abs(J);
J\_s = Math.copySign(1.0, J);
public static double code(double J_s, double J_m, double K, double U_m) {
double t_0 = Math.cos((K / 2.0));
double t_1 = (t_0 * (-2.0 * J_m)) * Math.sqrt((1.0 + Math.pow((U_m / (t_0 * (J_m * 2.0))), 2.0)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = -U_m;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = U_m;
}
return J_s * tmp;
}
U_m = math.fabs(U) J\_m = math.fabs(J) J\_s = math.copysign(1.0, J) def code(J_s, J_m, K, U_m): t_0 = math.cos((K / 2.0)) t_1 = (t_0 * (-2.0 * J_m)) * math.sqrt((1.0 + math.pow((U_m / (t_0 * (J_m * 2.0))), 2.0))) tmp = 0 if t_1 <= -math.inf: tmp = -U_m elif t_1 <= math.inf: tmp = t_1 else: tmp = U_m return J_s * tmp
U_m = abs(U) J\_m = abs(J) J\_s = copysign(1.0, J) function code(J_s, J_m, K, U_m) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(Float64(t_0 * Float64(-2.0 * J_m)) * sqrt(Float64(1.0 + (Float64(U_m / Float64(t_0 * Float64(J_m * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(-U_m); elseif (t_1 <= Inf) tmp = t_1; else tmp = U_m; end return Float64(J_s * tmp) end
U_m = abs(U); J\_m = abs(J); J\_s = sign(J) * abs(1.0); function tmp_2 = code(J_s, J_m, K, U_m) t_0 = cos((K / 2.0)); t_1 = (t_0 * (-2.0 * J_m)) * sqrt((1.0 + ((U_m / (t_0 * (J_m * 2.0))) ^ 2.0))); tmp = 0.0; if (t_1 <= -Inf) tmp = -U_m; elseif (t_1 <= Inf) tmp = t_1; else tmp = U_m; end tmp_2 = J_s * tmp; end
U_m = N[Abs[U], $MachinePrecision]
J\_m = N[Abs[J], $MachinePrecision]
J\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[J]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[J$95$s_, J$95$m_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[(-2.0 * J$95$m), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U$95$m / N[(t$95$0 * N[(J$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(J$95$s * If[LessEqual[t$95$1, (-Infinity)], (-U$95$m), If[LessEqual[t$95$1, Infinity], t$95$1, U$95$m]]), $MachinePrecision]]]
\begin{array}{l}
U_m = \left|U\right|
\\
J\_m = \left|J\right|
\\
J\_s = \mathsf{copysign}\left(1, J\right)
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(t\_0 \cdot \left(-2 \cdot J\_m\right)\right) \cdot \sqrt{1 + {\left(\frac{U\_m}{t\_0 \cdot \left(J\_m \cdot 2\right)}\right)}^{2}}\\
J\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;U\_m\\
\end{array}
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < -inf.0Initial program 5.8%
*-commutative5.8%
associate-*l*5.8%
unpow25.8%
hypot-1-def52.0%
associate-/r*51.9%
*-commutative51.9%
Simplified51.9%
Taylor expanded in J around 0 46.0%
neg-mul-146.0%
Simplified46.0%
if -inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) < +inf.0Initial program 83.5%
if +inf.0 < (*.f64 (*.f64 (*.f64 #s(literal -2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64)))) (sqrt.f64 (+.f64 #s(literal 1 binary64) (pow.f64 (/.f64 U (*.f64 (*.f64 #s(literal 2 binary64) J) (cos.f64 (/.f64 K #s(literal 2 binary64))))) #s(literal 2 binary64))))) Initial program 72.9%
*-commutative72.9%
associate-*l*72.9%
unpow272.9%
hypot-1-def88.1%
associate-/r*88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in U around -inf 28.2%
Final simplification78.4%
U_m = (fabs.f64 U)
J\_m = (fabs.f64 J)
J\_s = (copysign.f64 #s(literal 1 binary64) J)
(FPCore (J_s J_m K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(*
J_s
(if (<= J_m 6.5e-150)
(- U_m)
(* -2.0 (* J_m (* t_0 (hypot 1.0 (/ (* U_m 0.5) (* J_m t_0))))))))))U_m = fabs(U);
J\_m = fabs(J);
J\_s = copysign(1.0, J);
double code(double J_s, double J_m, double K, double U_m) {
double t_0 = cos((K / 2.0));
double tmp;
if (J_m <= 6.5e-150) {
tmp = -U_m;
} else {
tmp = -2.0 * (J_m * (t_0 * hypot(1.0, ((U_m * 0.5) / (J_m * t_0)))));
}
return J_s * tmp;
}
U_m = Math.abs(U);
J\_m = Math.abs(J);
J\_s = Math.copySign(1.0, J);
public static double code(double J_s, double J_m, double K, double U_m) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (J_m <= 6.5e-150) {
tmp = -U_m;
} else {
tmp = -2.0 * (J_m * (t_0 * Math.hypot(1.0, ((U_m * 0.5) / (J_m * t_0)))));
}
return J_s * tmp;
}
U_m = math.fabs(U) J\_m = math.fabs(J) J\_s = math.copysign(1.0, J) def code(J_s, J_m, K, U_m): t_0 = math.cos((K / 2.0)) tmp = 0 if J_m <= 6.5e-150: tmp = -U_m else: tmp = -2.0 * (J_m * (t_0 * math.hypot(1.0, ((U_m * 0.5) / (J_m * t_0))))) return J_s * tmp
U_m = abs(U) J\_m = abs(J) J\_s = copysign(1.0, J) function code(J_s, J_m, K, U_m) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (J_m <= 6.5e-150) tmp = Float64(-U_m); else tmp = Float64(-2.0 * Float64(J_m * Float64(t_0 * hypot(1.0, Float64(Float64(U_m * 0.5) / Float64(J_m * t_0)))))); end return Float64(J_s * tmp) end
U_m = abs(U); J\_m = abs(J); J\_s = sign(J) * abs(1.0); function tmp_2 = code(J_s, J_m, K, U_m) t_0 = cos((K / 2.0)); tmp = 0.0; if (J_m <= 6.5e-150) tmp = -U_m; else tmp = -2.0 * (J_m * (t_0 * hypot(1.0, ((U_m * 0.5) / (J_m * t_0))))); end tmp_2 = J_s * tmp; end
U_m = N[Abs[U], $MachinePrecision]
J\_m = N[Abs[J], $MachinePrecision]
J\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[J]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[J$95$s_, J$95$m_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(J$95$s * If[LessEqual[J$95$m, 6.5e-150], (-U$95$m), N[(-2.0 * N[(J$95$m * N[(t$95$0 * N[Sqrt[1.0 ^ 2 + N[(N[(U$95$m * 0.5), $MachinePrecision] / N[(J$95$m * t$95$0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
U_m = \left|U\right|
\\
J\_m = \left|J\right|
\\
J\_s = \mathsf{copysign}\left(1, J\right)
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
J\_s \cdot \begin{array}{l}
\mathbf{if}\;J\_m \leq 6.5 \cdot 10^{-150}:\\
\;\;\;\;-U\_m\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(J\_m \cdot \left(t\_0 \cdot \mathsf{hypot}\left(1, \frac{U\_m \cdot 0.5}{J\_m \cdot t\_0}\right)\right)\right)\\
\end{array}
\end{array}
\end{array}
if J < 6.49999999999999997e-150Initial program 67.9%
*-commutative67.9%
associate-*l*67.9%
unpow267.9%
hypot-1-def82.9%
associate-/r*82.8%
*-commutative82.8%
Simplified82.8%
Taylor expanded in J around 0 29.0%
neg-mul-129.0%
Simplified29.0%
if 6.49999999999999997e-150 < J Initial program 81.9%
Simplified97.6%
Final simplification53.1%
U_m = (fabs.f64 U)
J\_m = (fabs.f64 J)
J\_s = (copysign.f64 #s(literal 1 binary64) J)
(FPCore (J_s J_m K U_m)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(*
J_s
(if (<= J_m 6.5e-150)
(- U_m)
(* (* J_m (* -2.0 t_0)) (hypot 1.0 (/ (/ U_m (* J_m 2.0)) t_0)))))))U_m = fabs(U);
J\_m = fabs(J);
J\_s = copysign(1.0, J);
double code(double J_s, double J_m, double K, double U_m) {
double t_0 = cos((K / 2.0));
double tmp;
if (J_m <= 6.5e-150) {
tmp = -U_m;
} else {
tmp = (J_m * (-2.0 * t_0)) * hypot(1.0, ((U_m / (J_m * 2.0)) / t_0));
}
return J_s * tmp;
}
U_m = Math.abs(U);
J\_m = Math.abs(J);
J\_s = Math.copySign(1.0, J);
public static double code(double J_s, double J_m, double K, double U_m) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (J_m <= 6.5e-150) {
tmp = -U_m;
} else {
tmp = (J_m * (-2.0 * t_0)) * Math.hypot(1.0, ((U_m / (J_m * 2.0)) / t_0));
}
return J_s * tmp;
}
U_m = math.fabs(U) J\_m = math.fabs(J) J\_s = math.copysign(1.0, J) def code(J_s, J_m, K, U_m): t_0 = math.cos((K / 2.0)) tmp = 0 if J_m <= 6.5e-150: tmp = -U_m else: tmp = (J_m * (-2.0 * t_0)) * math.hypot(1.0, ((U_m / (J_m * 2.0)) / t_0)) return J_s * tmp
U_m = abs(U) J\_m = abs(J) J\_s = copysign(1.0, J) function code(J_s, J_m, K, U_m) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (J_m <= 6.5e-150) tmp = Float64(-U_m); else tmp = Float64(Float64(J_m * Float64(-2.0 * t_0)) * hypot(1.0, Float64(Float64(U_m / Float64(J_m * 2.0)) / t_0))); end return Float64(J_s * tmp) end
U_m = abs(U); J\_m = abs(J); J\_s = sign(J) * abs(1.0); function tmp_2 = code(J_s, J_m, K, U_m) t_0 = cos((K / 2.0)); tmp = 0.0; if (J_m <= 6.5e-150) tmp = -U_m; else tmp = (J_m * (-2.0 * t_0)) * hypot(1.0, ((U_m / (J_m * 2.0)) / t_0)); end tmp_2 = J_s * tmp; end
U_m = N[Abs[U], $MachinePrecision]
J\_m = N[Abs[J], $MachinePrecision]
J\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[J]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[J$95$s_, J$95$m_, K_, U$95$m_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(J$95$s * If[LessEqual[J$95$m, 6.5e-150], (-U$95$m), N[(N[(J$95$m * N[(-2.0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(N[(U$95$m / N[(J$95$m * 2.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
U_m = \left|U\right|
\\
J\_m = \left|J\right|
\\
J\_s = \mathsf{copysign}\left(1, J\right)
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
J\_s \cdot \begin{array}{l}
\mathbf{if}\;J\_m \leq 6.5 \cdot 10^{-150}:\\
\;\;\;\;-U\_m\\
\mathbf{else}:\\
\;\;\;\;\left(J\_m \cdot \left(-2 \cdot t\_0\right)\right) \cdot \mathsf{hypot}\left(1, \frac{\frac{U\_m}{J\_m \cdot 2}}{t\_0}\right)\\
\end{array}
\end{array}
\end{array}
if J < 6.49999999999999997e-150Initial program 67.9%
*-commutative67.9%
associate-*l*67.9%
unpow267.9%
hypot-1-def82.9%
associate-/r*82.8%
*-commutative82.8%
Simplified82.8%
Taylor expanded in J around 0 29.0%
neg-mul-129.0%
Simplified29.0%
if 6.49999999999999997e-150 < J Initial program 81.9%
*-commutative81.9%
associate-*l*81.9%
unpow281.9%
hypot-1-def97.7%
associate-/r*97.6%
*-commutative97.6%
Simplified97.6%
Final simplification53.1%
U_m = (fabs.f64 U)
J\_m = (fabs.f64 J)
J\_s = (copysign.f64 #s(literal 1 binary64) J)
(FPCore (J_s J_m K U_m)
:precision binary64
(*
J_s
(if (<= J_m 6.5e-150)
(- U_m)
(* -2.0 (* J_m (* (cos (/ K 2.0)) (hypot 1.0 (/ (* U_m 0.5) J_m))))))))U_m = fabs(U);
J\_m = fabs(J);
J\_s = copysign(1.0, J);
double code(double J_s, double J_m, double K, double U_m) {
double tmp;
if (J_m <= 6.5e-150) {
tmp = -U_m;
} else {
tmp = -2.0 * (J_m * (cos((K / 2.0)) * hypot(1.0, ((U_m * 0.5) / J_m))));
}
return J_s * tmp;
}
U_m = Math.abs(U);
J\_m = Math.abs(J);
J\_s = Math.copySign(1.0, J);
public static double code(double J_s, double J_m, double K, double U_m) {
double tmp;
if (J_m <= 6.5e-150) {
tmp = -U_m;
} else {
tmp = -2.0 * (J_m * (Math.cos((K / 2.0)) * Math.hypot(1.0, ((U_m * 0.5) / J_m))));
}
return J_s * tmp;
}
U_m = math.fabs(U) J\_m = math.fabs(J) J\_s = math.copysign(1.0, J) def code(J_s, J_m, K, U_m): tmp = 0 if J_m <= 6.5e-150: tmp = -U_m else: tmp = -2.0 * (J_m * (math.cos((K / 2.0)) * math.hypot(1.0, ((U_m * 0.5) / J_m)))) return J_s * tmp
U_m = abs(U) J\_m = abs(J) J\_s = copysign(1.0, J) function code(J_s, J_m, K, U_m) tmp = 0.0 if (J_m <= 6.5e-150) tmp = Float64(-U_m); else tmp = Float64(-2.0 * Float64(J_m * Float64(cos(Float64(K / 2.0)) * hypot(1.0, Float64(Float64(U_m * 0.5) / J_m))))); end return Float64(J_s * tmp) end
U_m = abs(U); J\_m = abs(J); J\_s = sign(J) * abs(1.0); function tmp_2 = code(J_s, J_m, K, U_m) tmp = 0.0; if (J_m <= 6.5e-150) tmp = -U_m; else tmp = -2.0 * (J_m * (cos((K / 2.0)) * hypot(1.0, ((U_m * 0.5) / J_m)))); end tmp_2 = J_s * tmp; end
U_m = N[Abs[U], $MachinePrecision]
J\_m = N[Abs[J], $MachinePrecision]
J\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[J]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[J$95$s_, J$95$m_, K_, U$95$m_] := N[(J$95$s * If[LessEqual[J$95$m, 6.5e-150], (-U$95$m), N[(-2.0 * N[(J$95$m * N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(N[(U$95$m * 0.5), $MachinePrecision] / J$95$m), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
U_m = \left|U\right|
\\
J\_m = \left|J\right|
\\
J\_s = \mathsf{copysign}\left(1, J\right)
\\
J\_s \cdot \begin{array}{l}
\mathbf{if}\;J\_m \leq 6.5 \cdot 10^{-150}:\\
\;\;\;\;-U\_m\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(J\_m \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \mathsf{hypot}\left(1, \frac{U\_m \cdot 0.5}{J\_m}\right)\right)\right)\\
\end{array}
\end{array}
if J < 6.49999999999999997e-150Initial program 67.9%
*-commutative67.9%
associate-*l*67.9%
unpow267.9%
hypot-1-def82.9%
associate-/r*82.8%
*-commutative82.8%
Simplified82.8%
Taylor expanded in J around 0 29.0%
neg-mul-129.0%
Simplified29.0%
if 6.49999999999999997e-150 < J Initial program 81.9%
Simplified97.6%
Taylor expanded in K around 0 77.6%
Final simplification46.1%
U_m = (fabs.f64 U)
J\_m = (fabs.f64 J)
J\_s = (copysign.f64 #s(literal 1 binary64) J)
(FPCore (J_s J_m K U_m)
:precision binary64
(*
J_s
(if (<= J_m 2.7e-139)
(- U_m)
(if (<= J_m 3.7e-107)
U_m
(if (<= J_m 7.8e+23)
(* (hypot 1.0 (* 0.5 (/ U_m J_m))) (* -2.0 J_m))
(* (* -2.0 J_m) (cos (* K 0.5))))))))U_m = fabs(U);
J\_m = fabs(J);
J\_s = copysign(1.0, J);
double code(double J_s, double J_m, double K, double U_m) {
double tmp;
if (J_m <= 2.7e-139) {
tmp = -U_m;
} else if (J_m <= 3.7e-107) {
tmp = U_m;
} else if (J_m <= 7.8e+23) {
tmp = hypot(1.0, (0.5 * (U_m / J_m))) * (-2.0 * J_m);
} else {
tmp = (-2.0 * J_m) * cos((K * 0.5));
}
return J_s * tmp;
}
U_m = Math.abs(U);
J\_m = Math.abs(J);
J\_s = Math.copySign(1.0, J);
public static double code(double J_s, double J_m, double K, double U_m) {
double tmp;
if (J_m <= 2.7e-139) {
tmp = -U_m;
} else if (J_m <= 3.7e-107) {
tmp = U_m;
} else if (J_m <= 7.8e+23) {
tmp = Math.hypot(1.0, (0.5 * (U_m / J_m))) * (-2.0 * J_m);
} else {
tmp = (-2.0 * J_m) * Math.cos((K * 0.5));
}
return J_s * tmp;
}
U_m = math.fabs(U) J\_m = math.fabs(J) J\_s = math.copysign(1.0, J) def code(J_s, J_m, K, U_m): tmp = 0 if J_m <= 2.7e-139: tmp = -U_m elif J_m <= 3.7e-107: tmp = U_m elif J_m <= 7.8e+23: tmp = math.hypot(1.0, (0.5 * (U_m / J_m))) * (-2.0 * J_m) else: tmp = (-2.0 * J_m) * math.cos((K * 0.5)) return J_s * tmp
U_m = abs(U) J\_m = abs(J) J\_s = copysign(1.0, J) function code(J_s, J_m, K, U_m) tmp = 0.0 if (J_m <= 2.7e-139) tmp = Float64(-U_m); elseif (J_m <= 3.7e-107) tmp = U_m; elseif (J_m <= 7.8e+23) tmp = Float64(hypot(1.0, Float64(0.5 * Float64(U_m / J_m))) * Float64(-2.0 * J_m)); else tmp = Float64(Float64(-2.0 * J_m) * cos(Float64(K * 0.5))); end return Float64(J_s * tmp) end
U_m = abs(U); J\_m = abs(J); J\_s = sign(J) * abs(1.0); function tmp_2 = code(J_s, J_m, K, U_m) tmp = 0.0; if (J_m <= 2.7e-139) tmp = -U_m; elseif (J_m <= 3.7e-107) tmp = U_m; elseif (J_m <= 7.8e+23) tmp = hypot(1.0, (0.5 * (U_m / J_m))) * (-2.0 * J_m); else tmp = (-2.0 * J_m) * cos((K * 0.5)); end tmp_2 = J_s * tmp; end
U_m = N[Abs[U], $MachinePrecision]
J\_m = N[Abs[J], $MachinePrecision]
J\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[J]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[J$95$s_, J$95$m_, K_, U$95$m_] := N[(J$95$s * If[LessEqual[J$95$m, 2.7e-139], (-U$95$m), If[LessEqual[J$95$m, 3.7e-107], U$95$m, If[LessEqual[J$95$m, 7.8e+23], N[(N[Sqrt[1.0 ^ 2 + N[(0.5 * N[(U$95$m / J$95$m), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] * N[(-2.0 * J$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * J$95$m), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
U_m = \left|U\right|
\\
J\_m = \left|J\right|
\\
J\_s = \mathsf{copysign}\left(1, J\right)
\\
J\_s \cdot \begin{array}{l}
\mathbf{if}\;J\_m \leq 2.7 \cdot 10^{-139}:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;J\_m \leq 3.7 \cdot 10^{-107}:\\
\;\;\;\;U\_m\\
\mathbf{elif}\;J\_m \leq 7.8 \cdot 10^{+23}:\\
\;\;\;\;\mathsf{hypot}\left(1, 0.5 \cdot \frac{U\_m}{J\_m}\right) \cdot \left(-2 \cdot J\_m\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot J\_m\right) \cdot \cos \left(K \cdot 0.5\right)\\
\end{array}
\end{array}
if J < 2.6999999999999998e-139Initial program 67.8%
*-commutative67.8%
associate-*l*67.8%
unpow267.8%
hypot-1-def83.4%
associate-/r*83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in J around 0 30.0%
neg-mul-130.0%
Simplified30.0%
if 2.6999999999999998e-139 < J < 3.7000000000000003e-107Initial program 28.2%
*-commutative28.2%
associate-*l*28.2%
unpow228.2%
hypot-1-def76.4%
associate-/r*76.4%
*-commutative76.4%
Simplified76.4%
Taylor expanded in U around -inf 51.1%
if 3.7000000000000003e-107 < J < 7.8000000000000001e23Initial program 68.2%
*-commutative68.2%
associate-*l*68.2%
unpow268.2%
hypot-1-def96.3%
associate-/r*96.1%
*-commutative96.1%
Simplified96.1%
log1p-expm1-u96.2%
div-inv96.2%
metadata-eval96.2%
Applied egg-rr96.2%
Taylor expanded in K around 0 30.4%
*-commutative30.4%
*-commutative30.4%
associate-*l*30.4%
metadata-eval30.4%
metadata-eval30.4%
unpow230.4%
unpow230.4%
times-frac30.4%
swap-sqr30.4%
associate-*r/30.4%
associate-*r/30.4%
hypot-undefine41.0%
associate-*r/41.0%
*-commutative41.0%
Simplified41.0%
if 7.8000000000000001e23 < J Initial program 94.7%
*-commutative94.7%
associate-*l*94.7%
unpow294.7%
hypot-1-def99.7%
associate-/r*99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in J around inf 74.8%
associate-*r*74.8%
*-commutative74.8%
Simplified74.8%
Final simplification40.9%
U_m = (fabs.f64 U)
J\_m = (fabs.f64 J)
J\_s = (copysign.f64 #s(literal 1 binary64) J)
(FPCore (J_s J_m K U_m)
:precision binary64
(*
J_s
(if (<= J_m 2e-139)
(- U_m)
(if (<= J_m 2.9e-107)
U_m
(if (<= J_m 5.4e-27) (- U_m) (* (* -2.0 J_m) (cos (* K 0.5))))))))U_m = fabs(U);
J\_m = fabs(J);
J\_s = copysign(1.0, J);
double code(double J_s, double J_m, double K, double U_m) {
double tmp;
if (J_m <= 2e-139) {
tmp = -U_m;
} else if (J_m <= 2.9e-107) {
tmp = U_m;
} else if (J_m <= 5.4e-27) {
tmp = -U_m;
} else {
tmp = (-2.0 * J_m) * cos((K * 0.5));
}
return J_s * tmp;
}
U_m = abs(u)
J\_m = abs(j)
J\_s = copysign(1.0d0, j)
real(8) function code(j_s, j_m, k, u_m)
real(8), intent (in) :: j_s
real(8), intent (in) :: j_m
real(8), intent (in) :: k
real(8), intent (in) :: u_m
real(8) :: tmp
if (j_m <= 2d-139) then
tmp = -u_m
else if (j_m <= 2.9d-107) then
tmp = u_m
else if (j_m <= 5.4d-27) then
tmp = -u_m
else
tmp = ((-2.0d0) * j_m) * cos((k * 0.5d0))
end if
code = j_s * tmp
end function
U_m = Math.abs(U);
J\_m = Math.abs(J);
J\_s = Math.copySign(1.0, J);
public static double code(double J_s, double J_m, double K, double U_m) {
double tmp;
if (J_m <= 2e-139) {
tmp = -U_m;
} else if (J_m <= 2.9e-107) {
tmp = U_m;
} else if (J_m <= 5.4e-27) {
tmp = -U_m;
} else {
tmp = (-2.0 * J_m) * Math.cos((K * 0.5));
}
return J_s * tmp;
}
U_m = math.fabs(U) J\_m = math.fabs(J) J\_s = math.copysign(1.0, J) def code(J_s, J_m, K, U_m): tmp = 0 if J_m <= 2e-139: tmp = -U_m elif J_m <= 2.9e-107: tmp = U_m elif J_m <= 5.4e-27: tmp = -U_m else: tmp = (-2.0 * J_m) * math.cos((K * 0.5)) return J_s * tmp
U_m = abs(U) J\_m = abs(J) J\_s = copysign(1.0, J) function code(J_s, J_m, K, U_m) tmp = 0.0 if (J_m <= 2e-139) tmp = Float64(-U_m); elseif (J_m <= 2.9e-107) tmp = U_m; elseif (J_m <= 5.4e-27) tmp = Float64(-U_m); else tmp = Float64(Float64(-2.0 * J_m) * cos(Float64(K * 0.5))); end return Float64(J_s * tmp) end
U_m = abs(U); J\_m = abs(J); J\_s = sign(J) * abs(1.0); function tmp_2 = code(J_s, J_m, K, U_m) tmp = 0.0; if (J_m <= 2e-139) tmp = -U_m; elseif (J_m <= 2.9e-107) tmp = U_m; elseif (J_m <= 5.4e-27) tmp = -U_m; else tmp = (-2.0 * J_m) * cos((K * 0.5)); end tmp_2 = J_s * tmp; end
U_m = N[Abs[U], $MachinePrecision]
J\_m = N[Abs[J], $MachinePrecision]
J\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[J]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[J$95$s_, J$95$m_, K_, U$95$m_] := N[(J$95$s * If[LessEqual[J$95$m, 2e-139], (-U$95$m), If[LessEqual[J$95$m, 2.9e-107], U$95$m, If[LessEqual[J$95$m, 5.4e-27], (-U$95$m), N[(N[(-2.0 * J$95$m), $MachinePrecision] * N[Cos[N[(K * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]
\begin{array}{l}
U_m = \left|U\right|
\\
J\_m = \left|J\right|
\\
J\_s = \mathsf{copysign}\left(1, J\right)
\\
J\_s \cdot \begin{array}{l}
\mathbf{if}\;J\_m \leq 2 \cdot 10^{-139}:\\
\;\;\;\;-U\_m\\
\mathbf{elif}\;J\_m \leq 2.9 \cdot 10^{-107}:\\
\;\;\;\;U\_m\\
\mathbf{elif}\;J\_m \leq 5.4 \cdot 10^{-27}:\\
\;\;\;\;-U\_m\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot J\_m\right) \cdot \cos \left(K \cdot 0.5\right)\\
\end{array}
\end{array}
if J < 2.00000000000000006e-139 or 2.8999999999999998e-107 < J < 5.39999999999999978e-27Initial program 67.3%
*-commutative67.3%
associate-*l*67.3%
unpow267.3%
hypot-1-def84.7%
associate-/r*84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in J around 0 29.0%
neg-mul-129.0%
Simplified29.0%
if 2.00000000000000006e-139 < J < 2.8999999999999998e-107Initial program 28.2%
*-commutative28.2%
associate-*l*28.2%
unpow228.2%
hypot-1-def76.4%
associate-/r*76.4%
*-commutative76.4%
Simplified76.4%
Taylor expanded in U around -inf 51.1%
if 5.39999999999999978e-27 < J Initial program 93.6%
*-commutative93.6%
associate-*l*93.6%
unpow293.6%
hypot-1-def99.7%
associate-/r*99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in J around inf 72.6%
associate-*r*72.6%
*-commutative72.6%
Simplified72.6%
Final simplification39.6%
U_m = (fabs.f64 U)
J\_m = (fabs.f64 J)
J\_s = (copysign.f64 #s(literal 1 binary64) J)
(FPCore (J_s J_m K U_m)
:precision binary64
(*
J_s
(if (or (<= K 1.02e+18) (and (not (<= K 5.2e+199)) (<= K 5.5e+263)))
(- U_m)
(* -2.0 (* U_m (- (- 0.5) (* (/ J_m U_m) (/ J_m U_m))))))))U_m = fabs(U);
J\_m = fabs(J);
J\_s = copysign(1.0, J);
double code(double J_s, double J_m, double K, double U_m) {
double tmp;
if ((K <= 1.02e+18) || (!(K <= 5.2e+199) && (K <= 5.5e+263))) {
tmp = -U_m;
} else {
tmp = -2.0 * (U_m * (-0.5 - ((J_m / U_m) * (J_m / U_m))));
}
return J_s * tmp;
}
U_m = abs(u)
J\_m = abs(j)
J\_s = copysign(1.0d0, j)
real(8) function code(j_s, j_m, k, u_m)
real(8), intent (in) :: j_s
real(8), intent (in) :: j_m
real(8), intent (in) :: k
real(8), intent (in) :: u_m
real(8) :: tmp
if ((k <= 1.02d+18) .or. (.not. (k <= 5.2d+199)) .and. (k <= 5.5d+263)) then
tmp = -u_m
else
tmp = (-2.0d0) * (u_m * (-0.5d0 - ((j_m / u_m) * (j_m / u_m))))
end if
code = j_s * tmp
end function
U_m = Math.abs(U);
J\_m = Math.abs(J);
J\_s = Math.copySign(1.0, J);
public static double code(double J_s, double J_m, double K, double U_m) {
double tmp;
if ((K <= 1.02e+18) || (!(K <= 5.2e+199) && (K <= 5.5e+263))) {
tmp = -U_m;
} else {
tmp = -2.0 * (U_m * (-0.5 - ((J_m / U_m) * (J_m / U_m))));
}
return J_s * tmp;
}
U_m = math.fabs(U) J\_m = math.fabs(J) J\_s = math.copysign(1.0, J) def code(J_s, J_m, K, U_m): tmp = 0 if (K <= 1.02e+18) or (not (K <= 5.2e+199) and (K <= 5.5e+263)): tmp = -U_m else: tmp = -2.0 * (U_m * (-0.5 - ((J_m / U_m) * (J_m / U_m)))) return J_s * tmp
U_m = abs(U) J\_m = abs(J) J\_s = copysign(1.0, J) function code(J_s, J_m, K, U_m) tmp = 0.0 if ((K <= 1.02e+18) || (!(K <= 5.2e+199) && (K <= 5.5e+263))) tmp = Float64(-U_m); else tmp = Float64(-2.0 * Float64(U_m * Float64(Float64(-0.5) - Float64(Float64(J_m / U_m) * Float64(J_m / U_m))))); end return Float64(J_s * tmp) end
U_m = abs(U); J\_m = abs(J); J\_s = sign(J) * abs(1.0); function tmp_2 = code(J_s, J_m, K, U_m) tmp = 0.0; if ((K <= 1.02e+18) || (~((K <= 5.2e+199)) && (K <= 5.5e+263))) tmp = -U_m; else tmp = -2.0 * (U_m * (-0.5 - ((J_m / U_m) * (J_m / U_m)))); end tmp_2 = J_s * tmp; end
U_m = N[Abs[U], $MachinePrecision]
J\_m = N[Abs[J], $MachinePrecision]
J\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[J]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[J$95$s_, J$95$m_, K_, U$95$m_] := N[(J$95$s * If[Or[LessEqual[K, 1.02e+18], And[N[Not[LessEqual[K, 5.2e+199]], $MachinePrecision], LessEqual[K, 5.5e+263]]], (-U$95$m), N[(-2.0 * N[(U$95$m * N[((-0.5) - N[(N[(J$95$m / U$95$m), $MachinePrecision] * N[(J$95$m / U$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
U_m = \left|U\right|
\\
J\_m = \left|J\right|
\\
J\_s = \mathsf{copysign}\left(1, J\right)
\\
J\_s \cdot \begin{array}{l}
\mathbf{if}\;K \leq 1.02 \cdot 10^{+18} \lor \neg \left(K \leq 5.2 \cdot 10^{+199}\right) \land K \leq 5.5 \cdot 10^{+263}:\\
\;\;\;\;-U\_m\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(U\_m \cdot \left(\left(-0.5\right) - \frac{J\_m}{U\_m} \cdot \frac{J\_m}{U\_m}\right)\right)\\
\end{array}
\end{array}
if K < 1.02e18 or 5.2000000000000003e199 < K < 5.5e263Initial program 71.8%
*-commutative71.8%
associate-*l*71.8%
unpow271.8%
hypot-1-def88.0%
associate-/r*87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in J around 0 25.7%
neg-mul-125.7%
Simplified25.7%
if 1.02e18 < K < 5.2000000000000003e199 or 5.5e263 < K Initial program 77.2%
Simplified88.5%
Taylor expanded in U around -inf 18.1%
mul-1-neg18.1%
*-commutative18.1%
distribute-rgt-neg-in18.1%
unpow218.1%
*-commutative18.1%
unpow218.1%
swap-sqr18.1%
unpow218.1%
*-commutative18.1%
Simplified18.1%
Taylor expanded in K around 0 17.8%
unpow217.8%
unpow217.8%
times-frac18.4%
Applied egg-rr18.4%
Final simplification24.3%
U_m = (fabs.f64 U)
J\_m = (fabs.f64 J)
J\_s = (copysign.f64 #s(literal 1 binary64) J)
(FPCore (J_s J_m K U_m)
:precision binary64
(*
J_s
(if (or (<= K 1.02e+18) (and (not (<= K 5.2e+199)) (<= K 5.5e+263)))
(- U_m)
U_m)))U_m = fabs(U);
J\_m = fabs(J);
J\_s = copysign(1.0, J);
double code(double J_s, double J_m, double K, double U_m) {
double tmp;
if ((K <= 1.02e+18) || (!(K <= 5.2e+199) && (K <= 5.5e+263))) {
tmp = -U_m;
} else {
tmp = U_m;
}
return J_s * tmp;
}
U_m = abs(u)
J\_m = abs(j)
J\_s = copysign(1.0d0, j)
real(8) function code(j_s, j_m, k, u_m)
real(8), intent (in) :: j_s
real(8), intent (in) :: j_m
real(8), intent (in) :: k
real(8), intent (in) :: u_m
real(8) :: tmp
if ((k <= 1.02d+18) .or. (.not. (k <= 5.2d+199)) .and. (k <= 5.5d+263)) then
tmp = -u_m
else
tmp = u_m
end if
code = j_s * tmp
end function
U_m = Math.abs(U);
J\_m = Math.abs(J);
J\_s = Math.copySign(1.0, J);
public static double code(double J_s, double J_m, double K, double U_m) {
double tmp;
if ((K <= 1.02e+18) || (!(K <= 5.2e+199) && (K <= 5.5e+263))) {
tmp = -U_m;
} else {
tmp = U_m;
}
return J_s * tmp;
}
U_m = math.fabs(U) J\_m = math.fabs(J) J\_s = math.copysign(1.0, J) def code(J_s, J_m, K, U_m): tmp = 0 if (K <= 1.02e+18) or (not (K <= 5.2e+199) and (K <= 5.5e+263)): tmp = -U_m else: tmp = U_m return J_s * tmp
U_m = abs(U) J\_m = abs(J) J\_s = copysign(1.0, J) function code(J_s, J_m, K, U_m) tmp = 0.0 if ((K <= 1.02e+18) || (!(K <= 5.2e+199) && (K <= 5.5e+263))) tmp = Float64(-U_m); else tmp = U_m; end return Float64(J_s * tmp) end
U_m = abs(U); J\_m = abs(J); J\_s = sign(J) * abs(1.0); function tmp_2 = code(J_s, J_m, K, U_m) tmp = 0.0; if ((K <= 1.02e+18) || (~((K <= 5.2e+199)) && (K <= 5.5e+263))) tmp = -U_m; else tmp = U_m; end tmp_2 = J_s * tmp; end
U_m = N[Abs[U], $MachinePrecision]
J\_m = N[Abs[J], $MachinePrecision]
J\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[J]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[J$95$s_, J$95$m_, K_, U$95$m_] := N[(J$95$s * If[Or[LessEqual[K, 1.02e+18], And[N[Not[LessEqual[K, 5.2e+199]], $MachinePrecision], LessEqual[K, 5.5e+263]]], (-U$95$m), U$95$m]), $MachinePrecision]
\begin{array}{l}
U_m = \left|U\right|
\\
J\_m = \left|J\right|
\\
J\_s = \mathsf{copysign}\left(1, J\right)
\\
J\_s \cdot \begin{array}{l}
\mathbf{if}\;K \leq 1.02 \cdot 10^{+18} \lor \neg \left(K \leq 5.2 \cdot 10^{+199}\right) \land K \leq 5.5 \cdot 10^{+263}:\\
\;\;\;\;-U\_m\\
\mathbf{else}:\\
\;\;\;\;U\_m\\
\end{array}
\end{array}
if K < 1.02e18 or 5.2000000000000003e199 < K < 5.5e263Initial program 71.8%
*-commutative71.8%
associate-*l*71.8%
unpow271.8%
hypot-1-def88.0%
associate-/r*87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in J around 0 25.7%
neg-mul-125.7%
Simplified25.7%
if 1.02e18 < K < 5.2000000000000003e199 or 5.5e263 < K Initial program 77.2%
*-commutative77.2%
associate-*l*77.2%
unpow277.2%
hypot-1-def88.6%
associate-/r*88.5%
*-commutative88.5%
Simplified88.5%
Taylor expanded in U around -inf 17.7%
Final simplification24.2%
U_m = (fabs.f64 U) J\_m = (fabs.f64 J) J\_s = (copysign.f64 #s(literal 1 binary64) J) (FPCore (J_s J_m K U_m) :precision binary64 (* J_s U_m))
U_m = fabs(U);
J\_m = fabs(J);
J\_s = copysign(1.0, J);
double code(double J_s, double J_m, double K, double U_m) {
return J_s * U_m;
}
U_m = abs(u)
J\_m = abs(j)
J\_s = copysign(1.0d0, j)
real(8) function code(j_s, j_m, k, u_m)
real(8), intent (in) :: j_s
real(8), intent (in) :: j_m
real(8), intent (in) :: k
real(8), intent (in) :: u_m
code = j_s * u_m
end function
U_m = Math.abs(U);
J\_m = Math.abs(J);
J\_s = Math.copySign(1.0, J);
public static double code(double J_s, double J_m, double K, double U_m) {
return J_s * U_m;
}
U_m = math.fabs(U) J\_m = math.fabs(J) J\_s = math.copysign(1.0, J) def code(J_s, J_m, K, U_m): return J_s * U_m
U_m = abs(U) J\_m = abs(J) J\_s = copysign(1.0, J) function code(J_s, J_m, K, U_m) return Float64(J_s * U_m) end
U_m = abs(U); J\_m = abs(J); J\_s = sign(J) * abs(1.0); function tmp = code(J_s, J_m, K, U_m) tmp = J_s * U_m; end
U_m = N[Abs[U], $MachinePrecision]
J\_m = N[Abs[J], $MachinePrecision]
J\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[J]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[J$95$s_, J$95$m_, K_, U$95$m_] := N[(J$95$s * U$95$m), $MachinePrecision]
\begin{array}{l}
U_m = \left|U\right|
\\
J\_m = \left|J\right|
\\
J\_s = \mathsf{copysign}\left(1, J\right)
\\
J\_s \cdot U\_m
\end{array}
Initial program 72.9%
*-commutative72.9%
associate-*l*72.9%
unpow272.9%
hypot-1-def88.1%
associate-/r*88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in U around -inf 28.2%
Final simplification28.2%
herbie shell --seed 2024068
(FPCore (J K U)
:name "Maksimov and Kolovsky, Equation (3)"
:precision binary64
(* (* (* -2.0 J) (cos (/ K 2.0))) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) (cos (/ K 2.0)))) 2.0)))))