
(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}
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (* J t_0))
(t_2
(*
(* t_0 (* -2.0 J))
(sqrt (+ 1.0 (pow (/ U (* t_0 (* J 2.0))) 2.0))))))
(if (<= t_2 (- INFINITY))
(* -2.0 (* U 0.5))
(if (<= t_2 5e+303)
(* -2.0 (* t_1 (hypot 1.0 (/ U (* 2.0 t_1)))))
(* -2.0 (* U -0.5))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = J * t_0;
double t_2 = (t_0 * (-2.0 * J)) * sqrt((1.0 + pow((U / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = -2.0 * (U * 0.5);
} else if (t_2 <= 5e+303) {
tmp = -2.0 * (t_1 * hypot(1.0, (U / (2.0 * t_1))));
} else {
tmp = -2.0 * (U * -0.5);
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = J * t_0;
double t_2 = (t_0 * (-2.0 * J)) * Math.sqrt((1.0 + Math.pow((U / (t_0 * (J * 2.0))), 2.0)));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = -2.0 * (U * 0.5);
} else if (t_2 <= 5e+303) {
tmp = -2.0 * (t_1 * Math.hypot(1.0, (U / (2.0 * t_1))));
} else {
tmp = -2.0 * (U * -0.5);
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) t_1 = J * t_0 t_2 = (t_0 * (-2.0 * J)) * math.sqrt((1.0 + math.pow((U / (t_0 * (J * 2.0))), 2.0))) tmp = 0 if t_2 <= -math.inf: tmp = -2.0 * (U * 0.5) elif t_2 <= 5e+303: tmp = -2.0 * (t_1 * math.hypot(1.0, (U / (2.0 * t_1)))) else: tmp = -2.0 * (U * -0.5) return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(J * t_0) t_2 = Float64(Float64(t_0 * Float64(-2.0 * J)) * sqrt(Float64(1.0 + (Float64(U / Float64(t_0 * Float64(J * 2.0))) ^ 2.0)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(-2.0 * Float64(U * 0.5)); elseif (t_2 <= 5e+303) tmp = Float64(-2.0 * Float64(t_1 * hypot(1.0, Float64(U / Float64(2.0 * t_1))))); else tmp = Float64(-2.0 * Float64(U * -0.5)); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = cos((K / 2.0)); t_1 = J * t_0; t_2 = (t_0 * (-2.0 * J)) * sqrt((1.0 + ((U / (t_0 * (J * 2.0))) ^ 2.0))); tmp = 0.0; if (t_2 <= -Inf) tmp = -2.0 * (U * 0.5); elseif (t_2 <= 5e+303) tmp = -2.0 * (t_1 * hypot(1.0, (U / (2.0 * t_1)))); else tmp = -2.0 * (U * -0.5); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(J * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t$95$0 * N[(-2.0 * J), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+303], N[(-2.0 * N[(t$95$1 * N[Sqrt[1.0 ^ 2 + N[(U / N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := J \cdot t_0\\
t_2 := \left(t_0 \cdot \left(-2 \cdot J\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{t_0 \cdot \left(J \cdot 2\right)}\right)}^{2}}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+303}:\\
\;\;\;\;-2 \cdot \left(t_1 \cdot \mathsf{hypot}\left(1, \frac{U}{2 \cdot t_1}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) < -inf.0Initial program 6.5%
Simplified42.0%
Taylor expanded in J around 0 47.1%
if -inf.0 < (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) < 4.9999999999999997e303Initial program 99.8%
associate-*l*99.8%
associate-*l*99.8%
unpow299.8%
sqr-neg99.8%
distribute-frac-neg99.8%
distribute-frac-neg99.8%
unpow299.8%
Simplified99.8%
if 4.9999999999999997e303 < (*.f64 (*.f64 (*.f64 -2 J) (cos.f64 (/.f64 K 2))) (sqrt.f64 (+.f64 1 (pow.f64 (/.f64 U (*.f64 (*.f64 2 J) (cos.f64 (/.f64 K 2)))) 2)))) Initial program 5.3%
Simplified57.1%
Taylor expanded in U around -inf 57.8%
*-commutative57.8%
Simplified57.8%
Final simplification86.6%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1 (* -2.0 (* J (* t_0 (hypot 1.0 (/ U (* J (* 2.0 t_0)))))))))
(if (<= J -2.35e-217)
t_1
(if (<= J 4e-300)
(* -2.0 (* U -0.5))
(if (<= J 8.5e-82) (* -2.0 (* U 0.5)) t_1)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = -2.0 * (J * (t_0 * hypot(1.0, (U / (J * (2.0 * t_0))))));
double tmp;
if (J <= -2.35e-217) {
tmp = t_1;
} else if (J <= 4e-300) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 8.5e-82) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_1;
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = -2.0 * (J * (t_0 * Math.hypot(1.0, (U / (J * (2.0 * t_0))))));
double tmp;
if (J <= -2.35e-217) {
tmp = t_1;
} else if (J <= 4e-300) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 8.5e-82) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_1;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) t_1 = -2.0 * (J * (t_0 * math.hypot(1.0, (U / (J * (2.0 * t_0)))))) tmp = 0 if J <= -2.35e-217: tmp = t_1 elif J <= 4e-300: tmp = -2.0 * (U * -0.5) elif J <= 8.5e-82: tmp = -2.0 * (U * 0.5) else: tmp = t_1 return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) t_1 = Float64(-2.0 * Float64(J * Float64(t_0 * hypot(1.0, Float64(U / Float64(J * Float64(2.0 * t_0))))))) tmp = 0.0 if (J <= -2.35e-217) tmp = t_1; elseif (J <= 4e-300) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (J <= 8.5e-82) tmp = Float64(-2.0 * Float64(U * 0.5)); else tmp = t_1; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = cos((K / 2.0)); t_1 = -2.0 * (J * (t_0 * hypot(1.0, (U / (J * (2.0 * t_0)))))); tmp = 0.0; if (J <= -2.35e-217) tmp = t_1; elseif (J <= 4e-300) tmp = -2.0 * (U * -0.5); elseif (J <= 8.5e-82) tmp = -2.0 * (U * 0.5); else tmp = t_1; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(-2.0 * N[(J * N[(t$95$0 * N[Sqrt[1.0 ^ 2 + N[(U / N[(J * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -2.35e-217], t$95$1, If[LessEqual[J, 4e-300], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 8.5e-82], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := -2 \cdot \left(J \cdot \left(t_0 \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)\right)\right)\\
\mathbf{if}\;J \leq -2.35 \cdot 10^{-217}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq 4 \cdot 10^{-300}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 8.5 \cdot 10^{-82}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if J < -2.3500000000000002e-217 or 8.4999999999999997e-82 < J Initial program 85.5%
Simplified95.5%
if -2.3500000000000002e-217 < J < 4.0000000000000001e-300Initial program 25.4%
Simplified53.9%
Taylor expanded in U around -inf 60.1%
*-commutative60.1%
Simplified60.1%
if 4.0000000000000001e-300 < J < 8.4999999999999997e-82Initial program 43.4%
Simplified57.1%
Taylor expanded in J around 0 44.1%
Final simplification84.7%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0))))
(if (<= J -1.25e-217)
(* -2.0 (* J (* t_0 (hypot 1.0 (/ U (* J (* 2.0 t_0)))))))
(if (<= J 3.5e-300)
(* -2.0 (* U -0.5))
(if (<= J 1.3e-81)
(* -2.0 (* U 0.5))
(* -2.0 (* t_0 (* J (hypot 1.0 (* 0.5 (/ U (* J t_0))))))))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double tmp;
if (J <= -1.25e-217) {
tmp = -2.0 * (J * (t_0 * hypot(1.0, (U / (J * (2.0 * t_0))))));
} else if (J <= 3.5e-300) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 1.3e-81) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = -2.0 * (t_0 * (J * hypot(1.0, (0.5 * (U / (J * t_0))))));
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double tmp;
if (J <= -1.25e-217) {
tmp = -2.0 * (J * (t_0 * Math.hypot(1.0, (U / (J * (2.0 * t_0))))));
} else if (J <= 3.5e-300) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 1.3e-81) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = -2.0 * (t_0 * (J * Math.hypot(1.0, (0.5 * (U / (J * t_0))))));
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = math.cos((K / 2.0)) tmp = 0 if J <= -1.25e-217: tmp = -2.0 * (J * (t_0 * math.hypot(1.0, (U / (J * (2.0 * t_0)))))) elif J <= 3.5e-300: tmp = -2.0 * (U * -0.5) elif J <= 1.3e-81: tmp = -2.0 * (U * 0.5) else: tmp = -2.0 * (t_0 * (J * math.hypot(1.0, (0.5 * (U / (J * t_0)))))) return tmp
U = abs(U) function code(J, K, U) t_0 = cos(Float64(K / 2.0)) tmp = 0.0 if (J <= -1.25e-217) tmp = Float64(-2.0 * Float64(J * Float64(t_0 * hypot(1.0, Float64(U / Float64(J * Float64(2.0 * t_0))))))); elseif (J <= 3.5e-300) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (J <= 1.3e-81) tmp = Float64(-2.0 * Float64(U * 0.5)); else tmp = Float64(-2.0 * Float64(t_0 * Float64(J * hypot(1.0, Float64(0.5 * Float64(U / Float64(J * t_0))))))); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = cos((K / 2.0)); tmp = 0.0; if (J <= -1.25e-217) tmp = -2.0 * (J * (t_0 * hypot(1.0, (U / (J * (2.0 * t_0)))))); elseif (J <= 3.5e-300) tmp = -2.0 * (U * -0.5); elseif (J <= 1.3e-81) tmp = -2.0 * (U * 0.5); else tmp = -2.0 * (t_0 * (J * hypot(1.0, (0.5 * (U / (J * t_0)))))); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[J, -1.25e-217], N[(-2.0 * N[(J * N[(t$95$0 * N[Sqrt[1.0 ^ 2 + N[(U / N[(J * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 3.5e-300], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 1.3e-81], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(t$95$0 * N[(J * N[Sqrt[1.0 ^ 2 + N[(0.5 * N[(U / N[(J * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;J \leq -1.25 \cdot 10^{-217}:\\
\;\;\;\;-2 \cdot \left(J \cdot \left(t_0 \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)\right)\right)\\
\mathbf{elif}\;J \leq 3.5 \cdot 10^{-300}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 1.3 \cdot 10^{-81}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(t_0 \cdot \left(J \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J \cdot t_0}\right)\right)\right)\\
\end{array}
\end{array}
if J < -1.2500000000000001e-217Initial program 81.1%
Simplified93.3%
if -1.2500000000000001e-217 < J < 3.5000000000000002e-300Initial program 25.4%
Simplified53.9%
Taylor expanded in U around -inf 60.1%
*-commutative60.1%
Simplified60.1%
if 3.5000000000000002e-300 < J < 1.2999999999999999e-81Initial program 43.4%
Simplified57.1%
Taylor expanded in J around 0 44.1%
if 1.2999999999999999e-81 < J Initial program 91.7%
associate-*l*91.7%
associate-*l*91.7%
*-commutative91.7%
unpow291.7%
sqr-neg91.7%
distribute-frac-neg91.7%
distribute-frac-neg91.7%
unpow291.7%
Simplified98.7%
Final simplification84.7%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* J (* (cos (/ K 2.0)) (hypot 1.0 (/ U (* J 2.0)))))))
(t_1 (* -2.0 (* U -0.5))))
(if (<= J -7.5e-90)
t_0
(if (<= J -9.6e-144)
t_1
(if (<= J -1.02e-214)
t_0
(if (<= J 3.5e-300)
t_1
(if (<= J 3.6e-44) (* -2.0 (* U 0.5)) t_0)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (J * (cos((K / 2.0)) * hypot(1.0, (U / (J * 2.0)))));
double t_1 = -2.0 * (U * -0.5);
double tmp;
if (J <= -7.5e-90) {
tmp = t_0;
} else if (J <= -9.6e-144) {
tmp = t_1;
} else if (J <= -1.02e-214) {
tmp = t_0;
} else if (J <= 3.5e-300) {
tmp = t_1;
} else if (J <= 3.6e-44) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = -2.0 * (J * (Math.cos((K / 2.0)) * Math.hypot(1.0, (U / (J * 2.0)))));
double t_1 = -2.0 * (U * -0.5);
double tmp;
if (J <= -7.5e-90) {
tmp = t_0;
} else if (J <= -9.6e-144) {
tmp = t_1;
} else if (J <= -1.02e-214) {
tmp = t_0;
} else if (J <= 3.5e-300) {
tmp = t_1;
} else if (J <= 3.6e-44) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (J * (math.cos((K / 2.0)) * math.hypot(1.0, (U / (J * 2.0))))) t_1 = -2.0 * (U * -0.5) tmp = 0 if J <= -7.5e-90: tmp = t_0 elif J <= -9.6e-144: tmp = t_1 elif J <= -1.02e-214: tmp = t_0 elif J <= 3.5e-300: tmp = t_1 elif J <= 3.6e-44: tmp = -2.0 * (U * 0.5) else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(J * Float64(cos(Float64(K / 2.0)) * hypot(1.0, Float64(U / Float64(J * 2.0)))))) t_1 = Float64(-2.0 * Float64(U * -0.5)) tmp = 0.0 if (J <= -7.5e-90) tmp = t_0; elseif (J <= -9.6e-144) tmp = t_1; elseif (J <= -1.02e-214) tmp = t_0; elseif (J <= 3.5e-300) tmp = t_1; elseif (J <= 3.6e-44) tmp = Float64(-2.0 * Float64(U * 0.5)); else tmp = t_0; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = -2.0 * (J * (cos((K / 2.0)) * hypot(1.0, (U / (J * 2.0))))); t_1 = -2.0 * (U * -0.5); tmp = 0.0; if (J <= -7.5e-90) tmp = t_0; elseif (J <= -9.6e-144) tmp = t_1; elseif (J <= -1.02e-214) tmp = t_0; elseif (J <= 3.5e-300) tmp = t_1; elseif (J <= 3.6e-44) tmp = -2.0 * (U * 0.5); else tmp = t_0; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(-2.0 * N[(J * N[(N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U / N[(J * 2.0), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -7.5e-90], t$95$0, If[LessEqual[J, -9.6e-144], t$95$1, If[LessEqual[J, -1.02e-214], t$95$0, If[LessEqual[J, 3.5e-300], t$95$1, If[LessEqual[J, 3.6e-44], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(J \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot 2}\right)\right)\right)\\
t_1 := -2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{if}\;J \leq -7.5 \cdot 10^{-90}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq -9.6 \cdot 10^{-144}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -1.02 \cdot 10^{-214}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 3.5 \cdot 10^{-300}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq 3.6 \cdot 10^{-44}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -7.4999999999999999e-90 or -9.59999999999999975e-144 < J < -1.0200000000000001e-214 or 3.5999999999999999e-44 < J Initial program 87.9%
Simplified98.2%
Taylor expanded in K around 0 84.3%
*-commutative84.3%
Simplified84.3%
if -7.4999999999999999e-90 < J < -9.59999999999999975e-144 or -1.0200000000000001e-214 < J < 3.5000000000000002e-300Initial program 39.1%
Simplified58.7%
Taylor expanded in U around -inf 55.5%
*-commutative55.5%
Simplified55.5%
if 3.5000000000000002e-300 < J < 3.5999999999999999e-44Initial program 49.3%
Simplified63.3%
Taylor expanded in J around 0 42.7%
Final simplification72.7%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* J (hypot 1.0 (* 0.5 (/ U J))))))
(t_1 (* -2.0 (* J (cos (/ K 2.0))))))
(if (<= J -4.2e+121)
t_1
(if (<= J -3.4e-92)
t_0
(if (<= J 3.5e-300)
(* -2.0 (* U -0.5))
(if (<= J 2.4e-80)
(* -2.0 (* U 0.5))
(if (<= J 7.4e+79) t_0 t_1)))))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (J * hypot(1.0, (0.5 * (U / J))));
double t_1 = -2.0 * (J * cos((K / 2.0)));
double tmp;
if (J <= -4.2e+121) {
tmp = t_1;
} else if (J <= -3.4e-92) {
tmp = t_0;
} else if (J <= 3.5e-300) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 2.4e-80) {
tmp = -2.0 * (U * 0.5);
} else if (J <= 7.4e+79) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = -2.0 * (J * Math.hypot(1.0, (0.5 * (U / J))));
double t_1 = -2.0 * (J * Math.cos((K / 2.0)));
double tmp;
if (J <= -4.2e+121) {
tmp = t_1;
} else if (J <= -3.4e-92) {
tmp = t_0;
} else if (J <= 3.5e-300) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 2.4e-80) {
tmp = -2.0 * (U * 0.5);
} else if (J <= 7.4e+79) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (J * math.hypot(1.0, (0.5 * (U / J)))) t_1 = -2.0 * (J * math.cos((K / 2.0))) tmp = 0 if J <= -4.2e+121: tmp = t_1 elif J <= -3.4e-92: tmp = t_0 elif J <= 3.5e-300: tmp = -2.0 * (U * -0.5) elif J <= 2.4e-80: tmp = -2.0 * (U * 0.5) elif J <= 7.4e+79: tmp = t_0 else: tmp = t_1 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(J * hypot(1.0, Float64(0.5 * Float64(U / J))))) t_1 = Float64(-2.0 * Float64(J * cos(Float64(K / 2.0)))) tmp = 0.0 if (J <= -4.2e+121) tmp = t_1; elseif (J <= -3.4e-92) tmp = t_0; elseif (J <= 3.5e-300) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (J <= 2.4e-80) tmp = Float64(-2.0 * Float64(U * 0.5)); elseif (J <= 7.4e+79) tmp = t_0; else tmp = t_1; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = -2.0 * (J * hypot(1.0, (0.5 * (U / J)))); t_1 = -2.0 * (J * cos((K / 2.0))); tmp = 0.0; if (J <= -4.2e+121) tmp = t_1; elseif (J <= -3.4e-92) tmp = t_0; elseif (J <= 3.5e-300) tmp = -2.0 * (U * -0.5); elseif (J <= 2.4e-80) tmp = -2.0 * (U * 0.5); elseif (J <= 7.4e+79) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(-2.0 * N[(J * N[Sqrt[1.0 ^ 2 + N[(0.5 * N[(U / J), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-2.0 * N[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -4.2e+121], t$95$1, If[LessEqual[J, -3.4e-92], t$95$0, If[LessEqual[J, 3.5e-300], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 2.4e-80], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 7.4e+79], t$95$0, t$95$1]]]]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(J \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J}\right)\right)\\
t_1 := -2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)\\
\mathbf{if}\;J \leq -4.2 \cdot 10^{+121}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;J \leq -3.4 \cdot 10^{-92}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 3.5 \cdot 10^{-300}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 2.4 \cdot 10^{-80}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{elif}\;J \leq 7.4 \cdot 10^{+79}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if J < -4.2000000000000003e121 or 7.40000000000000019e79 < J Initial program 99.8%
associate-*l*99.8%
associate-*l*99.8%
*-commutative99.8%
unpow299.8%
sqr-neg99.8%
distribute-frac-neg99.8%
distribute-frac-neg99.8%
unpow299.8%
Simplified99.8%
Taylor expanded in J around inf 87.6%
if -4.2000000000000003e121 < J < -3.4000000000000003e-92 or 2.3999999999999999e-80 < J < 7.40000000000000019e79Initial program 78.2%
Simplified97.6%
Taylor expanded in K around 0 50.8%
unpow250.8%
unpow250.8%
Simplified50.8%
expm1-log1p-u29.3%
expm1-udef18.3%
add-sqr-sqrt18.3%
hypot-1-def18.3%
sqrt-prod18.3%
metadata-eval18.3%
times-frac22.8%
sqrt-prod10.8%
add-sqr-sqrt27.1%
Applied egg-rr27.1%
expm1-def38.1%
expm1-log1p71.7%
Simplified71.7%
if -3.4000000000000003e-92 < J < 3.5000000000000002e-300Initial program 46.4%
Simplified67.5%
Taylor expanded in U around -inf 47.3%
*-commutative47.3%
Simplified47.3%
if 3.5000000000000002e-300 < J < 2.3999999999999999e-80Initial program 43.4%
Simplified57.1%
Taylor expanded in J around 0 44.1%
Final simplification67.7%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(let* ((t_0 (* -2.0 (* J (cos (/ K 2.0))))))
(if (<= J -6.3e+50)
t_0
(if (<= J 3.5e-300)
(* -2.0 (* U -0.5))
(if (<= J 1.05e+27) (* -2.0 (* U 0.5)) t_0)))))U = abs(U);
double code(double J, double K, double U) {
double t_0 = -2.0 * (J * cos((K / 2.0)));
double tmp;
if (J <= -6.3e+50) {
tmp = t_0;
} else if (J <= 3.5e-300) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 1.05e+27) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
NOTE: U should be positive before calling this function
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
real(8) :: tmp
t_0 = (-2.0d0) * (j * cos((k / 2.0d0)))
if (j <= (-6.3d+50)) then
tmp = t_0
else if (j <= 3.5d-300) then
tmp = (-2.0d0) * (u * (-0.5d0))
else if (j <= 1.05d+27) then
tmp = (-2.0d0) * (u * 0.5d0)
else
tmp = t_0
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double t_0 = -2.0 * (J * Math.cos((K / 2.0)));
double tmp;
if (J <= -6.3e+50) {
tmp = t_0;
} else if (J <= 3.5e-300) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 1.05e+27) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = t_0;
}
return tmp;
}
U = abs(U) def code(J, K, U): t_0 = -2.0 * (J * math.cos((K / 2.0))) tmp = 0 if J <= -6.3e+50: tmp = t_0 elif J <= 3.5e-300: tmp = -2.0 * (U * -0.5) elif J <= 1.05e+27: tmp = -2.0 * (U * 0.5) else: tmp = t_0 return tmp
U = abs(U) function code(J, K, U) t_0 = Float64(-2.0 * Float64(J * cos(Float64(K / 2.0)))) tmp = 0.0 if (J <= -6.3e+50) tmp = t_0; elseif (J <= 3.5e-300) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (J <= 1.05e+27) tmp = Float64(-2.0 * Float64(U * 0.5)); else tmp = t_0; end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) t_0 = -2.0 * (J * cos((K / 2.0))); tmp = 0.0; if (J <= -6.3e+50) tmp = t_0; elseif (J <= 3.5e-300) tmp = -2.0 * (U * -0.5); elseif (J <= 1.05e+27) tmp = -2.0 * (U * 0.5); else tmp = t_0; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function
code[J_, K_, U_] := Block[{t$95$0 = N[(-2.0 * N[(J * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[J, -6.3e+50], t$95$0, If[LessEqual[J, 3.5e-300], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 1.05e+27], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
t_0 := -2 \cdot \left(J \cdot \cos \left(\frac{K}{2}\right)\right)\\
\mathbf{if}\;J \leq -6.3 \cdot 10^{+50}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;J \leq 3.5 \cdot 10^{-300}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 1.05 \cdot 10^{+27}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if J < -6.29999999999999986e50 or 1.04999999999999997e27 < J Initial program 96.5%
associate-*l*96.5%
associate-*l*96.5%
*-commutative96.5%
unpow296.5%
sqr-neg96.5%
distribute-frac-neg96.5%
distribute-frac-neg96.5%
unpow296.5%
Simplified99.7%
Taylor expanded in J around inf 81.4%
if -6.29999999999999986e50 < J < 3.5000000000000002e-300Initial program 54.1%
Simplified77.5%
Taylor expanded in U around -inf 42.0%
*-commutative42.0%
Simplified42.0%
if 3.5000000000000002e-300 < J < 1.04999999999999997e27Initial program 58.7%
Simplified72.0%
Taylor expanded in J around 0 36.5%
Final simplification57.7%
NOTE: U should be positive before calling this function
(FPCore (J K U)
:precision binary64
(if (<= J -2.2e+49)
(* -2.0 J)
(if (<= J 2.25e-299)
(* -2.0 (* U -0.5))
(if (<= J 2.05e+80) (* -2.0 (* U 0.5)) (* -2.0 J)))))U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (J <= -2.2e+49) {
tmp = -2.0 * J;
} else if (J <= 2.25e-299) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 2.05e+80) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = -2.0 * J;
}
return tmp;
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (j <= (-2.2d+49)) then
tmp = (-2.0d0) * j
else if (j <= 2.25d-299) then
tmp = (-2.0d0) * (u * (-0.5d0))
else if (j <= 2.05d+80) then
tmp = (-2.0d0) * (u * 0.5d0)
else
tmp = (-2.0d0) * j
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double tmp;
if (J <= -2.2e+49) {
tmp = -2.0 * J;
} else if (J <= 2.25e-299) {
tmp = -2.0 * (U * -0.5);
} else if (J <= 2.05e+80) {
tmp = -2.0 * (U * 0.5);
} else {
tmp = -2.0 * J;
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if J <= -2.2e+49: tmp = -2.0 * J elif J <= 2.25e-299: tmp = -2.0 * (U * -0.5) elif J <= 2.05e+80: tmp = -2.0 * (U * 0.5) else: tmp = -2.0 * J return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (J <= -2.2e+49) tmp = Float64(-2.0 * J); elseif (J <= 2.25e-299) tmp = Float64(-2.0 * Float64(U * -0.5)); elseif (J <= 2.05e+80) tmp = Float64(-2.0 * Float64(U * 0.5)); else tmp = Float64(-2.0 * J); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (J <= -2.2e+49) tmp = -2.0 * J; elseif (J <= 2.25e-299) tmp = -2.0 * (U * -0.5); elseif (J <= 2.05e+80) tmp = -2.0 * (U * 0.5); else tmp = -2.0 * J; end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[J, -2.2e+49], N[(-2.0 * J), $MachinePrecision], If[LessEqual[J, 2.25e-299], N[(-2.0 * N[(U * -0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[J, 2.05e+80], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision], N[(-2.0 * J), $MachinePrecision]]]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;J \leq -2.2 \cdot 10^{+49}:\\
\;\;\;\;-2 \cdot J\\
\mathbf{elif}\;J \leq 2.25 \cdot 10^{-299}:\\
\;\;\;\;-2 \cdot \left(U \cdot -0.5\right)\\
\mathbf{elif}\;J \leq 2.05 \cdot 10^{+80}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot J\\
\end{array}
\end{array}
if J < -2.2000000000000001e49 or 2.05000000000000001e80 < J Initial program 98.9%
Simplified99.8%
Taylor expanded in K around 0 48.1%
unpow248.1%
unpow248.1%
Simplified48.1%
Taylor expanded in U around 0 49.3%
if -2.2000000000000001e49 < J < 2.25000000000000001e-299Initial program 54.1%
Simplified77.5%
Taylor expanded in U around -inf 42.0%
*-commutative42.0%
Simplified42.0%
if 2.25000000000000001e-299 < J < 2.05000000000000001e80Initial program 61.9%
Simplified76.8%
Taylor expanded in J around 0 34.9%
Final simplification42.9%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (if (<= U 900000000.0) (* -2.0 J) (* -2.0 (* U 0.5))))
U = abs(U);
double code(double J, double K, double U) {
double tmp;
if (U <= 900000000.0) {
tmp = -2.0 * J;
} else {
tmp = -2.0 * (U * 0.5);
}
return tmp;
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
real(8) :: tmp
if (u <= 900000000.0d0) then
tmp = (-2.0d0) * j
else
tmp = (-2.0d0) * (u * 0.5d0)
end if
code = tmp
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
double tmp;
if (U <= 900000000.0) {
tmp = -2.0 * J;
} else {
tmp = -2.0 * (U * 0.5);
}
return tmp;
}
U = abs(U) def code(J, K, U): tmp = 0 if U <= 900000000.0: tmp = -2.0 * J else: tmp = -2.0 * (U * 0.5) return tmp
U = abs(U) function code(J, K, U) tmp = 0.0 if (U <= 900000000.0) tmp = Float64(-2.0 * J); else tmp = Float64(-2.0 * Float64(U * 0.5)); end return tmp end
U = abs(U) function tmp_2 = code(J, K, U) tmp = 0.0; if (U <= 900000000.0) tmp = -2.0 * J; else tmp = -2.0 * (U * 0.5); end tmp_2 = tmp; end
NOTE: U should be positive before calling this function code[J_, K_, U_] := If[LessEqual[U, 900000000.0], N[(-2.0 * J), $MachinePrecision], N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
U = |U|\\
\\
\begin{array}{l}
\mathbf{if}\;U \leq 900000000:\\
\;\;\;\;-2 \cdot J\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(U \cdot 0.5\right)\\
\end{array}
\end{array}
if U < 9e8Initial program 80.1%
Simplified92.4%
Taylor expanded in K around 0 41.1%
unpow241.1%
unpow241.1%
Simplified41.1%
Taylor expanded in U around 0 33.3%
if 9e8 < U Initial program 53.6%
Simplified66.6%
Taylor expanded in J around 0 32.5%
Final simplification33.1%
NOTE: U should be positive before calling this function (FPCore (J K U) :precision binary64 (* -2.0 (* U 0.5)))
U = abs(U);
double code(double J, double K, double U) {
return -2.0 * (U * 0.5);
}
NOTE: U should be positive before calling this function
real(8) function code(j, k, u)
real(8), intent (in) :: j
real(8), intent (in) :: k
real(8), intent (in) :: u
code = (-2.0d0) * (u * 0.5d0)
end function
U = Math.abs(U);
public static double code(double J, double K, double U) {
return -2.0 * (U * 0.5);
}
U = abs(U) def code(J, K, U): return -2.0 * (U * 0.5)
U = abs(U) function code(J, K, U) return Float64(-2.0 * Float64(U * 0.5)) end
U = abs(U) function tmp = code(J, K, U) tmp = -2.0 * (U * 0.5); end
NOTE: U should be positive before calling this function code[J_, K_, U_] := N[(-2.0 * N[(U * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
U = |U|\\
\\
-2 \cdot \left(U \cdot 0.5\right)
\end{array}
Initial program 73.4%
Simplified85.8%
Taylor expanded in J around 0 25.1%
Final simplification25.1%
herbie shell --seed 2023279
(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)))))