
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (pow (exp 0.5) (* t t))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * pow(exp(0.5), (t * t));
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * (exp(0.5d0) ** (t * t))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.pow(Math.exp(0.5), (t * t));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.pow(math.exp(0.5), (t * t))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * (exp(0.5) ^ Float64(t * t))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (exp(0.5) ^ (t * t)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Power[N[Exp[0.5], $MachinePrecision], N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot {\left(e^{0.5}\right)}^{\left(t \cdot t\right)}
\end{array}
Initial program 99.4%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
pow2N/A
lift-*.f6499.4
Applied rewrites99.4%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Initial program 99.4%
(FPCore (x y z t) :precision binary64 (if (<= t 0.00195) (* (- (* x 0.5) y) (* (sqrt (+ z z)) (fma (* t t) 0.5 1.0))) (* (* (- 0.5 (/ y x)) x) (sqrt (* (exp (* t t)) (+ z z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 0.00195) {
tmp = ((x * 0.5) - y) * (sqrt((z + z)) * fma((t * t), 0.5, 1.0));
} else {
tmp = ((0.5 - (y / x)) * x) * sqrt((exp((t * t)) * (z + z)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 0.00195) tmp = Float64(Float64(Float64(x * 0.5) - y) * Float64(sqrt(Float64(z + z)) * fma(Float64(t * t), 0.5, 1.0))); else tmp = Float64(Float64(Float64(0.5 - Float64(y / x)) * x) * sqrt(Float64(exp(Float64(t * t)) * Float64(z + z)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 0.00195], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 - N[(y / x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[Sqrt[N[(N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision] * N[(z + z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.00195:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z + z} \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(0.5 - \frac{y}{x}\right) \cdot x\right) \cdot \sqrt{e^{t \cdot t} \cdot \left(z + z\right)}\\
\end{array}
\end{array}
if t < 0.0019499999999999999Initial program 99.5%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
pow2N/A
lift-*.f6499.5
Applied rewrites99.5%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6490.5
Applied rewrites90.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6490.9
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6490.9
Applied rewrites90.9%
if 0.0019499999999999999 < t Initial program 99.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f6499.0
Applied rewrites99.0%
lift-*.f64N/A
lift-*.f64N/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
pow2N/A
exp-sqrt-revN/A
pow2N/A
sqrt-prodN/A
Applied rewrites99.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y))
(t_2 (sqrt (* (+ z z) (exp (* t t)))))
(t_3 (sqrt (+ z z))))
(if (<= t 0.03)
(* t_1 (* t_3 (fma (* t t) 0.5 1.0)))
(if (<= t 1e+57)
(* (* t_2 0.5) x)
(if (<= t 1.82e+132) (* (- t_2) y) (* t_1 (* t_3 (* (* t t) 0.5))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double t_2 = sqrt(((z + z) * exp((t * t))));
double t_3 = sqrt((z + z));
double tmp;
if (t <= 0.03) {
tmp = t_1 * (t_3 * fma((t * t), 0.5, 1.0));
} else if (t <= 1e+57) {
tmp = (t_2 * 0.5) * x;
} else if (t <= 1.82e+132) {
tmp = -t_2 * y;
} else {
tmp = t_1 * (t_3 * ((t * t) * 0.5));
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) t_2 = sqrt(Float64(Float64(z + z) * exp(Float64(t * t)))) t_3 = sqrt(Float64(z + z)) tmp = 0.0 if (t <= 0.03) tmp = Float64(t_1 * Float64(t_3 * fma(Float64(t * t), 0.5, 1.0))); elseif (t <= 1e+57) tmp = Float64(Float64(t_2 * 0.5) * x); elseif (t <= 1.82e+132) tmp = Float64(Float64(-t_2) * y); else tmp = Float64(t_1 * Float64(t_3 * Float64(Float64(t * t) * 0.5))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 0.03], N[(t$95$1 * N[(t$95$3 * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e+57], N[(N[(t$95$2 * 0.5), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 1.82e+132], N[((-t$95$2) * y), $MachinePrecision], N[(t$95$1 * N[(t$95$3 * N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
t_2 := \sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\\
t_3 := \sqrt{z + z}\\
\mathbf{if}\;t \leq 0.03:\\
\;\;\;\;t\_1 \cdot \left(t\_3 \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\right)\\
\mathbf{elif}\;t \leq 10^{+57}:\\
\;\;\;\;\left(t\_2 \cdot 0.5\right) \cdot x\\
\mathbf{elif}\;t \leq 1.82 \cdot 10^{+132}:\\
\;\;\;\;\left(-t\_2\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_3 \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if t < 0.029999999999999999Initial program 99.5%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
pow2N/A
lift-*.f6499.5
Applied rewrites99.5%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6490.5
Applied rewrites90.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6490.9
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6490.9
Applied rewrites90.9%
if 0.029999999999999999 < t < 1.00000000000000005e57Initial program 99.6%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites73.1%
if 1.00000000000000005e57 < t < 1.82e132Initial program 99.1%
Taylor expanded in x around 0
mul-1-negN/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites72.9%
if 1.82e132 < t Initial program 98.9%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
pow2N/A
lift-*.f6498.9
Applied rewrites98.9%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6496.1
Applied rewrites96.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6497.5
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6497.5
Applied rewrites97.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6497.5
Applied rewrites97.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 1.75)
(* (* t_1 (sqrt (* z 2.0))) (fma (* t t) 0.5 1.0))
(if (<= t 1.82e+132)
(* (- (sqrt (* (+ z z) (exp (* t t))))) y)
(* t_1 (* (sqrt (+ z z)) (* (* t t) 0.5)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 1.75) {
tmp = (t_1 * sqrt((z * 2.0))) * fma((t * t), 0.5, 1.0);
} else if (t <= 1.82e+132) {
tmp = -sqrt(((z + z) * exp((t * t)))) * y;
} else {
tmp = t_1 * (sqrt((z + z)) * ((t * t) * 0.5));
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 1.75) tmp = Float64(Float64(t_1 * sqrt(Float64(z * 2.0))) * fma(Float64(t * t), 0.5, 1.0)); elseif (t <= 1.82e+132) tmp = Float64(Float64(-sqrt(Float64(Float64(z + z) * exp(Float64(t * t))))) * y); else tmp = Float64(t_1 * Float64(sqrt(Float64(z + z)) * Float64(Float64(t * t) * 0.5))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t, 1.75], N[(N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.82e+132], N[((-N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) * y), $MachinePrecision], N[(t$95$1 * N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 1.75:\\
\;\;\;\;\left(t\_1 \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\\
\mathbf{elif}\;t \leq 1.82 \cdot 10^{+132}:\\
\;\;\;\;\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\sqrt{z + z} \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if t < 1.75Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6490.3
Applied rewrites90.3%
if 1.75 < t < 1.82e132Initial program 99.3%
Taylor expanded in x around 0
mul-1-negN/A
associate-*l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites73.6%
if 1.82e132 < t Initial program 98.9%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
pow2N/A
lift-*.f6498.9
Applied rewrites98.9%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6496.1
Applied rewrites96.1%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6497.5
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6497.5
Applied rewrites97.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6497.5
Applied rewrites97.5%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (* (sqrt (+ z z)) (fma (* t t) 0.5 1.0))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * (sqrt((z + z)) * fma((t * t), 0.5, 1.0));
}
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * Float64(sqrt(Float64(z + z)) * fma(Float64(t * t), 0.5, 1.0))) end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z + z} \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\right)
\end{array}
Initial program 99.4%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
pow2N/A
lift-*.f6499.4
Applied rewrites99.4%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6486.4
Applied rewrites86.4%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6487.0
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6487.0
Applied rewrites87.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z z))))
(if (<= t 1.45)
(* t_1 (- (* 0.5 x) y))
(* (- (* x 0.5) y) (* t_1 (* (* t t) 0.5))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double tmp;
if (t <= 1.45) {
tmp = t_1 * ((0.5 * x) - y);
} else {
tmp = ((x * 0.5) - y) * (t_1 * ((t * t) * 0.5));
}
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)
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) :: t_1
real(8) :: tmp
t_1 = sqrt((z + z))
if (t <= 1.45d0) then
tmp = t_1 * ((0.5d0 * x) - y)
else
tmp = ((x * 0.5d0) - y) * (t_1 * ((t * t) * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + z));
double tmp;
if (t <= 1.45) {
tmp = t_1 * ((0.5 * x) - y);
} else {
tmp = ((x * 0.5) - y) * (t_1 * ((t * t) * 0.5));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z + z)) tmp = 0 if t <= 1.45: tmp = t_1 * ((0.5 * x) - y) else: tmp = ((x * 0.5) - y) * (t_1 * ((t * t) * 0.5)) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) tmp = 0.0 if (t <= 1.45) tmp = Float64(t_1 * Float64(Float64(0.5 * x) - y)); else tmp = Float64(Float64(Float64(x * 0.5) - y) * Float64(t_1 * Float64(Float64(t * t) * 0.5))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z + z)); tmp = 0.0; if (t <= 1.45) tmp = t_1 * ((0.5 * x) - y); else tmp = ((x * 0.5) - y) * (t_1 * ((t * t) * 0.5)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.45], N[(t$95$1 * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[(t$95$1 * N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
\mathbf{if}\;t \leq 1.45:\\
\;\;\;\;t\_1 \cdot \left(0.5 \cdot x - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \left(t\_1 \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if t < 1.44999999999999996Initial program 99.5%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6471.1
Applied rewrites71.1%
if 1.44999999999999996 < t Initial program 99.1%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
pow2N/A
lift-*.f6499.1
Applied rewrites99.1%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6473.9
Applied rewrites73.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6475.3
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6475.3
Applied rewrites75.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6475.3
Applied rewrites75.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z z))))
(if (<= t 1.75e+56)
(* t_1 (- (* 0.5 x) y))
(if (<= t 1e+165)
(* (- y) (* t_1 (fma (* t t) 0.5 1.0)))
(* (* (sqrt (* (+ z z) (* t t))) 0.5) x)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double tmp;
if (t <= 1.75e+56) {
tmp = t_1 * ((0.5 * x) - y);
} else if (t <= 1e+165) {
tmp = -y * (t_1 * fma((t * t), 0.5, 1.0));
} else {
tmp = (sqrt(((z + z) * (t * t))) * 0.5) * x;
}
return tmp;
}
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) tmp = 0.0 if (t <= 1.75e+56) tmp = Float64(t_1 * Float64(Float64(0.5 * x) - y)); elseif (t <= 1e+165) tmp = Float64(Float64(-y) * Float64(t_1 * fma(Float64(t * t), 0.5, 1.0))); else tmp = Float64(Float64(sqrt(Float64(Float64(z + z) * Float64(t * t))) * 0.5) * x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.75e+56], N[(t$95$1 * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e+165], N[((-y) * N[(t$95$1 * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[(t * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
\mathbf{if}\;t \leq 1.75 \cdot 10^{+56}:\\
\;\;\;\;t\_1 \cdot \left(0.5 \cdot x - y\right)\\
\mathbf{elif}\;t \leq 10^{+165}:\\
\;\;\;\;\left(-y\right) \cdot \left(t\_1 \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\left(z + z\right) \cdot \left(t \cdot t\right)} \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if t < 1.75e56Initial program 99.5%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6468.1
Applied rewrites68.1%
if 1.75e56 < t < 9.99999999999999899e164Initial program 99.4%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
pow2N/A
lift-*.f6499.4
Applied rewrites99.4%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6464.4
Applied rewrites64.4%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f6466.7
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6466.7
Applied rewrites66.7%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6443.1
Applied rewrites43.1%
if 9.99999999999999899e164 < t Initial program 98.7%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites74.2%
Taylor expanded in t around 0
+-commutativeN/A
pow2N/A
lower-fma.f6474.2
Applied rewrites74.2%
Taylor expanded in t around inf
pow2N/A
lift-*.f6474.2
Applied rewrites74.2%
(FPCore (x y z t) :precision binary64 (if (<= t 0.03) (* (sqrt (+ z z)) (- (* 0.5 x) y)) (* (* (sqrt (* (+ z z) (fma t t 1.0))) 0.5) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 0.03) {
tmp = sqrt((z + z)) * ((0.5 * x) - y);
} else {
tmp = (sqrt(((z + z) * fma(t, t, 1.0))) * 0.5) * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 0.03) tmp = Float64(sqrt(Float64(z + z)) * Float64(Float64(0.5 * x) - y)); else tmp = Float64(Float64(sqrt(Float64(Float64(z + z) * fma(t, t, 1.0))) * 0.5) * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 0.03], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.03:\\
\;\;\;\;\sqrt{z + z} \cdot \left(0.5 \cdot x - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\left(z + z\right) \cdot \mathsf{fma}\left(t, t, 1\right)} \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if t < 0.029999999999999999Initial program 99.5%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6471.2
Applied rewrites71.2%
if 0.029999999999999999 < t Initial program 99.1%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites74.0%
Taylor expanded in t around 0
+-commutativeN/A
pow2N/A
lower-fma.f6451.7
Applied rewrites51.7%
(FPCore (x y z t) :precision binary64 (if (<= t 2.4e+52) (* (sqrt (+ z z)) (- (* 0.5 x) y)) (* (* (sqrt (* (+ z z) (* t t))) 0.5) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.4e+52) {
tmp = sqrt((z + z)) * ((0.5 * x) - y);
} else {
tmp = (sqrt(((z + z) * (t * t))) * 0.5) * x;
}
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)
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) :: tmp
if (t <= 2.4d+52) then
tmp = sqrt((z + z)) * ((0.5d0 * x) - y)
else
tmp = (sqrt(((z + z) * (t * t))) * 0.5d0) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.4e+52) {
tmp = Math.sqrt((z + z)) * ((0.5 * x) - y);
} else {
tmp = (Math.sqrt(((z + z) * (t * t))) * 0.5) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 2.4e+52: tmp = math.sqrt((z + z)) * ((0.5 * x) - y) else: tmp = (math.sqrt(((z + z) * (t * t))) * 0.5) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 2.4e+52) tmp = Float64(sqrt(Float64(z + z)) * Float64(Float64(0.5 * x) - y)); else tmp = Float64(Float64(sqrt(Float64(Float64(z + z) * Float64(t * t))) * 0.5) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 2.4e+52) tmp = sqrt((z + z)) * ((0.5 * x) - y); else tmp = (sqrt(((z + z) * (t * t))) * 0.5) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 2.4e+52], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[(t * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.4 \cdot 10^{+52}:\\
\;\;\;\;\sqrt{z + z} \cdot \left(0.5 \cdot x - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\left(z + z\right) \cdot \left(t \cdot t\right)} \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if t < 2.4e52Initial program 99.5%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6468.2
Applied rewrites68.2%
if 2.4e52 < t Initial program 99.0%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites74.2%
Taylor expanded in t around 0
+-commutativeN/A
pow2N/A
lower-fma.f6459.2
Applied rewrites59.2%
Taylor expanded in t around inf
pow2N/A
lift-*.f6459.2
Applied rewrites59.2%
(FPCore (x y z t) :precision binary64 (* (sqrt (+ z z)) (- (* 0.5 x) y)))
double code(double x, double y, double z, double t) {
return sqrt((z + z)) * ((0.5 * x) - y);
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((z + z)) * ((0.5d0 * x) - y)
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z + z)) * ((0.5 * x) - y);
}
def code(x, y, z, t): return math.sqrt((z + z)) * ((0.5 * x) - y)
function code(x, y, z, t) return Float64(sqrt(Float64(z + z)) * Float64(Float64(0.5 * x) - y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z + z)) * ((0.5 * x) - y); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z + z} \cdot \left(0.5 \cdot x - y\right)
\end{array}
Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6457.6
Applied rewrites57.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (sqrt z) (* (- y) (sqrt 2.0)))))
(if (<= y -5.4e-18)
t_1
(if (<= y 4.8e+115) (* (* x (sqrt (+ z z))) 0.5) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt(z) * (-y * sqrt(2.0));
double tmp;
if (y <= -5.4e-18) {
tmp = t_1;
} else if (y <= 4.8e+115) {
tmp = (x * sqrt((z + z))) * 0.5;
} else {
tmp = t_1;
}
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)
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) :: t_1
real(8) :: tmp
t_1 = sqrt(z) * (-y * sqrt(2.0d0))
if (y <= (-5.4d-18)) then
tmp = t_1
else if (y <= 4.8d+115) then
tmp = (x * sqrt((z + z))) * 0.5d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt(z) * (-y * Math.sqrt(2.0));
double tmp;
if (y <= -5.4e-18) {
tmp = t_1;
} else if (y <= 4.8e+115) {
tmp = (x * Math.sqrt((z + z))) * 0.5;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt(z) * (-y * math.sqrt(2.0)) tmp = 0 if y <= -5.4e-18: tmp = t_1 elif y <= 4.8e+115: tmp = (x * math.sqrt((z + z))) * 0.5 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(sqrt(z) * Float64(Float64(-y) * sqrt(2.0))) tmp = 0.0 if (y <= -5.4e-18) tmp = t_1; elseif (y <= 4.8e+115) tmp = Float64(Float64(x * sqrt(Float64(z + z))) * 0.5); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt(z) * (-y * sqrt(2.0)); tmp = 0.0; if (y <= -5.4e-18) tmp = t_1; elseif (y <= 4.8e+115) tmp = (x * sqrt((z + z))) * 0.5; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[z], $MachinePrecision] * N[((-y) * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.4e-18], t$95$1, If[LessEqual[y, 4.8e+115], N[(N[(x * N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z} \cdot \left(\left(-y\right) \cdot \sqrt{2}\right)\\
\mathbf{if}\;y \leq -5.4 \cdot 10^{-18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+115}:\\
\;\;\;\;\left(x \cdot \sqrt{z + z}\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.39999999999999977e-18 or 4.8000000000000001e115 < y Initial program 99.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in x around 0
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lift-sqrt.f6483.6
Applied rewrites83.6%
Taylor expanded in t around 0
lift-sqrt.f6448.6
Applied rewrites48.6%
if -5.39999999999999977e-18 < y < 4.8000000000000001e115Initial program 99.1%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites77.3%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
sqrt-prodN/A
*-commutativeN/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6440.2
Applied rewrites40.2%
(FPCore (x y z t) :precision binary64 (* (* x (sqrt (+ z z))) 0.5))
double code(double x, double y, double z, double t) {
return (x * sqrt((z + z))) * 0.5;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * sqrt((z + z))) * 0.5d0
end function
public static double code(double x, double y, double z, double t) {
return (x * Math.sqrt((z + z))) * 0.5;
}
def code(x, y, z, t): return (x * math.sqrt((z + z))) * 0.5
function code(x, y, z, t) return Float64(Float64(x * sqrt(Float64(z + z))) * 0.5) end
function tmp = code(x, y, z, t) tmp = (x * sqrt((z + z))) * 0.5; end
code[x_, y_, z_, t_] := N[(N[(x * N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \sqrt{z + z}\right) \cdot 0.5
\end{array}
Initial program 99.4%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites62.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
sqrt-prodN/A
*-commutativeN/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6429.9
Applied rewrites29.9%
(FPCore (x y z t) :precision binary64 (* -0.5 (* (sqrt (+ z z)) x)))
double code(double x, double y, double z, double t) {
return -0.5 * (sqrt((z + z)) * x);
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (-0.5d0) * (sqrt((z + z)) * x)
end function
public static double code(double x, double y, double z, double t) {
return -0.5 * (Math.sqrt((z + z)) * x);
}
def code(x, y, z, t): return -0.5 * (math.sqrt((z + z)) * x)
function code(x, y, z, t) return Float64(-0.5 * Float64(sqrt(Float64(z + z)) * x)) end
function tmp = code(x, y, z, t) tmp = -0.5 * (sqrt((z + z)) * x); end
code[x_, y_, z_, t_] := N[(-0.5 * N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.5 \cdot \left(\sqrt{z + z} \cdot x\right)
\end{array}
Initial program 99.4%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites62.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
sqrt-prodN/A
*-commutativeN/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6429.9
Applied rewrites29.9%
Taylor expanded in z around -inf
sqrt-unprodN/A
metadata-evalN/A
lower-*.f64N/A
associate-*l*N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
count-2-revN/A
*-commutativeN/A
lift-sqrt.f64N/A
count-2-revN/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f642.6
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f642.6
Applied rewrites2.6%
herbie shell --seed 2025112
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))