
(FPCore (x y z t a b) :precision binary64 (- (* (* 2 (sqrt x)) (cos (- y (/ (* z t) 3)))) (/ a (* b 3))))
double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * sqrt(x)) * cos((y - ((z * t) / 3.0)))) - (a / (b * 3.0));
}
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(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((2.0d0 * sqrt(x)) * cos((y - ((z * t) / 3.0d0)))) - (a / (b * 3.0d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * Math.sqrt(x)) * Math.cos((y - ((z * t) / 3.0)))) - (a / (b * 3.0));
}
def code(x, y, z, t, a, b): return ((2.0 * math.sqrt(x)) * math.cos((y - ((z * t) / 3.0)))) - (a / (b * 3.0))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(2.0 * sqrt(x)) * cos(Float64(y - Float64(Float64(z * t) / 3.0)))) - Float64(a / Float64(b * 3.0))) end
function tmp = code(x, y, z, t, a, b) tmp = ((2.0 * sqrt(x)) * cos((y - ((z * t) / 3.0)))) - (a / (b * 3.0)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(2 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(a / N[(b * 3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (- (* (* 2 (sqrt x)) (cos (- y (/ (* z t) 3)))) (/ a (* b 3))))
double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * sqrt(x)) * cos((y - ((z * t) / 3.0)))) - (a / (b * 3.0));
}
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(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((2.0d0 * sqrt(x)) * cos((y - ((z * t) / 3.0d0)))) - (a / (b * 3.0d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * Math.sqrt(x)) * Math.cos((y - ((z * t) / 3.0)))) - (a / (b * 3.0));
}
def code(x, y, z, t, a, b): return ((2.0 * math.sqrt(x)) * math.cos((y - ((z * t) / 3.0)))) - (a / (b * 3.0))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(2.0 * sqrt(x)) * cos(Float64(y - Float64(Float64(z * t) / 3.0)))) - Float64(a / Float64(b * 3.0))) end
function tmp = code(x, y, z, t, a, b) tmp = ((2.0 * sqrt(x)) * cos((y - ((z * t) / 3.0)))) - (a / (b * 3.0)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(2 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(a / N[(b * 3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 2 (sqrt x))) (t_2 (* (- (* -1/3 z)) t)))
(if (<=
(* t_1 (cos (- y (/ (* z t) 3))))
5764607523034235/1152921504606846976)
(-
(* t_1 (+ (* (cos y) (cos t_2)) (* (sin y) (sin t_2))))
(/ a (* b 3)))
(- (* t_1 (cos y)) (/ (/ a 3) b)))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 2.0 * sqrt(x);
double t_2 = -(-0.3333333333333333 * z) * t;
double tmp;
if ((t_1 * cos((y - ((z * t) / 3.0)))) <= 0.005) {
tmp = (t_1 * ((cos(y) * cos(t_2)) + (sin(y) * sin(t_2)))) - (a / (b * 3.0));
} else {
tmp = (t_1 * cos(y)) - ((a / 3.0) / b);
}
return tmp;
}
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(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 2.0d0 * sqrt(x)
t_2 = -((-0.3333333333333333d0) * z) * t
if ((t_1 * cos((y - ((z * t) / 3.0d0)))) <= 0.005d0) then
tmp = (t_1 * ((cos(y) * cos(t_2)) + (sin(y) * sin(t_2)))) - (a / (b * 3.0d0))
else
tmp = (t_1 * cos(y)) - ((a / 3.0d0) / b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 2.0 * Math.sqrt(x);
double t_2 = -(-0.3333333333333333 * z) * t;
double tmp;
if ((t_1 * Math.cos((y - ((z * t) / 3.0)))) <= 0.005) {
tmp = (t_1 * ((Math.cos(y) * Math.cos(t_2)) + (Math.sin(y) * Math.sin(t_2)))) - (a / (b * 3.0));
} else {
tmp = (t_1 * Math.cos(y)) - ((a / 3.0) / b);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = 2.0 * math.sqrt(x) t_2 = -(-0.3333333333333333 * z) * t tmp = 0 if (t_1 * math.cos((y - ((z * t) / 3.0)))) <= 0.005: tmp = (t_1 * ((math.cos(y) * math.cos(t_2)) + (math.sin(y) * math.sin(t_2)))) - (a / (b * 3.0)) else: tmp = (t_1 * math.cos(y)) - ((a / 3.0) / b) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(2.0 * sqrt(x)) t_2 = Float64(Float64(-Float64(-0.3333333333333333 * z)) * t) tmp = 0.0 if (Float64(t_1 * cos(Float64(y - Float64(Float64(z * t) / 3.0)))) <= 0.005) tmp = Float64(Float64(t_1 * Float64(Float64(cos(y) * cos(t_2)) + Float64(sin(y) * sin(t_2)))) - Float64(a / Float64(b * 3.0))); else tmp = Float64(Float64(t_1 * cos(y)) - Float64(Float64(a / 3.0) / b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = 2.0 * sqrt(x); t_2 = -(-0.3333333333333333 * z) * t; tmp = 0.0; if ((t_1 * cos((y - ((z * t) / 3.0)))) <= 0.005) tmp = (t_1 * ((cos(y) * cos(t_2)) + (sin(y) * sin(t_2)))) - (a / (b * 3.0)); else tmp = (t_1 * cos(y)) - ((a / 3.0) / b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(2 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[(-1/3 * z), $MachinePrecision]) * t), $MachinePrecision]}, If[LessEqual[N[(t$95$1 * N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 5764607523034235/1152921504606846976], N[(N[(t$95$1 * N[(N[(N[Cos[y], $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[y], $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[(b * 3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[(a / 3), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := 2 \cdot \sqrt{x}\\
t_2 := \left(-\frac{-1}{3} \cdot z\right) \cdot t\\
\mathbf{if}\;t\_1 \cdot \cos \left(y - \frac{z \cdot t}{3}\right) \leq \frac{5764607523034235}{1152921504606846976}:\\
\;\;\;\;t\_1 \cdot \left(\cos y \cdot \cos t\_2 + \sin y \cdot \sin t\_2\right) - \frac{a}{b \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \cos y - \frac{\frac{a}{3}}{b}\\
\end{array}
if (*.f64 (*.f64 #s(literal 2 binary64) (sqrt.f64 x)) (cos.f64 (-.f64 y (/.f64 (*.f64 z t) #s(literal 3 binary64))))) < 0.0050000000000000001Initial program 70.7%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-eval70.8%
Applied rewrites70.8%
lift-cos.f64N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
fp-cancel-sign-sub-invN/A
cos-diffN/A
lower-+.f64N/A
Applied rewrites71.2%
if 0.0050000000000000001 < (*.f64 (*.f64 #s(literal 2 binary64) (sqrt.f64 x)) (cos.f64 (-.f64 y (/.f64 (*.f64 z t) #s(literal 3 binary64))))) Initial program 70.7%
Taylor expanded in z around 0
lower-cos.f6476.7%
Applied rewrites76.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6476.7%
Applied rewrites76.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ a (* b 3)))
(t_2 (* 2 (sqrt x)))
(t_3 (* -1/3 (* t z))))
(if (<=
(* t_2 (cos (- y (/ (* z t) 3))))
499999999999999988998191202828830087182411944733900540386126622484631969614553746213463024711630256984884134207768538734419216153365573197681917952)
(- (* t_2 (- (* (cos t_3) (cos y)) (* (sin t_3) (sin y)))) t_1)
(- (* (* 2 (/ 1 (pow x -1/2))) (sin (+ (- y) (* 1/2 PI)))) t_1))))double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a / (b * 3.0);
double t_2 = 2.0 * sqrt(x);
double t_3 = -0.3333333333333333 * (t * z);
double tmp;
if ((t_2 * cos((y - ((z * t) / 3.0)))) <= 5e+146) {
tmp = (t_2 * ((cos(t_3) * cos(y)) - (sin(t_3) * sin(y)))) - t_1;
} else {
tmp = ((2.0 * (1.0 / pow(x, -0.5))) * sin((-y + (0.5 * ((double) M_PI))))) - t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a / (b * 3.0);
double t_2 = 2.0 * Math.sqrt(x);
double t_3 = -0.3333333333333333 * (t * z);
double tmp;
if ((t_2 * Math.cos((y - ((z * t) / 3.0)))) <= 5e+146) {
tmp = (t_2 * ((Math.cos(t_3) * Math.cos(y)) - (Math.sin(t_3) * Math.sin(y)))) - t_1;
} else {
tmp = ((2.0 * (1.0 / Math.pow(x, -0.5))) * Math.sin((-y + (0.5 * Math.PI)))) - t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a / (b * 3.0) t_2 = 2.0 * math.sqrt(x) t_3 = -0.3333333333333333 * (t * z) tmp = 0 if (t_2 * math.cos((y - ((z * t) / 3.0)))) <= 5e+146: tmp = (t_2 * ((math.cos(t_3) * math.cos(y)) - (math.sin(t_3) * math.sin(y)))) - t_1 else: tmp = ((2.0 * (1.0 / math.pow(x, -0.5))) * math.sin((-y + (0.5 * math.pi)))) - t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a / Float64(b * 3.0)) t_2 = Float64(2.0 * sqrt(x)) t_3 = Float64(-0.3333333333333333 * Float64(t * z)) tmp = 0.0 if (Float64(t_2 * cos(Float64(y - Float64(Float64(z * t) / 3.0)))) <= 5e+146) tmp = Float64(Float64(t_2 * Float64(Float64(cos(t_3) * cos(y)) - Float64(sin(t_3) * sin(y)))) - t_1); else tmp = Float64(Float64(Float64(2.0 * Float64(1.0 / (x ^ -0.5))) * sin(Float64(Float64(-y) + Float64(0.5 * pi)))) - t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a / (b * 3.0); t_2 = 2.0 * sqrt(x); t_3 = -0.3333333333333333 * (t * z); tmp = 0.0; if ((t_2 * cos((y - ((z * t) / 3.0)))) <= 5e+146) tmp = (t_2 * ((cos(t_3) * cos(y)) - (sin(t_3) * sin(y)))) - t_1; else tmp = ((2.0 * (1.0 / (x ^ -0.5))) * sin((-y + (0.5 * pi)))) - t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a / N[(b * 3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(-1/3 * N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$2 * N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 499999999999999988998191202828830087182411944733900540386126622484631969614553746213463024711630256984884134207768538734419216153365573197681917952], N[(N[(t$95$2 * N[(N[(N[Cos[t$95$3], $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t$95$3], $MachinePrecision] * N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(N[(2 * N[(1 / N[Power[x, -1/2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[((-y) + N[(1/2 * Pi), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{a}{b \cdot 3}\\
t_2 := 2 \cdot \sqrt{x}\\
t_3 := \frac{-1}{3} \cdot \left(t \cdot z\right)\\
\mathbf{if}\;t\_2 \cdot \cos \left(y - \frac{z \cdot t}{3}\right) \leq 499999999999999988998191202828830087182411944733900540386126622484631969614553746213463024711630256984884134207768538734419216153365573197681917952:\\
\;\;\;\;t\_2 \cdot \left(\cos t\_3 \cdot \cos y - \sin t\_3 \cdot \sin y\right) - t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \frac{1}{{x}^{\frac{-1}{2}}}\right) \cdot \sin \left(\left(-y\right) + \frac{1}{2} \cdot \pi\right) - t\_1\\
\end{array}
if (*.f64 (*.f64 #s(literal 2 binary64) (sqrt.f64 x)) (cos.f64 (-.f64 y (/.f64 (*.f64 z t) #s(literal 3 binary64))))) < 4.9999999999999999e146Initial program 70.7%
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
mult-flipN/A
*-commutativeN/A
lift-*.f64N/A
lower-134-z0z1z2z3z4N/A
metadata-eval70.7%
Applied rewrites70.7%
Applied rewrites71.1%
if 4.9999999999999999e146 < (*.f64 (*.f64 #s(literal 2 binary64) (sqrt.f64 x)) (cos.f64 (-.f64 y (/.f64 (*.f64 z t) #s(literal 3 binary64))))) Initial program 70.7%
Taylor expanded in z around 0
lower-cos.f6476.7%
Applied rewrites76.7%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
metadata-eval76.7%
Applied rewrites76.7%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-PI.f64N/A
mult-flipN/A
metadata-evalN/A
lift-*.f64N/A
lower-+.f64N/A
lower-neg.f6465.6%
lift-*.f64N/A
*-commutativeN/A
lift-*.f6465.6%
Applied rewrites65.6%
(FPCore (x y z t a b) :precision binary64 (- (* (* 2 (sqrt x)) (cos y)) (/ (/ a 3) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * sqrt(x)) * cos(y)) - ((a / 3.0) / b);
}
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(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((2.0d0 * sqrt(x)) * cos(y)) - ((a / 3.0d0) / b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * Math.sqrt(x)) * Math.cos(y)) - ((a / 3.0) / b);
}
def code(x, y, z, t, a, b): return ((2.0 * math.sqrt(x)) * math.cos(y)) - ((a / 3.0) / b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(2.0 * sqrt(x)) * cos(y)) - Float64(Float64(a / 3.0) / b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((2.0 * sqrt(x)) * cos(y)) - ((a / 3.0) / b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(2 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[(a / 3), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]
\left(2 \cdot \sqrt{x}\right) \cdot \cos y - \frac{\frac{a}{3}}{b}
Initial program 70.7%
Taylor expanded in z around 0
lower-cos.f6476.7%
Applied rewrites76.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6476.7%
Applied rewrites76.7%
(FPCore (x y z t a b) :precision binary64 (- (* (* 2 (sqrt x)) (cos y)) (* (/ 1/3 b) a)))
double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * sqrt(x)) * cos(y)) - ((0.3333333333333333 / b) * a);
}
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(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((2.0d0 * sqrt(x)) * cos(y)) - ((0.3333333333333333d0 / b) * a)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * Math.sqrt(x)) * Math.cos(y)) - ((0.3333333333333333 / b) * a);
}
def code(x, y, z, t, a, b): return ((2.0 * math.sqrt(x)) * math.cos(y)) - ((0.3333333333333333 / b) * a)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(2.0 * sqrt(x)) * cos(y)) - Float64(Float64(0.3333333333333333 / b) * a)) end
function tmp = code(x, y, z, t, a, b) tmp = ((2.0 * sqrt(x)) * cos(y)) - ((0.3333333333333333 / b) * a); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(2 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[Cos[y], $MachinePrecision]), $MachinePrecision] - N[(N[(1/3 / b), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\left(2 \cdot \sqrt{x}\right) \cdot \cos y - \frac{\frac{1}{3}}{b} \cdot a
Initial program 70.7%
Taylor expanded in z around 0
lower-cos.f6476.7%
Applied rewrites76.7%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6476.6%
Applied rewrites76.6%
(FPCore (x y z t a b) :precision binary64 (- (* (* 2 (sqrt x)) 1) (/ a (* b 3))))
double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * sqrt(x)) * 1.0) - (a / (b * 3.0));
}
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(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((2.0d0 * sqrt(x)) * 1.0d0) - (a / (b * 3.0d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * Math.sqrt(x)) * 1.0) - (a / (b * 3.0));
}
def code(x, y, z, t, a, b): return ((2.0 * math.sqrt(x)) * 1.0) - (a / (b * 3.0))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(2.0 * sqrt(x)) * 1.0) - Float64(a / Float64(b * 3.0))) end
function tmp = code(x, y, z, t, a, b) tmp = ((2.0 * sqrt(x)) * 1.0) - (a / (b * 3.0)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(2 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * 1), $MachinePrecision] - N[(a / N[(b * 3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(2 \cdot \sqrt{x}\right) \cdot 1 - \frac{a}{b \cdot 3}
Initial program 70.7%
Taylor expanded in z around 0
lower-cos.f6476.7%
Applied rewrites76.7%
Taylor expanded in y around 0
Applied rewrites65.4%
(FPCore (x y z t a b) :precision binary64 (/ (/ a -3) b))
double code(double x, double y, double z, double t, double a, double b) {
return (a / -3.0) / b;
}
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(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (a / (-3.0d0)) / b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (a / -3.0) / b;
}
def code(x, y, z, t, a, b): return (a / -3.0) / b
function code(x, y, z, t, a, b) return Float64(Float64(a / -3.0) / b) end
function tmp = code(x, y, z, t, a, b) tmp = (a / -3.0) / b; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a / -3), $MachinePrecision] / b), $MachinePrecision]
\frac{\frac{a}{-3}}{b}
Initial program 70.7%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6450.3%
Applied rewrites50.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6450.4%
Applied rewrites50.4%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
metadata-eval50.4%
Applied rewrites50.4%
(FPCore (x y z t a b) :precision binary64 (* a (/ -1/3 b)))
double code(double x, double y, double z, double t, double a, double b) {
return a * (-0.3333333333333333 / b);
}
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(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = a * ((-0.3333333333333333d0) / b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a * (-0.3333333333333333 / b);
}
def code(x, y, z, t, a, b): return a * (-0.3333333333333333 / b)
function code(x, y, z, t, a, b) return Float64(a * Float64(-0.3333333333333333 / b)) end
function tmp = code(x, y, z, t, a, b) tmp = a * (-0.3333333333333333 / b); end
code[x_, y_, z_, t_, a_, b_] := N[(a * N[(-1/3 / b), $MachinePrecision]), $MachinePrecision]
a \cdot \frac{\frac{-1}{3}}{b}
Initial program 70.7%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6450.3%
Applied rewrites50.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6450.4%
Applied rewrites50.4%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
mult-flipN/A
lift-/.f64N/A
lower-/.f64N/A
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.3%
Applied rewrites50.3%
(FPCore (x y z t a b) :precision binary64 (* -1/3 (/ a b)))
double code(double x, double y, double z, double t, double a, double b) {
return -0.3333333333333333 * (a / b);
}
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(x, y, z, t, a, b)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (-0.3333333333333333d0) * (a / b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return -0.3333333333333333 * (a / b);
}
def code(x, y, z, t, a, b): return -0.3333333333333333 * (a / b)
function code(x, y, z, t, a, b) return Float64(-0.3333333333333333 * Float64(a / b)) end
function tmp = code(x, y, z, t, a, b) tmp = -0.3333333333333333 * (a / b); end
code[x_, y_, z_, t_, a_, b_] := N[(-1/3 * N[(a / b), $MachinePrecision]), $MachinePrecision]
\frac{-1}{3} \cdot \frac{a}{b}
Initial program 70.7%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6450.3%
Applied rewrites50.3%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, K"
:precision binary64
(- (* (* 2 (sqrt x)) (cos (- y (/ (* z t) 3)))) (/ a (* b 3))))