
(FPCore (z0 z1) :precision binary64 (/ (exp (/ (* -0.3333333333333333 z0) z1)) (* (* PI 6.0) z1)))
double code(double z0, double z1) {
return exp(((-0.3333333333333333 * z0) / z1)) / ((((double) M_PI) * 6.0) * z1);
}
public static double code(double z0, double z1) {
return Math.exp(((-0.3333333333333333 * z0) / z1)) / ((Math.PI * 6.0) * z1);
}
def code(z0, z1): return math.exp(((-0.3333333333333333 * z0) / z1)) / ((math.pi * 6.0) * z1)
function code(z0, z1) return Float64(exp(Float64(Float64(-0.3333333333333333 * z0) / z1)) / Float64(Float64(pi * 6.0) * z1)) end
function tmp = code(z0, z1) tmp = exp(((-0.3333333333333333 * z0) / z1)) / ((pi * 6.0) * z1); end
code[z0_, z1_] := N[(N[Exp[N[(N[(-0.3333333333333333 * z0), $MachinePrecision] / z1), $MachinePrecision]], $MachinePrecision] / N[(N[(Pi * 6.0), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision]
\frac{e^{\frac{-0.3333333333333333 \cdot z0}{z1}}}{\left(\pi \cdot 6\right) \cdot z1}
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0 z1) :precision binary64 (/ (exp (/ (* -0.3333333333333333 z0) z1)) (* (* PI 6.0) z1)))
double code(double z0, double z1) {
return exp(((-0.3333333333333333 * z0) / z1)) / ((((double) M_PI) * 6.0) * z1);
}
public static double code(double z0, double z1) {
return Math.exp(((-0.3333333333333333 * z0) / z1)) / ((Math.PI * 6.0) * z1);
}
def code(z0, z1): return math.exp(((-0.3333333333333333 * z0) / z1)) / ((math.pi * 6.0) * z1)
function code(z0, z1) return Float64(exp(Float64(Float64(-0.3333333333333333 * z0) / z1)) / Float64(Float64(pi * 6.0) * z1)) end
function tmp = code(z0, z1) tmp = exp(((-0.3333333333333333 * z0) / z1)) / ((pi * 6.0) * z1); end
code[z0_, z1_] := N[(N[Exp[N[(N[(-0.3333333333333333 * z0), $MachinePrecision] / z1), $MachinePrecision]], $MachinePrecision] / N[(N[(Pi * 6.0), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision]
\frac{e^{\frac{-0.3333333333333333 \cdot z0}{z1}}}{\left(\pi \cdot 6\right) \cdot z1}
(FPCore (z0 z1) :precision binary64 (* (/ (pow (exp (/ z0 z1)) -0.3333333333333333) z1) 0.05305164769729845))
double code(double z0, double z1) {
return (pow(exp((z0 / z1)), -0.3333333333333333) / z1) * 0.05305164769729845;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
code = ((exp((z0 / z1)) ** (-0.3333333333333333d0)) / z1) * 0.05305164769729845d0
end function
public static double code(double z0, double z1) {
return (Math.pow(Math.exp((z0 / z1)), -0.3333333333333333) / z1) * 0.05305164769729845;
}
def code(z0, z1): return (math.pow(math.exp((z0 / z1)), -0.3333333333333333) / z1) * 0.05305164769729845
function code(z0, z1) return Float64(Float64((exp(Float64(z0 / z1)) ^ -0.3333333333333333) / z1) * 0.05305164769729845) end
function tmp = code(z0, z1) tmp = ((exp((z0 / z1)) ^ -0.3333333333333333) / z1) * 0.05305164769729845; end
code[z0_, z1_] := N[(N[(N[Power[N[Exp[N[(z0 / z1), $MachinePrecision]], $MachinePrecision], -0.3333333333333333], $MachinePrecision] / z1), $MachinePrecision] * 0.05305164769729845), $MachinePrecision]
\frac{{\left(e^{\frac{z0}{z1}}\right)}^{-0.3333333333333333}}{z1} \cdot 0.05305164769729845
Initial program 99.5%
Evaluated real constant99.5%
lift-/.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
sinh-+-cosh-revN/A
sinh-+-cosh-revN/A
lift-exp.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval99.6%
Applied rewrites99.6%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6499.6%
Applied rewrites99.6%
(FPCore (z0 z1) :precision binary64 (* (/ (exp (* (/ z0 z1) -0.3333333333333333)) z1) 0.05305164769729845))
double code(double z0, double z1) {
return (exp(((z0 / z1) * -0.3333333333333333)) / z1) * 0.05305164769729845;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
code = (exp(((z0 / z1) * (-0.3333333333333333d0))) / z1) * 0.05305164769729845d0
end function
public static double code(double z0, double z1) {
return (Math.exp(((z0 / z1) * -0.3333333333333333)) / z1) * 0.05305164769729845;
}
def code(z0, z1): return (math.exp(((z0 / z1) * -0.3333333333333333)) / z1) * 0.05305164769729845
function code(z0, z1) return Float64(Float64(exp(Float64(Float64(z0 / z1) * -0.3333333333333333)) / z1) * 0.05305164769729845) end
function tmp = code(z0, z1) tmp = (exp(((z0 / z1) * -0.3333333333333333)) / z1) * 0.05305164769729845; end
code[z0_, z1_] := N[(N[(N[Exp[N[(N[(z0 / z1), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]], $MachinePrecision] / z1), $MachinePrecision] * 0.05305164769729845), $MachinePrecision]
\frac{e^{\frac{z0}{z1} \cdot -0.3333333333333333}}{z1} \cdot 0.05305164769729845
Initial program 99.5%
Evaluated real constant99.5%
lift-/.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
sinh-+-cosh-revN/A
sinh-+-cosh-revN/A
lift-exp.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval99.6%
Applied rewrites99.6%
(FPCore (z0 z1)
:precision binary64
(let* ((t_0
(/
(exp (/ (* -0.3333333333333333 z0) z1))
(* (* PI 6.0) z1))))
(if (<= t_0 -2e-219)
(/
(/ (+ 0.16666666666666666 (* -0.05555555555555555 (/ z0 z1))) z1)
PI)
(if (<= t_0 5e-203)
(*
(/ (pow (+ 1.0 (/ z0 z1)) -0.3333333333333333) z1)
0.05305164769729845)
(/
(/ (- (* (/ z0 z1) -0.3333333333333333) -1.0) (* PI z1))
6.0)))))double code(double z0, double z1) {
double t_0 = exp(((-0.3333333333333333 * z0) / z1)) / ((((double) M_PI) * 6.0) * z1);
double tmp;
if (t_0 <= -2e-219) {
tmp = ((0.16666666666666666 + (-0.05555555555555555 * (z0 / z1))) / z1) / ((double) M_PI);
} else if (t_0 <= 5e-203) {
tmp = (pow((1.0 + (z0 / z1)), -0.3333333333333333) / z1) * 0.05305164769729845;
} else {
tmp = ((((z0 / z1) * -0.3333333333333333) - -1.0) / (((double) M_PI) * z1)) / 6.0;
}
return tmp;
}
public static double code(double z0, double z1) {
double t_0 = Math.exp(((-0.3333333333333333 * z0) / z1)) / ((Math.PI * 6.0) * z1);
double tmp;
if (t_0 <= -2e-219) {
tmp = ((0.16666666666666666 + (-0.05555555555555555 * (z0 / z1))) / z1) / Math.PI;
} else if (t_0 <= 5e-203) {
tmp = (Math.pow((1.0 + (z0 / z1)), -0.3333333333333333) / z1) * 0.05305164769729845;
} else {
tmp = ((((z0 / z1) * -0.3333333333333333) - -1.0) / (Math.PI * z1)) / 6.0;
}
return tmp;
}
def code(z0, z1): t_0 = math.exp(((-0.3333333333333333 * z0) / z1)) / ((math.pi * 6.0) * z1) tmp = 0 if t_0 <= -2e-219: tmp = ((0.16666666666666666 + (-0.05555555555555555 * (z0 / z1))) / z1) / math.pi elif t_0 <= 5e-203: tmp = (math.pow((1.0 + (z0 / z1)), -0.3333333333333333) / z1) * 0.05305164769729845 else: tmp = ((((z0 / z1) * -0.3333333333333333) - -1.0) / (math.pi * z1)) / 6.0 return tmp
function code(z0, z1) t_0 = Float64(exp(Float64(Float64(-0.3333333333333333 * z0) / z1)) / Float64(Float64(pi * 6.0) * z1)) tmp = 0.0 if (t_0 <= -2e-219) tmp = Float64(Float64(Float64(0.16666666666666666 + Float64(-0.05555555555555555 * Float64(z0 / z1))) / z1) / pi); elseif (t_0 <= 5e-203) tmp = Float64(Float64((Float64(1.0 + Float64(z0 / z1)) ^ -0.3333333333333333) / z1) * 0.05305164769729845); else tmp = Float64(Float64(Float64(Float64(Float64(z0 / z1) * -0.3333333333333333) - -1.0) / Float64(pi * z1)) / 6.0); end return tmp end
function tmp_2 = code(z0, z1) t_0 = exp(((-0.3333333333333333 * z0) / z1)) / ((pi * 6.0) * z1); tmp = 0.0; if (t_0 <= -2e-219) tmp = ((0.16666666666666666 + (-0.05555555555555555 * (z0 / z1))) / z1) / pi; elseif (t_0 <= 5e-203) tmp = (((1.0 + (z0 / z1)) ^ -0.3333333333333333) / z1) * 0.05305164769729845; else tmp = ((((z0 / z1) * -0.3333333333333333) - -1.0) / (pi * z1)) / 6.0; end tmp_2 = tmp; end
code[z0_, z1_] := Block[{t$95$0 = N[(N[Exp[N[(N[(-0.3333333333333333 * z0), $MachinePrecision] / z1), $MachinePrecision]], $MachinePrecision] / N[(N[(Pi * 6.0), $MachinePrecision] * z1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-219], N[(N[(N[(0.16666666666666666 + N[(-0.05555555555555555 * N[(z0 / z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z1), $MachinePrecision] / Pi), $MachinePrecision], If[LessEqual[t$95$0, 5e-203], N[(N[(N[Power[N[(1.0 + N[(z0 / z1), $MachinePrecision]), $MachinePrecision], -0.3333333333333333], $MachinePrecision] / z1), $MachinePrecision] * 0.05305164769729845), $MachinePrecision], N[(N[(N[(N[(N[(z0 / z1), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] - -1.0), $MachinePrecision] / N[(Pi * z1), $MachinePrecision]), $MachinePrecision] / 6.0), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{e^{\frac{-0.3333333333333333 \cdot z0}{z1}}}{\left(\pi \cdot 6\right) \cdot z1}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-219}:\\
\;\;\;\;\frac{\frac{0.16666666666666666 + -0.05555555555555555 \cdot \frac{z0}{z1}}{z1}}{\pi}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-203}:\\
\;\;\;\;\frac{{\left(1 + \frac{z0}{z1}\right)}^{-0.3333333333333333}}{z1} \cdot 0.05305164769729845\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{z0}{z1} \cdot -0.3333333333333333 - -1}{\pi \cdot z1}}{6}\\
\end{array}
if (/.f64 (exp.f64 (/.f64 (*.f64 #s(literal -3333333333333333/10000000000000000 binary64) z0) z1)) (*.f64 (*.f64 (PI.f64) #s(literal 6 binary64)) z1)) < -2.0000000000000001e-219Initial program 99.5%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6462.6%
Applied rewrites62.6%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites62.6%
Taylor expanded in z1 around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6462.9%
Applied rewrites62.9%
if -2.0000000000000001e-219 < (/.f64 (exp.f64 (/.f64 (*.f64 #s(literal -3333333333333333/10000000000000000 binary64) z0) z1)) (*.f64 (*.f64 (PI.f64) #s(literal 6 binary64)) z1)) < 5.0000000000000002e-203Initial program 99.5%
Evaluated real constant99.5%
lift-/.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
sinh-+-cosh-revN/A
sinh-+-cosh-revN/A
lift-exp.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval99.6%
Applied rewrites99.6%
lift-exp.f64N/A
lift-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f6499.6%
Applied rewrites99.6%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-/.f6456.6%
Applied rewrites56.6%
if 5.0000000000000002e-203 < (/.f64 (exp.f64 (/.f64 (*.f64 #s(literal -3333333333333333/10000000000000000 binary64) z0) z1)) (*.f64 (*.f64 (PI.f64) #s(literal 6 binary64)) z1)) Initial program 99.5%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6462.6%
Applied rewrites62.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites62.7%
(FPCore (z0 z1) :precision binary64 (/ (/ (- (* (/ -0.3333333333333333 z1) z0) -1.0) z1) (* PI 6.0)))
double code(double z0, double z1) {
return ((((-0.3333333333333333 / z1) * z0) - -1.0) / z1) / (((double) M_PI) * 6.0);
}
public static double code(double z0, double z1) {
return ((((-0.3333333333333333 / z1) * z0) - -1.0) / z1) / (Math.PI * 6.0);
}
def code(z0, z1): return ((((-0.3333333333333333 / z1) * z0) - -1.0) / z1) / (math.pi * 6.0)
function code(z0, z1) return Float64(Float64(Float64(Float64(Float64(-0.3333333333333333 / z1) * z0) - -1.0) / z1) / Float64(pi * 6.0)) end
function tmp = code(z0, z1) tmp = ((((-0.3333333333333333 / z1) * z0) - -1.0) / z1) / (pi * 6.0); end
code[z0_, z1_] := N[(N[(N[(N[(N[(-0.3333333333333333 / z1), $MachinePrecision] * z0), $MachinePrecision] - -1.0), $MachinePrecision] / z1), $MachinePrecision] / N[(Pi * 6.0), $MachinePrecision]), $MachinePrecision]
\frac{\frac{\frac{-0.3333333333333333}{z1} \cdot z0 - -1}{z1}}{\pi \cdot 6}
Initial program 99.5%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6462.6%
Applied rewrites62.6%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6462.6%
Applied rewrites62.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6462.8%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6462.8%
Applied rewrites62.8%
(FPCore (z0 z1) :precision binary64 (/ (/ (+ 0.16666666666666666 (* -0.05555555555555555 (/ z0 z1))) z1) PI))
double code(double z0, double z1) {
return ((0.16666666666666666 + (-0.05555555555555555 * (z0 / z1))) / z1) / ((double) M_PI);
}
public static double code(double z0, double z1) {
return ((0.16666666666666666 + (-0.05555555555555555 * (z0 / z1))) / z1) / Math.PI;
}
def code(z0, z1): return ((0.16666666666666666 + (-0.05555555555555555 * (z0 / z1))) / z1) / math.pi
function code(z0, z1) return Float64(Float64(Float64(0.16666666666666666 + Float64(-0.05555555555555555 * Float64(z0 / z1))) / z1) / pi) end
function tmp = code(z0, z1) tmp = ((0.16666666666666666 + (-0.05555555555555555 * (z0 / z1))) / z1) / pi; end
code[z0_, z1_] := N[(N[(N[(0.16666666666666666 + N[(-0.05555555555555555 * N[(z0 / z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z1), $MachinePrecision] / Pi), $MachinePrecision]
\frac{\frac{0.16666666666666666 + -0.05555555555555555 \cdot \frac{z0}{z1}}{z1}}{\pi}
Initial program 99.5%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6462.6%
Applied rewrites62.6%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
metadata-evalN/A
Applied rewrites62.6%
Taylor expanded in z1 around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6462.9%
Applied rewrites62.9%
(FPCore (z0 z1) :precision binary64 (* (/ (+ 1.0 (* -0.3333333333333333 (/ z0 z1))) z1) 0.05305164769729845))
double code(double z0, double z1) {
return ((1.0 + (-0.3333333333333333 * (z0 / z1))) / z1) * 0.05305164769729845;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
code = ((1.0d0 + ((-0.3333333333333333d0) * (z0 / z1))) / z1) * 0.05305164769729845d0
end function
public static double code(double z0, double z1) {
return ((1.0 + (-0.3333333333333333 * (z0 / z1))) / z1) * 0.05305164769729845;
}
def code(z0, z1): return ((1.0 + (-0.3333333333333333 * (z0 / z1))) / z1) * 0.05305164769729845
function code(z0, z1) return Float64(Float64(Float64(1.0 + Float64(-0.3333333333333333 * Float64(z0 / z1))) / z1) * 0.05305164769729845) end
function tmp = code(z0, z1) tmp = ((1.0 + (-0.3333333333333333 * (z0 / z1))) / z1) * 0.05305164769729845; end
code[z0_, z1_] := N[(N[(N[(1.0 + N[(-0.3333333333333333 * N[(z0 / z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z1), $MachinePrecision] * 0.05305164769729845), $MachinePrecision]
\frac{1 + -0.3333333333333333 \cdot \frac{z0}{z1}}{z1} \cdot 0.05305164769729845
Initial program 99.5%
Evaluated real constant99.5%
lift-/.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
sinh-+-cosh-revN/A
sinh-+-cosh-revN/A
lift-exp.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval99.6%
Applied rewrites99.6%
Taylor expanded in z0 around 0
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6462.8%
Applied rewrites62.8%
(FPCore (z0 z1) :precision binary64 (/ (+ 0.05305164769729845 (* -0.017683882565766147 (/ z0 z1))) z1))
double code(double z0, double z1) {
return (0.05305164769729845 + (-0.017683882565766147 * (z0 / z1))) / z1;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
code = (0.05305164769729845d0 + ((-0.017683882565766147d0) * (z0 / z1))) / z1
end function
public static double code(double z0, double z1) {
return (0.05305164769729845 + (-0.017683882565766147 * (z0 / z1))) / z1;
}
def code(z0, z1): return (0.05305164769729845 + (-0.017683882565766147 * (z0 / z1))) / z1
function code(z0, z1) return Float64(Float64(0.05305164769729845 + Float64(-0.017683882565766147 * Float64(z0 / z1))) / z1) end
function tmp = code(z0, z1) tmp = (0.05305164769729845 + (-0.017683882565766147 * (z0 / z1))) / z1; end
code[z0_, z1_] := N[(N[(0.05305164769729845 + N[(-0.017683882565766147 * N[(z0 / z1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z1), $MachinePrecision]
\frac{0.05305164769729845 + -0.017683882565766147 \cdot \frac{z0}{z1}}{z1}
Initial program 99.5%
Evaluated real constant99.5%
Taylor expanded in z1 around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f6462.8%
Applied rewrites62.8%
(FPCore (z0 z1) :precision binary64 (* (/ 1.0 PI) (/ 0.16666666666666666 z1)))
double code(double z0, double z1) {
return (1.0 / ((double) M_PI)) * (0.16666666666666666 / z1);
}
public static double code(double z0, double z1) {
return (1.0 / Math.PI) * (0.16666666666666666 / z1);
}
def code(z0, z1): return (1.0 / math.pi) * (0.16666666666666666 / z1)
function code(z0, z1) return Float64(Float64(1.0 / pi) * Float64(0.16666666666666666 / z1)) end
function tmp = code(z0, z1) tmp = (1.0 / pi) * (0.16666666666666666 / z1); end
code[z0_, z1_] := N[(N[(1.0 / Pi), $MachinePrecision] * N[(0.16666666666666666 / z1), $MachinePrecision]), $MachinePrecision]
\frac{1}{\pi} \cdot \frac{0.16666666666666666}{z1}
Initial program 99.5%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.2%
Applied rewrites51.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
mult-flipN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6451.3%
Applied rewrites51.3%
(FPCore (z0 z1) :precision binary64 (/ (/ 0.16666666666666666 z1) PI))
double code(double z0, double z1) {
return (0.16666666666666666 / z1) / ((double) M_PI);
}
public static double code(double z0, double z1) {
return (0.16666666666666666 / z1) / Math.PI;
}
def code(z0, z1): return (0.16666666666666666 / z1) / math.pi
function code(z0, z1) return Float64(Float64(0.16666666666666666 / z1) / pi) end
function tmp = code(z0, z1) tmp = (0.16666666666666666 / z1) / pi; end
code[z0_, z1_] := N[(N[(0.16666666666666666 / z1), $MachinePrecision] / Pi), $MachinePrecision]
\frac{\frac{0.16666666666666666}{z1}}{\pi}
Initial program 99.5%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.2%
Applied rewrites51.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6451.3%
Applied rewrites51.3%
(FPCore (z0 z1) :precision binary64 (/ 0.16666666666666666 (* z1 PI)))
double code(double z0, double z1) {
return 0.16666666666666666 / (z1 * ((double) M_PI));
}
public static double code(double z0, double z1) {
return 0.16666666666666666 / (z1 * Math.PI);
}
def code(z0, z1): return 0.16666666666666666 / (z1 * math.pi)
function code(z0, z1) return Float64(0.16666666666666666 / Float64(z1 * pi)) end
function tmp = code(z0, z1) tmp = 0.16666666666666666 / (z1 * pi); end
code[z0_, z1_] := N[(0.16666666666666666 / N[(z1 * Pi), $MachinePrecision]), $MachinePrecision]
\frac{0.16666666666666666}{z1 \cdot \pi}
Initial program 99.5%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-PI.f6451.2%
Applied rewrites51.2%
(FPCore (z0 z1) :precision binary64 (/ 0.05305164769729845 z1))
double code(double z0, double z1) {
return 0.05305164769729845 / z1;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z0, z1)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z1
code = 0.05305164769729845d0 / z1
end function
public static double code(double z0, double z1) {
return 0.05305164769729845 / z1;
}
def code(z0, z1): return 0.05305164769729845 / z1
function code(z0, z1) return Float64(0.05305164769729845 / z1) end
function tmp = code(z0, z1) tmp = 0.05305164769729845 / z1; end
code[z0_, z1_] := N[(0.05305164769729845 / z1), $MachinePrecision]
\frac{0.05305164769729845}{z1}
Initial program 99.5%
Evaluated real constant99.5%
Taylor expanded in z0 around 0
lower-/.f6451.2%
Applied rewrites51.2%
herbie shell --seed 2025250
(FPCore (z0 z1)
:name "(/ (exp (/ (* -3333333333333333/10000000000000000 z0) z1)) (* (* PI 6) z1))"
:precision binary64
(/ (exp (/ (* -0.3333333333333333 z0) z1)) (* (* PI 6.0) z1)))