
(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 12 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 (* (* (* (sqrt z) (sqrt (exp (* t t)))) (- (* 0.5 x) y)) (sqrt 2.0)))
double code(double x, double y, double z, double t) {
return ((sqrt(z) * sqrt(exp((t * t)))) * ((0.5 * x) - y)) * sqrt(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 = ((sqrt(z) * sqrt(exp((t * t)))) * ((0.5d0 * x) - y)) * sqrt(2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return ((Math.sqrt(z) * Math.sqrt(Math.exp((t * t)))) * ((0.5 * x) - y)) * Math.sqrt(2.0);
}
def code(x, y, z, t): return ((math.sqrt(z) * math.sqrt(math.exp((t * t)))) * ((0.5 * x) - y)) * math.sqrt(2.0)
function code(x, y, z, t) return Float64(Float64(Float64(sqrt(z) * sqrt(exp(Float64(t * t)))) * Float64(Float64(0.5 * x) - y)) * sqrt(2.0)) end
function tmp = code(x, y, z, t) tmp = ((sqrt(z) * sqrt(exp((t * t)))) * ((0.5 * x) - y)) * sqrt(2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(N[Sqrt[z], $MachinePrecision] * N[Sqrt[N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\sqrt{z} \cdot \sqrt{e^{t \cdot t}}\right) \cdot \left(0.5 \cdot x - y\right)\right) \cdot \sqrt{2}
\end{array}
Initial program 99.5%
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%
(FPCore (x y z t) :precision binary64 (* (* (* (sqrt 2.0) (- (* 0.5 x) y)) (sqrt (exp (* t t)))) (sqrt z)))
double code(double x, double y, double z, double t) {
return ((sqrt(2.0) * ((0.5 * x) - y)) * sqrt(exp((t * t)))) * sqrt(z);
}
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(2.0d0) * ((0.5d0 * x) - y)) * sqrt(exp((t * t)))) * sqrt(z)
end function
public static double code(double x, double y, double z, double t) {
return ((Math.sqrt(2.0) * ((0.5 * x) - y)) * Math.sqrt(Math.exp((t * t)))) * Math.sqrt(z);
}
def code(x, y, z, t): return ((math.sqrt(2.0) * ((0.5 * x) - y)) * math.sqrt(math.exp((t * t)))) * math.sqrt(z)
function code(x, y, z, t) return Float64(Float64(Float64(sqrt(2.0) * Float64(Float64(0.5 * x) - y)) * sqrt(exp(Float64(t * t)))) * sqrt(z)) end
function tmp = code(x, y, z, t) tmp = ((sqrt(2.0) * ((0.5 * x) - y)) * sqrt(exp((t * t)))) * sqrt(z); end
code[x_, y_, z_, t_] := N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\sqrt{2} \cdot \left(0.5 \cdot x - y\right)\right) \cdot \sqrt{e^{t \cdot t}}\right) \cdot \sqrt{z}
\end{array}
Initial program 99.5%
Applied rewrites99.6%
(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.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (fma (* t t) 0.5 1.0)))
(t_2 (sqrt (* (+ z z) (exp (* t t))))))
(if (<= t 50.0)
t_1
(if (<= t 7.2e+104)
(* (* t_2 0.5) x)
(if (<= t 2.2e+140) (* (- t_2) y) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (((x * 0.5) - y) * sqrt((z * 2.0))) * fma((t * t), 0.5, 1.0);
double t_2 = sqrt(((z + z) * exp((t * t))));
double tmp;
if (t <= 50.0) {
tmp = t_1;
} else if (t <= 7.2e+104) {
tmp = (t_2 * 0.5) * x;
} else if (t <= 2.2e+140) {
tmp = -t_2 * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * fma(Float64(t * t), 0.5, 1.0)) t_2 = sqrt(Float64(Float64(z + z) * exp(Float64(t * t)))) tmp = 0.0 if (t <= 50.0) tmp = t_1; elseif (t <= 7.2e+104) tmp = Float64(Float64(t_2 * 0.5) * x); elseif (t <= 2.2e+140) tmp = Float64(Float64(-t_2) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 50.0], t$95$1, If[LessEqual[t, 7.2e+104], N[(N[(t$95$2 * 0.5), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 2.2e+140], N[((-t$95$2) * y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\\
t_2 := \sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\\
\mathbf{if}\;t \leq 50:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{+104}:\\
\;\;\;\;\left(t\_2 \cdot 0.5\right) \cdot x\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{+140}:\\
\;\;\;\;\left(-t\_2\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < 50 or 2.1999999999999998e140 < t Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6491.3
Applied rewrites91.3%
if 50 < t < 7.20000000000000001e104Initial program 99.2%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites75.8%
if 7.20000000000000001e104 < t < 2.1999999999999998e140Initial 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 rewrites77.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (fma (* t t) 0.5 1.0))))
(if (<= t 0.118)
t_1
(if (<= t 2.2e+140) (* (- (sqrt (* (+ z z) (exp (* t t))))) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (((x * 0.5) - y) * sqrt((z * 2.0))) * fma((t * t), 0.5, 1.0);
double tmp;
if (t <= 0.118) {
tmp = t_1;
} else if (t <= 2.2e+140) {
tmp = -sqrt(((z + z) * exp((t * t)))) * y;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * fma(Float64(t * t), 0.5, 1.0)) tmp = 0.0 if (t <= 0.118) tmp = t_1; elseif (t <= 2.2e+140) tmp = Float64(Float64(-sqrt(Float64(Float64(z + z) * exp(Float64(t * t))))) * y); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 0.118], t$95$1, If[LessEqual[t, 2.2e+140], N[((-N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\\
\mathbf{if}\;t \leq 0.118:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{+140}:\\
\;\;\;\;\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < 0.11799999999999999 or 2.1999999999999998e140 < t Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6491.5
Applied rewrites91.5%
if 0.11799999999999999 < t < 2.1999999999999998e140Initial program 99.2%
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 rewrites74.8%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (fma (* t t) 0.5 1.0)))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * fma((t * t), 0.5, 1.0);
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * fma(Float64(t * t), 0.5, 1.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[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)
\end{array}
Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6485.8
Applied rewrites85.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z z))))
(if (<= t 5600.0)
(* t_1 (- (* 0.5 x) y))
(if (<= t 7e+104)
(* (sqrt (* (+ z z) (exp (* t t)))) y)
(* (* (* t_1 (* t t)) -0.5) y)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double tmp;
if (t <= 5600.0) {
tmp = t_1 * ((0.5 * x) - y);
} else if (t <= 7e+104) {
tmp = sqrt(((z + z) * exp((t * t)))) * y;
} else {
tmp = ((t_1 * (t * t)) * -0.5) * y;
}
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 <= 5600.0d0) then
tmp = t_1 * ((0.5d0 * x) - y)
else if (t <= 7d+104) then
tmp = sqrt(((z + z) * exp((t * t)))) * y
else
tmp = ((t_1 * (t * t)) * (-0.5d0)) * y
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 <= 5600.0) {
tmp = t_1 * ((0.5 * x) - y);
} else if (t <= 7e+104) {
tmp = Math.sqrt(((z + z) * Math.exp((t * t)))) * y;
} else {
tmp = ((t_1 * (t * t)) * -0.5) * y;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z + z)) tmp = 0 if t <= 5600.0: tmp = t_1 * ((0.5 * x) - y) elif t <= 7e+104: tmp = math.sqrt(((z + z) * math.exp((t * t)))) * y else: tmp = ((t_1 * (t * t)) * -0.5) * y return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) tmp = 0.0 if (t <= 5600.0) tmp = Float64(t_1 * Float64(Float64(0.5 * x) - y)); elseif (t <= 7e+104) tmp = Float64(sqrt(Float64(Float64(z + z) * exp(Float64(t * t)))) * y); else tmp = Float64(Float64(Float64(t_1 * Float64(t * t)) * -0.5) * y); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z + z)); tmp = 0.0; if (t <= 5600.0) tmp = t_1 * ((0.5 * x) - y); elseif (t <= 7e+104) tmp = sqrt(((z + z) * exp((t * t)))) * y; else tmp = ((t_1 * (t * t)) * -0.5) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 5600.0], N[(t$95$1 * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7e+104], N[(N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(t$95$1 * N[(t * t), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
\mathbf{if}\;t \leq 5600:\\
\;\;\;\;t\_1 \cdot \left(0.5 \cdot x - y\right)\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+104}:\\
\;\;\;\;\sqrt{\left(z + z\right) \cdot e^{t \cdot t}} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t\_1 \cdot \left(t \cdot t\right)\right) \cdot -0.5\right) \cdot y\\
\end{array}
\end{array}
if t < 5600Initial 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
*-commutativeN/A
lower--.f64N/A
lower-*.f6470.9
Applied rewrites70.9%
if 5600 < t < 7.0000000000000003e104Initial program 99.2%
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 rewrites74.0%
Taylor expanded in z around -inf
sqrt-unprodN/A
metadata-evalN/A
sqrt-unprodN/A
*-commutativeN/A
associate-*r*N/A
count-2-revN/A
lift-+.f64N/A
lower-exp.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f6426.0
Applied rewrites26.0%
if 7.0000000000000003e104 < t Initial program 99.4%
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 rewrites74.3%
Taylor expanded in t around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
sqrt-prodN/A
*-commutativeN/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f64N/A
sqrt-prodN/A
*-commutativeN/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6468.2
Applied rewrites68.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.2%
(FPCore (x y z t) :precision binary64 (if (<= t 0.16) (* (sqrt (+ z z)) (- (* 0.5 x) y)) (* (- (sqrt (* (+ z z) (fma t t 1.0)))) y)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 0.16) {
tmp = sqrt((z + z)) * ((0.5 * x) - y);
} else {
tmp = -sqrt(((z + z) * fma(t, t, 1.0))) * y;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 0.16) 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)))) * y); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 0.16], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.16:\\
\;\;\;\;\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)}\right) \cdot y\\
\end{array}
\end{array}
if t < 0.160000000000000003Initial 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
*-commutativeN/A
lower--.f64N/A
lower-*.f6471.2
Applied rewrites71.2%
if 0.160000000000000003 < t Initial program 99.4%
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 rewrites74.2%
Taylor expanded in t around 0
+-commutativeN/A
pow2N/A
lower-fma.f6450.6
Applied rewrites50.6%
(FPCore (x y z t) :precision binary64 (if (<= t 2.3e+19) (* (sqrt (+ z z)) (- (* 0.5 x) y)) (* (- (sqrt (* (+ z z) (* t t)))) y)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.3e+19) {
tmp = sqrt((z + z)) * ((0.5 * x) - y);
} else {
tmp = -sqrt(((z + z) * (t * t))) * y;
}
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.3d+19) then
tmp = sqrt((z + z)) * ((0.5d0 * x) - y)
else
tmp = -sqrt(((z + z) * (t * t))) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.3e+19) {
tmp = Math.sqrt((z + z)) * ((0.5 * x) - y);
} else {
tmp = -Math.sqrt(((z + z) * (t * t))) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 2.3e+19: tmp = math.sqrt((z + z)) * ((0.5 * x) - y) else: tmp = -math.sqrt(((z + z) * (t * t))) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 2.3e+19) tmp = Float64(sqrt(Float64(z + z)) * Float64(Float64(0.5 * x) - y)); else tmp = Float64(Float64(-sqrt(Float64(Float64(z + z) * Float64(t * t)))) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 2.3e+19) tmp = sqrt((z + z)) * ((0.5 * x) - y); else tmp = -sqrt(((z + z) * (t * t))) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 2.3e+19], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[(t * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.3 \cdot 10^{+19}:\\
\;\;\;\;\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)}\right) \cdot y\\
\end{array}
\end{array}
if t < 2.3e19Initial 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
*-commutativeN/A
lower--.f64N/A
lower-*.f6470.3
Applied rewrites70.3%
if 2.3e19 < t Initial program 99.4%
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 rewrites74.3%
Taylor expanded in t around 0
+-commutativeN/A
pow2N/A
lower-fma.f6453.0
Applied rewrites53.0%
Taylor expanded in t around inf
pow2N/A
lift-*.f6453.0
Applied rewrites53.0%
(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.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
*-commutativeN/A
lower--.f64N/A
lower-*.f6457.6
Applied rewrites57.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (+ z z))) (t_2 (* t_1 (* x 0.5)))) (if (<= x -5.4e+26) t_2 (if (<= x 4.2e+64) (* t_1 (- y)) t_2))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double t_2 = t_1 * (x * 0.5);
double tmp;
if (x <= -5.4e+26) {
tmp = t_2;
} else if (x <= 4.2e+64) {
tmp = t_1 * -y;
} 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)
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) :: t_2
real(8) :: tmp
t_1 = sqrt((z + z))
t_2 = t_1 * (x * 0.5d0)
if (x <= (-5.4d+26)) then
tmp = t_2
else if (x <= 4.2d+64) then
tmp = t_1 * -y
else
tmp = t_2
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 t_2 = t_1 * (x * 0.5);
double tmp;
if (x <= -5.4e+26) {
tmp = t_2;
} else if (x <= 4.2e+64) {
tmp = t_1 * -y;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z + z)) t_2 = t_1 * (x * 0.5) tmp = 0 if x <= -5.4e+26: tmp = t_2 elif x <= 4.2e+64: tmp = t_1 * -y else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) t_2 = Float64(t_1 * Float64(x * 0.5)) tmp = 0.0 if (x <= -5.4e+26) tmp = t_2; elseif (x <= 4.2e+64) tmp = Float64(t_1 * Float64(-y)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z + z)); t_2 = t_1 * (x * 0.5); tmp = 0.0; if (x <= -5.4e+26) tmp = t_2; elseif (x <= 4.2e+64) tmp = t_1 * -y; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.4e+26], t$95$2, If[LessEqual[x, 4.2e+64], N[(t$95$1 * (-y)), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
t_2 := t\_1 \cdot \left(x \cdot 0.5\right)\\
\mathbf{if}\;x \leq -5.4 \cdot 10^{+26}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+64}:\\
\;\;\;\;t\_1 \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -5.4e26 or 4.2000000000000001e64 < x Initial program 99.8%
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
*-commutativeN/A
lower--.f64N/A
lower-*.f6461.1
Applied rewrites61.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6447.4
Applied rewrites47.4%
if -5.4e26 < x < 4.2000000000000001e64Initial program 99.2%
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
*-commutativeN/A
lower--.f64N/A
lower-*.f6455.1
Applied rewrites55.1%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6441.2
Applied rewrites41.2%
(FPCore (x y z t) :precision binary64 (* (sqrt (+ z z)) (- y)))
double code(double x, double y, double z, double t) {
return sqrt((z + z)) * -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)) * -y
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z + z)) * -y;
}
def code(x, y, z, t): return math.sqrt((z + z)) * -y
function code(x, y, z, t) return Float64(sqrt(Float64(z + z)) * Float64(-y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z + z)) * -y; end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z + z} \cdot \left(-y\right)
\end{array}
Initial 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
*-commutativeN/A
lower--.f64N/A
lower-*.f6457.6
Applied rewrites57.6%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f6430.7
Applied rewrites30.7%
herbie shell --seed 2025120
(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))))