
(FPCore (phi x es k0) :precision binary64 :pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0)) (/ (* x (sqrt (- 1.0 (* es (* (sin phi) (sin phi)))))) k0))
double code(double phi, double x, double es, double k0) {
return (x * sqrt((1.0 - (es * (sin(phi) * sin(phi)))))) / k0;
}
real(8) function code(phi, x, es, k0)
use fmin_fmax_functions
real(8), intent (in) :: phi
real(8), intent (in) :: x
real(8), intent (in) :: es
real(8), intent (in) :: k0
code = (x * sqrt((1.0d0 - (es * (sin(phi) * sin(phi)))))) / k0
end function
public static double code(double phi, double x, double es, double k0) {
return (x * Math.sqrt((1.0 - (es * (Math.sin(phi) * Math.sin(phi)))))) / k0;
}
def code(phi, x, es, k0): return (x * math.sqrt((1.0 - (es * (math.sin(phi) * math.sin(phi)))))) / k0
function code(phi, x, es, k0) return Float64(Float64(x * sqrt(Float64(1.0 - Float64(es * Float64(sin(phi) * sin(phi)))))) / k0) end
function tmp = code(phi, x, es, k0) tmp = (x * sqrt((1.0 - (es * (sin(phi) * sin(phi)))))) / k0; end
code[phi_, x_, es_, k0_] := N[(N[(x * N[Sqrt[N[(1.0 - N[(es * N[(N[Sin[phi], $MachinePrecision] * N[Sin[phi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / k0), $MachinePrecision]
f(phi, x, es, k0): phi in [-inf, +inf], x in [-inf, +inf], es in [0, 1], k0 in [0, +inf] code: THEORY BEGIN f(phi, x, es, k0: real): real = (x * (sqrt(((1) - (es * ((sin(phi)) * (sin(phi)))))))) / k0 END code
\frac{x \cdot \sqrt{1 - es \cdot \left(\sin \phi \cdot \sin \phi\right)}}{k0}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (phi x es k0) :precision binary64 :pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0)) (/ (* x (sqrt (- 1.0 (* es (* (sin phi) (sin phi)))))) k0))
double code(double phi, double x, double es, double k0) {
return (x * sqrt((1.0 - (es * (sin(phi) * sin(phi)))))) / k0;
}
real(8) function code(phi, x, es, k0)
use fmin_fmax_functions
real(8), intent (in) :: phi
real(8), intent (in) :: x
real(8), intent (in) :: es
real(8), intent (in) :: k0
code = (x * sqrt((1.0d0 - (es * (sin(phi) * sin(phi)))))) / k0
end function
public static double code(double phi, double x, double es, double k0) {
return (x * Math.sqrt((1.0 - (es * (Math.sin(phi) * Math.sin(phi)))))) / k0;
}
def code(phi, x, es, k0): return (x * math.sqrt((1.0 - (es * (math.sin(phi) * math.sin(phi)))))) / k0
function code(phi, x, es, k0) return Float64(Float64(x * sqrt(Float64(1.0 - Float64(es * Float64(sin(phi) * sin(phi)))))) / k0) end
function tmp = code(phi, x, es, k0) tmp = (x * sqrt((1.0 - (es * (sin(phi) * sin(phi)))))) / k0; end
code[phi_, x_, es_, k0_] := N[(N[(x * N[Sqrt[N[(1.0 - N[(es * N[(N[Sin[phi], $MachinePrecision] * N[Sin[phi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / k0), $MachinePrecision]
f(phi, x, es, k0): phi in [-inf, +inf], x in [-inf, +inf], es in [0, 1], k0 in [0, +inf] code: THEORY BEGIN f(phi, x, es, k0: real): real = (x * (sqrt(((1) - (es * ((sin(phi)) * (sin(phi)))))))) / k0 END code
\frac{x \cdot \sqrt{1 - es \cdot \left(\sin \phi \cdot \sin \phi\right)}}{k0}
(FPCore (phi x es k0) :precision binary64 :pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0)) (/ (* x (sqrt (- 1.0 (* es (fma (cos (+ phi phi)) -0.5 0.5))))) k0))
double code(double phi, double x, double es, double k0) {
return (x * sqrt((1.0 - (es * fma(cos((phi + phi)), -0.5, 0.5))))) / k0;
}
function code(phi, x, es, k0) return Float64(Float64(x * sqrt(Float64(1.0 - Float64(es * fma(cos(Float64(phi + phi)), -0.5, 0.5))))) / k0) end
code[phi_, x_, es_, k0_] := N[(N[(x * N[Sqrt[N[(1.0 - N[(es * N[(N[Cos[N[(phi + phi), $MachinePrecision]], $MachinePrecision] * -0.5 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / k0), $MachinePrecision]
f(phi, x, es, k0): phi in [-inf, +inf], x in [-inf, +inf], es in [0, 1], k0 in [0, +inf] code: THEORY BEGIN f(phi, x, es, k0: real): real = (x * (sqrt(((1) - (es * (((cos((phi + phi))) * (-5e-1)) + (5e-1))))))) / k0 END code
\frac{x \cdot \sqrt{1 - es \cdot \mathsf{fma}\left(\cos \left(\phi + \phi\right), -0.5, 0.5\right)}}{k0}
Initial program 100.0%
Taylor expanded in phi around inf
Applied rewrites100.0%
Applied rewrites99.9%
(FPCore (phi x es k0) :precision binary64 :pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0)) (/ x k0))
double code(double phi, double x, double es, double k0) {
return x / k0;
}
real(8) function code(phi, x, es, k0)
use fmin_fmax_functions
real(8), intent (in) :: phi
real(8), intent (in) :: x
real(8), intent (in) :: es
real(8), intent (in) :: k0
code = x / k0
end function
public static double code(double phi, double x, double es, double k0) {
return x / k0;
}
def code(phi, x, es, k0): return x / k0
function code(phi, x, es, k0) return Float64(x / k0) end
function tmp = code(phi, x, es, k0) tmp = x / k0; end
code[phi_, x_, es_, k0_] := N[(x / k0), $MachinePrecision]
f(phi, x, es, k0): phi in [-inf, +inf], x in [-inf, +inf], es in [0, 1], k0 in [0, +inf] code: THEORY BEGIN f(phi, x, es, k0: real): real = x / k0 END code
\frac{x}{k0}
Initial program 100.0%
Taylor expanded in phi around 0
Applied rewrites99.3%
(FPCore (phi x es k0)
:precision binary64
:pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0))
(*
(copysign 1.0 x)
(if (<=
(/
(* (fabs x) (sqrt (- 1.0 (* es (* (sin phi) (sin phi))))))
k0)
5e-205)
0.0
(fabs x))))double code(double phi, double x, double es, double k0) {
double tmp;
if (((fabs(x) * sqrt((1.0 - (es * (sin(phi) * sin(phi)))))) / k0) <= 5e-205) {
tmp = 0.0;
} else {
tmp = fabs(x);
}
return copysign(1.0, x) * tmp;
}
public static double code(double phi, double x, double es, double k0) {
double tmp;
if (((Math.abs(x) * Math.sqrt((1.0 - (es * (Math.sin(phi) * Math.sin(phi)))))) / k0) <= 5e-205) {
tmp = 0.0;
} else {
tmp = Math.abs(x);
}
return Math.copySign(1.0, x) * tmp;
}
def code(phi, x, es, k0): tmp = 0 if ((math.fabs(x) * math.sqrt((1.0 - (es * (math.sin(phi) * math.sin(phi)))))) / k0) <= 5e-205: tmp = 0.0 else: tmp = math.fabs(x) return math.copysign(1.0, x) * tmp
function code(phi, x, es, k0) tmp = 0.0 if (Float64(Float64(abs(x) * sqrt(Float64(1.0 - Float64(es * Float64(sin(phi) * sin(phi)))))) / k0) <= 5e-205) tmp = 0.0; else tmp = abs(x); end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(phi, x, es, k0) tmp = 0.0; if (((abs(x) * sqrt((1.0 - (es * (sin(phi) * sin(phi)))))) / k0) <= 5e-205) tmp = 0.0; else tmp = abs(x); end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[phi_, x_, es_, k0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Abs[x], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(es * N[(N[Sin[phi], $MachinePrecision] * N[Sin[phi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / k0), $MachinePrecision], 5e-205], 0.0, N[Abs[x], $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left|x\right| \cdot \sqrt{1 - es \cdot \left(\sin \phi \cdot \sin \phi\right)}}{k0} \leq 5 \cdot 10^{-205}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\left|x\right|\\
\end{array}
if (/.f64 (*.f64 x (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 es (*.f64 (sin.f64 phi) (sin.f64 phi)))))) k0) < 5e-205Initial program 100.0%
Applied rewrites15.0%
if 5e-205 < (/.f64 (*.f64 x (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 es (*.f64 (sin.f64 phi) (sin.f64 phi)))))) k0) Initial program 100.0%
Applied rewrites5.9%
(FPCore (phi x es k0)
:precision binary64
:pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0))
(*
(copysign 1.0 x)
(if (<=
(/
(* (fabs x) (sqrt (- 1.0 (* es (* (sin phi) (sin phi))))))
k0)
1e-154)
0.0
5.0)))double code(double phi, double x, double es, double k0) {
double tmp;
if (((fabs(x) * sqrt((1.0 - (es * (sin(phi) * sin(phi)))))) / k0) <= 1e-154) {
tmp = 0.0;
} else {
tmp = 5.0;
}
return copysign(1.0, x) * tmp;
}
public static double code(double phi, double x, double es, double k0) {
double tmp;
if (((Math.abs(x) * Math.sqrt((1.0 - (es * (Math.sin(phi) * Math.sin(phi)))))) / k0) <= 1e-154) {
tmp = 0.0;
} else {
tmp = 5.0;
}
return Math.copySign(1.0, x) * tmp;
}
def code(phi, x, es, k0): tmp = 0 if ((math.fabs(x) * math.sqrt((1.0 - (es * (math.sin(phi) * math.sin(phi)))))) / k0) <= 1e-154: tmp = 0.0 else: tmp = 5.0 return math.copysign(1.0, x) * tmp
function code(phi, x, es, k0) tmp = 0.0 if (Float64(Float64(abs(x) * sqrt(Float64(1.0 - Float64(es * Float64(sin(phi) * sin(phi)))))) / k0) <= 1e-154) tmp = 0.0; else tmp = 5.0; end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(phi, x, es, k0) tmp = 0.0; if (((abs(x) * sqrt((1.0 - (es * (sin(phi) * sin(phi)))))) / k0) <= 1e-154) tmp = 0.0; else tmp = 5.0; end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[phi_, x_, es_, k0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Abs[x], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(es * N[(N[Sin[phi], $MachinePrecision] * N[Sin[phi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / k0), $MachinePrecision], 1e-154], 0.0, 5.0]), $MachinePrecision]
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left|x\right| \cdot \sqrt{1 - es \cdot \left(\sin \phi \cdot \sin \phi\right)}}{k0} \leq 10^{-154}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;5\\
\end{array}
if (/.f64 (*.f64 x (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 es (*.f64 (sin.f64 phi) (sin.f64 phi)))))) k0) < 9.9999999999999997e-155Initial program 100.0%
Applied rewrites15.0%
if 9.9999999999999997e-155 < (/.f64 (*.f64 x (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 es (*.f64 (sin.f64 phi) (sin.f64 phi)))))) k0) Initial program 100.0%
Applied rewrites98.6%
Applied rewrites98.3%
Applied rewrites3.4%
(FPCore (phi x es k0)
:precision binary64
:pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0))
(*
(copysign 1.0 x)
(if (<=
(/
(* (fabs x) (sqrt (- 1.0 (* es (* (sin phi) (sin phi))))))
k0)
9.283953195393688e-154)
0.0
4.0)))double code(double phi, double x, double es, double k0) {
double tmp;
if (((fabs(x) * sqrt((1.0 - (es * (sin(phi) * sin(phi)))))) / k0) <= 9.283953195393688e-154) {
tmp = 0.0;
} else {
tmp = 4.0;
}
return copysign(1.0, x) * tmp;
}
public static double code(double phi, double x, double es, double k0) {
double tmp;
if (((Math.abs(x) * Math.sqrt((1.0 - (es * (Math.sin(phi) * Math.sin(phi)))))) / k0) <= 9.283953195393688e-154) {
tmp = 0.0;
} else {
tmp = 4.0;
}
return Math.copySign(1.0, x) * tmp;
}
def code(phi, x, es, k0): tmp = 0 if ((math.fabs(x) * math.sqrt((1.0 - (es * (math.sin(phi) * math.sin(phi)))))) / k0) <= 9.283953195393688e-154: tmp = 0.0 else: tmp = 4.0 return math.copysign(1.0, x) * tmp
function code(phi, x, es, k0) tmp = 0.0 if (Float64(Float64(abs(x) * sqrt(Float64(1.0 - Float64(es * Float64(sin(phi) * sin(phi)))))) / k0) <= 9.283953195393688e-154) tmp = 0.0; else tmp = 4.0; end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(phi, x, es, k0) tmp = 0.0; if (((abs(x) * sqrt((1.0 - (es * (sin(phi) * sin(phi)))))) / k0) <= 9.283953195393688e-154) tmp = 0.0; else tmp = 4.0; end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[phi_, x_, es_, k0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Abs[x], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(es * N[(N[Sin[phi], $MachinePrecision] * N[Sin[phi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / k0), $MachinePrecision], 9.283953195393688e-154], 0.0, 4.0]), $MachinePrecision]
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left|x\right| \cdot \sqrt{1 - es \cdot \left(\sin \phi \cdot \sin \phi\right)}}{k0} \leq 9.283953195393688 \cdot 10^{-154}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;4\\
\end{array}
if (/.f64 (*.f64 x (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 es (*.f64 (sin.f64 phi) (sin.f64 phi)))))) k0) < 9.283953195393688e-154Initial program 100.0%
Applied rewrites15.0%
if 9.283953195393688e-154 < (/.f64 (*.f64 x (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 es (*.f64 (sin.f64 phi) (sin.f64 phi)))))) k0) Initial program 100.0%
Applied rewrites3.4%
(FPCore (phi x es k0)
:precision binary64
:pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0))
(*
(copysign 1.0 x)
(if (<=
(/
(* (fabs x) (sqrt (- 1.0 (* es (* (sin phi) (sin phi))))))
k0)
3.6415987898463463e-155)
0.0
0.00390625)))double code(double phi, double x, double es, double k0) {
double tmp;
if (((fabs(x) * sqrt((1.0 - (es * (sin(phi) * sin(phi)))))) / k0) <= 3.6415987898463463e-155) {
tmp = 0.0;
} else {
tmp = 0.00390625;
}
return copysign(1.0, x) * tmp;
}
public static double code(double phi, double x, double es, double k0) {
double tmp;
if (((Math.abs(x) * Math.sqrt((1.0 - (es * (Math.sin(phi) * Math.sin(phi)))))) / k0) <= 3.6415987898463463e-155) {
tmp = 0.0;
} else {
tmp = 0.00390625;
}
return Math.copySign(1.0, x) * tmp;
}
def code(phi, x, es, k0): tmp = 0 if ((math.fabs(x) * math.sqrt((1.0 - (es * (math.sin(phi) * math.sin(phi)))))) / k0) <= 3.6415987898463463e-155: tmp = 0.0 else: tmp = 0.00390625 return math.copysign(1.0, x) * tmp
function code(phi, x, es, k0) tmp = 0.0 if (Float64(Float64(abs(x) * sqrt(Float64(1.0 - Float64(es * Float64(sin(phi) * sin(phi)))))) / k0) <= 3.6415987898463463e-155) tmp = 0.0; else tmp = 0.00390625; end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(phi, x, es, k0) tmp = 0.0; if (((abs(x) * sqrt((1.0 - (es * (sin(phi) * sin(phi)))))) / k0) <= 3.6415987898463463e-155) tmp = 0.0; else tmp = 0.00390625; end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[phi_, x_, es_, k0_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Abs[x], $MachinePrecision] * N[Sqrt[N[(1.0 - N[(es * N[(N[Sin[phi], $MachinePrecision] * N[Sin[phi], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / k0), $MachinePrecision], 3.6415987898463463e-155], 0.0, 0.00390625]), $MachinePrecision]
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left|x\right| \cdot \sqrt{1 - es \cdot \left(\sin \phi \cdot \sin \phi\right)}}{k0} \leq 3.6415987898463463 \cdot 10^{-155}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;0.00390625\\
\end{array}
if (/.f64 (*.f64 x (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 es (*.f64 (sin.f64 phi) (sin.f64 phi)))))) k0) < 3.6415987898463463e-155Initial program 100.0%
Applied rewrites15.0%
if 3.6415987898463463e-155 < (/.f64 (*.f64 x (sqrt.f64 (-.f64 #s(literal 1 binary64) (*.f64 es (*.f64 (sin.f64 phi) (sin.f64 phi)))))) k0) Initial program 100.0%
Applied rewrites98.6%
Applied rewrites98.3%
Applied rewrites3.4%
(FPCore (phi x es k0) :precision binary64 :pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0)) 0.0)
double code(double phi, double x, double es, double k0) {
return 0.0;
}
real(8) function code(phi, x, es, k0)
use fmin_fmax_functions
real(8), intent (in) :: phi
real(8), intent (in) :: x
real(8), intent (in) :: es
real(8), intent (in) :: k0
code = 0.0d0
end function
public static double code(double phi, double x, double es, double k0) {
return 0.0;
}
def code(phi, x, es, k0): return 0.0
function code(phi, x, es, k0) return 0.0 end
function tmp = code(phi, x, es, k0) tmp = 0.0; end
code[phi_, x_, es_, k0_] := 0.0
f(phi, x, es, k0): phi in [-inf, +inf], x in [-inf, +inf], es in [0, 1], k0 in [0, +inf] code: THEORY BEGIN f(phi, x, es, k0: real): real = 0 END code
0
Initial program 100.0%
Applied rewrites15.0%
(FPCore (phi x es k0) :precision binary64 :pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0)) -0.015625)
double code(double phi, double x, double es, double k0) {
return -0.015625;
}
real(8) function code(phi, x, es, k0)
use fmin_fmax_functions
real(8), intent (in) :: phi
real(8), intent (in) :: x
real(8), intent (in) :: es
real(8), intent (in) :: k0
code = -0.015625d0
end function
public static double code(double phi, double x, double es, double k0) {
return -0.015625;
}
def code(phi, x, es, k0): return -0.015625
function code(phi, x, es, k0) return -0.015625 end
function tmp = code(phi, x, es, k0) tmp = -0.015625; end
code[phi_, x_, es_, k0_] := -0.015625
f(phi, x, es, k0): phi in [-inf, +inf], x in [-inf, +inf], es in [0, 1], k0 in [0, +inf] code: THEORY BEGIN f(phi, x, es, k0: real): real = -15625e-6 END code
-0.015625
Initial program 100.0%
Applied rewrites98.6%
Applied rewrites98.3%
Applied rewrites3.4%
(FPCore (phi x es k0) :precision binary64 :pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0)) -0.5)
double code(double phi, double x, double es, double k0) {
return -0.5;
}
real(8) function code(phi, x, es, k0)
use fmin_fmax_functions
real(8), intent (in) :: phi
real(8), intent (in) :: x
real(8), intent (in) :: es
real(8), intent (in) :: k0
code = -0.5d0
end function
public static double code(double phi, double x, double es, double k0) {
return -0.5;
}
def code(phi, x, es, k0): return -0.5
function code(phi, x, es, k0) return -0.5 end
function tmp = code(phi, x, es, k0) tmp = -0.5; end
code[phi_, x_, es_, k0_] := -0.5
f(phi, x, es, k0): phi in [-inf, +inf], x in [-inf, +inf], es in [0, 1], k0 in [0, +inf] code: THEORY BEGIN f(phi, x, es, k0: real): real = -5e-1 END code
-0.5
Initial program 100.0%
Applied rewrites3.4%
(FPCore (phi x es k0) :precision binary64 :pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0)) -2.0)
double code(double phi, double x, double es, double k0) {
return -2.0;
}
real(8) function code(phi, x, es, k0)
use fmin_fmax_functions
real(8), intent (in) :: phi
real(8), intent (in) :: x
real(8), intent (in) :: es
real(8), intent (in) :: k0
code = -2.0d0
end function
public static double code(double phi, double x, double es, double k0) {
return -2.0;
}
def code(phi, x, es, k0): return -2.0
function code(phi, x, es, k0) return -2.0 end
function tmp = code(phi, x, es, k0) tmp = -2.0; end
code[phi_, x_, es_, k0_] := -2.0
f(phi, x, es, k0): phi in [-inf, +inf], x in [-inf, +inf], es in [0, 1], k0 in [0, +inf] code: THEORY BEGIN f(phi, x, es, k0: real): real = -2 END code
-2
Initial program 100.0%
Applied rewrites3.4%
(FPCore (phi x es k0) :precision binary64 :pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0)) -3.141592653589793)
double code(double phi, double x, double es, double k0) {
return -3.141592653589793;
}
real(8) function code(phi, x, es, k0)
use fmin_fmax_functions
real(8), intent (in) :: phi
real(8), intent (in) :: x
real(8), intent (in) :: es
real(8), intent (in) :: k0
code = -3.141592653589793d0
end function
public static double code(double phi, double x, double es, double k0) {
return -3.141592653589793;
}
def code(phi, x, es, k0): return -3.141592653589793
function code(phi, x, es, k0) return -3.141592653589793 end
function tmp = code(phi, x, es, k0) tmp = -3.141592653589793; end
code[phi_, x_, es_, k0_] := -3.141592653589793
f(phi, x, es, k0): phi in [-inf, +inf], x in [-inf, +inf], es in [0, 1], k0 in [0, +inf] code: THEORY BEGIN f(phi, x, es, k0: real): real = -3141592653589793115997963468544185161590576171875e-48 END code
-3.141592653589793
Initial program 100.0%
Applied rewrites3.4%
Evaluated real constant3.4%
(FPCore (phi x es k0) :precision binary64 :pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0)) -16.0)
double code(double phi, double x, double es, double k0) {
return -16.0;
}
real(8) function code(phi, x, es, k0)
use fmin_fmax_functions
real(8), intent (in) :: phi
real(8), intent (in) :: x
real(8), intent (in) :: es
real(8), intent (in) :: k0
code = -16.0d0
end function
public static double code(double phi, double x, double es, double k0) {
return -16.0;
}
def code(phi, x, es, k0): return -16.0
function code(phi, x, es, k0) return -16.0 end
function tmp = code(phi, x, es, k0) tmp = -16.0; end
code[phi_, x_, es_, k0_] := -16.0
f(phi, x, es, k0): phi in [-inf, +inf], x in [-inf, +inf], es in [0, 1], k0 in [0, +inf] code: THEORY BEGIN f(phi, x, es, k0: real): real = -16 END code
-16
Initial program 100.0%
Applied rewrites98.6%
Applied rewrites98.3%
Applied rewrites3.4%
herbie shell --seed 2026050 +o generate:egglog
(FPCore (phi x es k0)
:name "approx-inv-d-term"
:precision binary64
:pre (and (and (>= es 0.0) (< es 1.0)) (> k0 0.0))
(/ (* x (sqrt (- 1.0 (* es (* (sin phi) (sin phi)))))) k0))