
(FPCore (x y z t a b) :precision binary64 (- (* (* 2.0 (sqrt x)) (cos (- y (/ (* z t) 3.0)))) (/ a (* b 3.0))))
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.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (- (* (* 2.0 (sqrt x)) (cos (- y (/ (* z t) 3.0)))) (/ a (* b 3.0))))
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.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(2 \cdot \sqrt{x}\right) \cdot \cos \left(y - \frac{z \cdot t}{3}\right) - \frac{a}{b \cdot 3}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (/ t 3.0))))
(if (<= (cos (- y (/ (* z t) 3.0))) 0.91)
(-
(* (* 2.0 (sqrt x)) (fma (cos y) (cos t_1) (* (sin y) (sin t_1))))
(/ a (* b 3.0)))
(fma
(* (sin (fma 0.5 PI y)) (sqrt x))
2.0
(* (/ a b) -0.3333333333333333)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * (t / 3.0);
double tmp;
if (cos((y - ((z * t) / 3.0))) <= 0.91) {
tmp = ((2.0 * sqrt(x)) * fma(cos(y), cos(t_1), (sin(y) * sin(t_1)))) - (a / (b * 3.0));
} else {
tmp = fma((sin(fma(0.5, ((double) M_PI), y)) * sqrt(x)), 2.0, ((a / b) * -0.3333333333333333));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(t / 3.0)) tmp = 0.0 if (cos(Float64(y - Float64(Float64(z * t) / 3.0))) <= 0.91) tmp = Float64(Float64(Float64(2.0 * sqrt(x)) * fma(cos(y), cos(t_1), Float64(sin(y) * sin(t_1)))) - Float64(a / Float64(b * 3.0))); else tmp = fma(Float64(sin(fma(0.5, pi, y)) * sqrt(x)), 2.0, Float64(Float64(a / b) * -0.3333333333333333)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(t / 3.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.91], N[(N[(N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * N[(N[Cos[y], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision] + N[(N[Sin[y], $MachinePrecision] * N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[N[(0.5 * Pi + y), $MachinePrecision]], $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(N[(a / b), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{t}{3}\\
\mathbf{if}\;\cos \left(y - \frac{z \cdot t}{3}\right) \leq 0.91:\\
\;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot \mathsf{fma}\left(\cos y, \cos t\_1, \sin y \cdot \sin t\_1\right) - \frac{a}{b \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sin \left(\mathsf{fma}\left(0.5, \pi, y\right)\right) \cdot \sqrt{x}, 2, \frac{a}{b} \cdot -0.3333333333333333\right)\\
\end{array}
\end{array}
if (cos.f64 (-.f64 y (/.f64 (*.f64 z t) #s(literal 3 binary64)))) < 0.910000000000000031Initial program 70.9%
lift-cos.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
cos-diffN/A
lower-fma.f64N/A
lower-cos.f64N/A
lower-cos.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6471.5
Applied rewrites71.5%
if 0.910000000000000031 < (cos.f64 (-.f64 y (/.f64 (*.f64 z t) #s(literal 3 binary64)))) Initial program 70.9%
lift-cos.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f6459.8
Applied rewrites59.8%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-PI.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6466.1
Applied rewrites66.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (cos (- y (/ (* z t) 3.0)))))
(if (<= t_1 0.975)
(- (* (* 2.0 (sqrt x)) t_1) (/ a (* b 3.0)))
(fma
(* (sin (fma 0.5 PI y)) (sqrt x))
2.0
(* (/ a b) -0.3333333333333333)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = cos((y - ((z * t) / 3.0)));
double tmp;
if (t_1 <= 0.975) {
tmp = ((2.0 * sqrt(x)) * t_1) - (a / (b * 3.0));
} else {
tmp = fma((sin(fma(0.5, ((double) M_PI), y)) * sqrt(x)), 2.0, ((a / b) * -0.3333333333333333));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = cos(Float64(y - Float64(Float64(z * t) / 3.0))) tmp = 0.0 if (t_1 <= 0.975) tmp = Float64(Float64(Float64(2.0 * sqrt(x)) * t_1) - Float64(a / Float64(b * 3.0))); else tmp = fma(Float64(sin(fma(0.5, pi, y)) * sqrt(x)), 2.0, Float64(Float64(a / b) * -0.3333333333333333)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$1, 0.975], N[(N[(N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] - N[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[N[(0.5 * Pi + y), $MachinePrecision]], $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(N[(a / b), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos \left(y - \frac{z \cdot t}{3}\right)\\
\mathbf{if}\;t\_1 \leq 0.975:\\
\;\;\;\;\left(2 \cdot \sqrt{x}\right) \cdot t\_1 - \frac{a}{b \cdot 3}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sin \left(\mathsf{fma}\left(0.5, \pi, y\right)\right) \cdot \sqrt{x}, 2, \frac{a}{b} \cdot -0.3333333333333333\right)\\
\end{array}
\end{array}
if (cos.f64 (-.f64 y (/.f64 (*.f64 z t) #s(literal 3 binary64)))) < 0.974999999999999978Initial program 70.9%
if 0.974999999999999978 < (cos.f64 (-.f64 y (/.f64 (*.f64 z t) #s(literal 3 binary64)))) Initial program 70.9%
lift-cos.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f6459.8
Applied rewrites59.8%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-PI.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6466.1
Applied rewrites66.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= (cos (- y (/ (* z t) 3.0))) 0.975)
(fma
(* (cos (fma (* 0.3333333333333333 t) z (- y))) (sqrt x))
2.0
(* -0.3333333333333333 (/ a b)))
(fma
(* (sin (fma 0.5 PI y)) (sqrt x))
2.0
(* (/ a b) -0.3333333333333333))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (cos((y - ((z * t) / 3.0))) <= 0.975) {
tmp = fma((cos(fma((0.3333333333333333 * t), z, -y)) * sqrt(x)), 2.0, (-0.3333333333333333 * (a / b)));
} else {
tmp = fma((sin(fma(0.5, ((double) M_PI), y)) * sqrt(x)), 2.0, ((a / b) * -0.3333333333333333));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (cos(Float64(y - Float64(Float64(z * t) / 3.0))) <= 0.975) tmp = fma(Float64(cos(fma(Float64(0.3333333333333333 * t), z, Float64(-y))) * sqrt(x)), 2.0, Float64(-0.3333333333333333 * Float64(a / b))); else tmp = fma(Float64(sin(fma(0.5, pi, y)) * sqrt(x)), 2.0, Float64(Float64(a / b) * -0.3333333333333333)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 0.975], N[(N[(N[Cos[N[(N[(0.3333333333333333 * t), $MachinePrecision] * z + (-y)), $MachinePrecision]], $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(-0.3333333333333333 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[N[(0.5 * Pi + y), $MachinePrecision]], $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * 2.0 + N[(N[(a / b), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos \left(y - \frac{z \cdot t}{3}\right) \leq 0.975:\\
\;\;\;\;\mathsf{fma}\left(\cos \left(\mathsf{fma}\left(0.3333333333333333 \cdot t, z, -y\right)\right) \cdot \sqrt{x}, 2, -0.3333333333333333 \cdot \frac{a}{b}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sin \left(\mathsf{fma}\left(0.5, \pi, y\right)\right) \cdot \sqrt{x}, 2, \frac{a}{b} \cdot -0.3333333333333333\right)\\
\end{array}
\end{array}
if (cos.f64 (-.f64 y (/.f64 (*.f64 z t) #s(literal 3 binary64)))) < 0.974999999999999978Initial program 70.9%
Taylor expanded in y around -inf
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
Applied rewrites70.9%
if 0.974999999999999978 < (cos.f64 (-.f64 y (/.f64 (*.f64 z t) #s(literal 3 binary64)))) Initial program 70.9%
lift-cos.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-PI.f6459.8
Applied rewrites59.8%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lift-PI.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6466.1
Applied rewrites66.1%
(FPCore (x y z t a b) :precision binary64 (- (* (* 2.0 (cos y)) (sqrt x)) (/ a (* b 3.0))))
double code(double x, double y, double z, double t, double a, double b) {
return ((2.0 * cos(y)) * sqrt(x)) - (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 * cos(y)) * sqrt(x)) - (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.cos(y)) * Math.sqrt(x)) - (a / (b * 3.0));
}
def code(x, y, z, t, a, b): return ((2.0 * math.cos(y)) * math.sqrt(x)) - (a / (b * 3.0))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(2.0 * cos(y)) * sqrt(x)) - Float64(a / Float64(b * 3.0))) end
function tmp = code(x, y, z, t, a, b) tmp = ((2.0 * cos(y)) * sqrt(x)) - (a / (b * 3.0)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(2.0 * N[Cos[y], $MachinePrecision]), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(2 \cdot \cos y\right) \cdot \sqrt{x} - \frac{a}{b \cdot 3}
\end{array}
Initial program 70.9%
Taylor expanded in z around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sqrt.f6477.5
Applied rewrites77.5%
(FPCore (x y z t a b) :precision binary64 (fma (* 2.0 (cos y)) (sqrt x) (* -0.3333333333333333 (/ a b))))
double code(double x, double y, double z, double t, double a, double b) {
return fma((2.0 * cos(y)), sqrt(x), (-0.3333333333333333 * (a / b)));
}
function code(x, y, z, t, a, b) return fma(Float64(2.0 * cos(y)), sqrt(x), Float64(-0.3333333333333333 * Float64(a / b))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(2.0 * N[Cos[y], $MachinePrecision]), $MachinePrecision] * N[Sqrt[x], $MachinePrecision] + N[(-0.3333333333333333 * N[(a / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2 \cdot \cos y, \sqrt{x}, -0.3333333333333333 \cdot \frac{a}{b}\right)
\end{array}
Initial program 70.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
associate-*r*N/A
metadata-evalN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sqrt.f64N/A
lower-*.f64N/A
lower-/.f6477.4
Applied rewrites77.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 2.0 (sqrt x))))
(if (<= (* t_1 (cos (- y (/ (* z t) 3.0)))) -5e-117)
(fma (/ a b) -0.3333333333333333 (* (- (* (/ 1.0 (sqrt x)) x)) 2.0))
(- t_1 (/ a (* b 3.0))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 2.0 * sqrt(x);
double tmp;
if ((t_1 * cos((y - ((z * t) / 3.0)))) <= -5e-117) {
tmp = fma((a / b), -0.3333333333333333, (-((1.0 / sqrt(x)) * x) * 2.0));
} else {
tmp = t_1 - (a / (b * 3.0));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(2.0 * sqrt(x)) tmp = 0.0 if (Float64(t_1 * cos(Float64(y - Float64(Float64(z * t) / 3.0)))) <= -5e-117) tmp = fma(Float64(a / b), -0.3333333333333333, Float64(Float64(-Float64(Float64(1.0 / sqrt(x)) * x)) * 2.0)); else tmp = Float64(t_1 - Float64(a / Float64(b * 3.0))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$1 * N[Cos[N[(y - N[(N[(z * t), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -5e-117], N[(N[(a / b), $MachinePrecision] * -0.3333333333333333 + N[((-N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]) * 2.0), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - N[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \sqrt{x}\\
\mathbf{if}\;t\_1 \cdot \cos \left(y - \frac{z \cdot t}{3}\right) \leq -5 \cdot 10^{-117}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{b}, -0.3333333333333333, \left(-\frac{1}{\sqrt{x}} \cdot x\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 - \frac{a}{b \cdot 3}\\
\end{array}
\end{array}
if (*.f64 (*.f64 #s(literal 2 binary64) (sqrt.f64 x)) (cos.f64 (-.f64 y (/.f64 (*.f64 z t) #s(literal 3 binary64))))) < -5e-117Initial program 70.9%
Taylor expanded in z around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lift-sqrt.f64N/A
fp-cancel-sub-sign-invN/A
Applied rewrites66.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f6466.1
Applied rewrites66.1%
Taylor expanded in x around -inf
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-sqrt.f64N/A
lift-/.f6453.2
Applied rewrites53.2%
if -5e-117 < (*.f64 (*.f64 #s(literal 2 binary64) (sqrt.f64 x)) (cos.f64 (-.f64 y (/.f64 (*.f64 z t) #s(literal 3 binary64))))) Initial program 70.9%
Taylor expanded in z around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sqrt.f6477.5
Applied rewrites77.5%
Taylor expanded in y around 0
Applied rewrites66.2%
(FPCore (x y z t a b) :precision binary64 (- (* 2.0 (sqrt x)) (/ a (* b 3.0))))
double code(double x, double y, double z, double t, double a, double b) {
return (2.0 * sqrt(x)) - (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)) - (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)) - (a / (b * 3.0));
}
def code(x, y, z, t, a, b): return (2.0 * math.sqrt(x)) - (a / (b * 3.0))
function code(x, y, z, t, a, b) return Float64(Float64(2.0 * sqrt(x)) - Float64(a / Float64(b * 3.0))) end
function tmp = code(x, y, z, t, a, b) tmp = (2.0 * sqrt(x)) - (a / (b * 3.0)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \sqrt{x} - \frac{a}{b \cdot 3}
\end{array}
Initial program 70.9%
Taylor expanded in z around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sqrt.f6477.5
Applied rewrites77.5%
Taylor expanded in y around 0
Applied rewrites66.2%
(FPCore (x y z t a b) :precision binary64 (fma 2.0 (sqrt x) (* (/ a b) -0.3333333333333333)))
double code(double x, double y, double z, double t, double a, double b) {
return fma(2.0, sqrt(x), ((a / b) * -0.3333333333333333));
}
function code(x, y, z, t, a, b) return fma(2.0, sqrt(x), Float64(Float64(a / b) * -0.3333333333333333)) end
code[x_, y_, z_, t_, a_, b_] := N[(2.0 * N[Sqrt[x], $MachinePrecision] + N[(N[(a / b), $MachinePrecision] * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(2, \sqrt{x}, \frac{a}{b} \cdot -0.3333333333333333\right)
\end{array}
Initial program 70.9%
Taylor expanded in z around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lift-sqrt.f6477.5
Applied rewrites77.5%
Taylor expanded in z around 0
sin-+PI/2-revN/A
associate-/l*N/A
associate-*l*N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f6477.4
Applied rewrites77.4%
Taylor expanded in y around 0
Applied rewrites66.1%
(FPCore (x y z t a b) :precision binary64 (fma (/ a b) -0.3333333333333333 (* (sqrt x) 2.0)))
double code(double x, double y, double z, double t, double a, double b) {
return fma((a / b), -0.3333333333333333, (sqrt(x) * 2.0));
}
function code(x, y, z, t, a, b) return fma(Float64(a / b), -0.3333333333333333, Float64(sqrt(x) * 2.0)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a / b), $MachinePrecision] * -0.3333333333333333 + N[(N[Sqrt[x], $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{a}{b}, -0.3333333333333333, \sqrt{x} \cdot 2\right)
\end{array}
Initial program 70.9%
Taylor expanded in z around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lift-sqrt.f64N/A
fp-cancel-sub-sign-invN/A
Applied rewrites66.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f6466.1
Applied rewrites66.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ a (* b 3.0))) (t_2 (/ (* -0.3333333333333333 a) b)))
(if (<= t_1 -2e-76)
t_2
(if (<= t_1 5e-53) (* (* (/ 1.0 (sqrt x)) x) 2.0) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a / (b * 3.0);
double t_2 = (-0.3333333333333333 * a) / b;
double tmp;
if (t_1 <= -2e-76) {
tmp = t_2;
} else if (t_1 <= 5e-53) {
tmp = ((1.0 / sqrt(x)) * x) * 2.0;
} else {
tmp = t_2;
}
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 = a / (b * 3.0d0)
t_2 = ((-0.3333333333333333d0) * a) / b
if (t_1 <= (-2d-76)) then
tmp = t_2
else if (t_1 <= 5d-53) then
tmp = ((1.0d0 / sqrt(x)) * x) * 2.0d0
else
tmp = t_2
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 = a / (b * 3.0);
double t_2 = (-0.3333333333333333 * a) / b;
double tmp;
if (t_1 <= -2e-76) {
tmp = t_2;
} else if (t_1 <= 5e-53) {
tmp = ((1.0 / Math.sqrt(x)) * x) * 2.0;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a / (b * 3.0) t_2 = (-0.3333333333333333 * a) / b tmp = 0 if t_1 <= -2e-76: tmp = t_2 elif t_1 <= 5e-53: tmp = ((1.0 / math.sqrt(x)) * x) * 2.0 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a / Float64(b * 3.0)) t_2 = Float64(Float64(-0.3333333333333333 * a) / b) tmp = 0.0 if (t_1 <= -2e-76) tmp = t_2; elseif (t_1 <= 5e-53) tmp = Float64(Float64(Float64(1.0 / sqrt(x)) * x) * 2.0); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a / (b * 3.0); t_2 = (-0.3333333333333333 * a) / b; tmp = 0.0; if (t_1 <= -2e-76) tmp = t_2; elseif (t_1 <= 5e-53) tmp = ((1.0 / sqrt(x)) * x) * 2.0; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a / N[(b * 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-0.3333333333333333 * a), $MachinePrecision] / b), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-76], t$95$2, If[LessEqual[t$95$1, 5e-53], N[(N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * 2.0), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{b \cdot 3}\\
t_2 := \frac{-0.3333333333333333 \cdot a}{b}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-76}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-53}:\\
\;\;\;\;\left(\frac{1}{\sqrt{x}} \cdot x\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 a (*.f64 b #s(literal 3 binary64))) < -1.99999999999999985e-76 or 5e-53 < (/.f64 a (*.f64 b #s(literal 3 binary64))) Initial program 70.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6450.8
Applied rewrites50.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
if -1.99999999999999985e-76 < (/.f64 a (*.f64 b #s(literal 3 binary64))) < 5e-53Initial program 70.9%
Taylor expanded in z around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
lift-sqrt.f64N/A
fp-cancel-sub-sign-invN/A
Applied rewrites66.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f6466.1
Applied rewrites66.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
sqrt-divN/A
metadata-evalN/A
lift-sqrt.f64N/A
lift-/.f6418.1
Applied rewrites18.1%
(FPCore (x y z t a b) :precision binary64 (/ (* -0.3333333333333333 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(Float64(-0.3333333333333333 * 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[(N[(-0.3333333333333333 * a), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}
\\
\frac{-0.3333333333333333 \cdot a}{b}
\end{array}
Initial program 70.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6450.8
Applied rewrites50.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6450.8
Applied rewrites50.8%
(FPCore (x y z t a b) :precision binary64 (* -0.3333333333333333 (/ 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[(-0.3333333333333333 * N[(a / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.3333333333333333 \cdot \frac{a}{b}
\end{array}
Initial program 70.9%
Taylor expanded in a around inf
lower-*.f64N/A
lower-/.f6450.8
Applied rewrites50.8%
herbie shell --seed 2025142
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, K"
:precision binary64
(- (* (* 2.0 (sqrt x)) (cos (- y (/ (* z t) 3.0)))) (/ a (* b 3.0))))