
(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 13 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 (* (* (- (* 0.5 x) y) (sqrt (* 2.0 (exp (* t t))))) (sqrt z)))
double code(double x, double y, double z, double t) {
return (((0.5 * x) - y) * sqrt((2.0 * 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 = (((0.5d0 * x) - y) * sqrt((2.0d0 * exp((t * t))))) * sqrt(z)
end function
public static double code(double x, double y, double z, double t) {
return (((0.5 * x) - y) * Math.sqrt((2.0 * Math.exp((t * t))))) * Math.sqrt(z);
}
def code(x, y, z, t): return (((0.5 * x) - y) * math.sqrt((2.0 * math.exp((t * t))))) * math.sqrt(z)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(2.0 * exp(Float64(t * t))))) * sqrt(z)) end
function tmp = code(x, y, z, t) tmp = (((0.5 * x) - y) * sqrt((2.0 * exp((t * t))))) * sqrt(z); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(0.5 \cdot x - y\right) \cdot \sqrt{2 \cdot e^{t \cdot t}}\right) \cdot \sqrt{z}
\end{array}
Initial program 99.4%
Applied rewrites99.6%
(FPCore (x y z t) :precision binary64 (* (sqrt (* 2.0 (exp (* t t)))) (* (- (* 0.5 x) y) (sqrt z))))
double code(double x, double y, double z, double t) {
return sqrt((2.0 * exp((t * t)))) * (((0.5 * x) - y) * 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 * exp((t * t)))) * (((0.5d0 * x) - y) * sqrt(z))
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((2.0 * Math.exp((t * t)))) * (((0.5 * x) - y) * Math.sqrt(z));
}
def code(x, y, z, t): return math.sqrt((2.0 * math.exp((t * t)))) * (((0.5 * x) - y) * math.sqrt(z))
function code(x, y, z, t) return Float64(sqrt(Float64(2.0 * exp(Float64(t * t)))) * Float64(Float64(Float64(0.5 * x) - y) * sqrt(z))) end
function tmp = code(x, y, z, t) tmp = sqrt((2.0 * exp((t * t)))) * (((0.5 * x) - y) * sqrt(z)); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(2.0 * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot e^{t \cdot t}} \cdot \left(\left(0.5 \cdot x - y\right) \cdot \sqrt{z}\right)
\end{array}
Initial program 99.4%
Applied rewrites99.2%
(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.0062)
t_1
(if (<= t 3.5e+143) (* (* x (sqrt (* (+ z z) (exp (* t t))))) 0.5) 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.0062) {
tmp = t_1;
} else if (t <= 3.5e+143) {
tmp = (x * sqrt(((z + z) * exp((t * t))))) * 0.5;
} 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.0062) tmp = t_1; elseif (t <= 3.5e+143) tmp = Float64(Float64(x * sqrt(Float64(Float64(z + z) * exp(Float64(t * t))))) * 0.5); 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.0062], t$95$1, If[LessEqual[t, 3.5e+143], N[(N[(x * N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $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.0062:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+143}:\\
\;\;\;\;\left(x \cdot \sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < 0.00619999999999999978 or 3.50000000000000008e143 < t Initial program 99.4%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6485.3
Applied rewrites85.3%
if 0.00619999999999999978 < t < 3.50000000000000008e143Initial program 99.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites61.7%
(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.055)
t_1
(if (<= t 3.5e+144) (* (- (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.055) {
tmp = t_1;
} else if (t <= 3.5e+144) {
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.055) tmp = t_1; elseif (t <= 3.5e+144) 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.055], t$95$1, If[LessEqual[t, 3.5e+144], 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.055:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+144}:\\
\;\;\;\;\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.0550000000000000003 or 3.4999999999999998e144 < t Initial program 99.4%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6485.3
Applied rewrites85.3%
if 0.0550000000000000003 < t < 3.4999999999999998e144Initial program 99.4%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.3%
(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.4%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6485.3
Applied rewrites85.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* t t) 2.0)))
(if (<= t_1 3.65e-7)
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) 1.0)
(if (<= t_1 1.55e+144)
(* (sqrt 2.0) (* (* y (- (* 0.5 (/ x y)) 1.0)) (sqrt z)))
(* (sqrt 2.0) (* (* -1.0 (* x (- (/ y x) 0.5))) (sqrt z)))))))
double code(double x, double y, double z, double t) {
double t_1 = (t * t) / 2.0;
double tmp;
if (t_1 <= 3.65e-7) {
tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.0;
} else if (t_1 <= 1.55e+144) {
tmp = sqrt(2.0) * ((y * ((0.5 * (x / y)) - 1.0)) * sqrt(z));
} else {
tmp = sqrt(2.0) * ((-1.0 * (x * ((y / x) - 0.5))) * sqrt(z));
}
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 = (t * t) / 2.0d0
if (t_1 <= 3.65d-7) then
tmp = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * 1.0d0
else if (t_1 <= 1.55d+144) then
tmp = sqrt(2.0d0) * ((y * ((0.5d0 * (x / y)) - 1.0d0)) * sqrt(z))
else
tmp = sqrt(2.0d0) * (((-1.0d0) * (x * ((y / x) - 0.5d0))) * sqrt(z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (t * t) / 2.0;
double tmp;
if (t_1 <= 3.65e-7) {
tmp = (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * 1.0;
} else if (t_1 <= 1.55e+144) {
tmp = Math.sqrt(2.0) * ((y * ((0.5 * (x / y)) - 1.0)) * Math.sqrt(z));
} else {
tmp = Math.sqrt(2.0) * ((-1.0 * (x * ((y / x) - 0.5))) * Math.sqrt(z));
}
return tmp;
}
def code(x, y, z, t): t_1 = (t * t) / 2.0 tmp = 0 if t_1 <= 3.65e-7: tmp = (((x * 0.5) - y) * math.sqrt((z * 2.0))) * 1.0 elif t_1 <= 1.55e+144: tmp = math.sqrt(2.0) * ((y * ((0.5 * (x / y)) - 1.0)) * math.sqrt(z)) else: tmp = math.sqrt(2.0) * ((-1.0 * (x * ((y / x) - 0.5))) * math.sqrt(z)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(t * t) / 2.0) tmp = 0.0 if (t_1 <= 3.65e-7) tmp = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * 1.0); elseif (t_1 <= 1.55e+144) tmp = Float64(sqrt(2.0) * Float64(Float64(y * Float64(Float64(0.5 * Float64(x / y)) - 1.0)) * sqrt(z))); else tmp = Float64(sqrt(2.0) * Float64(Float64(-1.0 * Float64(x * Float64(Float64(y / x) - 0.5))) * sqrt(z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (t * t) / 2.0; tmp = 0.0; if (t_1 <= 3.65e-7) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.0; elseif (t_1 <= 1.55e+144) tmp = sqrt(2.0) * ((y * ((0.5 * (x / y)) - 1.0)) * sqrt(z)); else tmp = sqrt(2.0) * ((-1.0 * (x * ((y / x) - 0.5))) * sqrt(z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]}, If[LessEqual[t$95$1, 3.65e-7], N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[t$95$1, 1.55e+144], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(y * N[(N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(-1.0 * N[(x * N[(N[(y / x), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t \cdot t}{2}\\
\mathbf{if}\;t\_1 \leq 3.65 \cdot 10^{-7}:\\
\;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1\\
\mathbf{elif}\;t\_1 \leq 1.55 \cdot 10^{+144}:\\
\;\;\;\;\sqrt{2} \cdot \left(\left(y \cdot \left(0.5 \cdot \frac{x}{y} - 1\right)\right) \cdot \sqrt{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(\left(-1 \cdot \left(x \cdot \left(\frac{y}{x} - 0.5\right)\right)\right) \cdot \sqrt{z}\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 t t) #s(literal 2 binary64)) < 3.65e-7Initial program 99.4%
Taylor expanded in t around 0
Applied rewrites57.6%
if 3.65e-7 < (/.f64 (*.f64 t t) #s(literal 2 binary64)) < 1.5500000000000001e144Initial program 99.4%
Applied rewrites99.2%
Taylor expanded in t around 0
Applied rewrites57.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6456.3
Applied rewrites56.3%
if 1.5500000000000001e144 < (/.f64 (*.f64 t t) #s(literal 2 binary64)) Initial program 99.4%
Applied rewrites99.2%
Taylor expanded in t around 0
Applied rewrites57.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lift-/.f6457.1
Applied rewrites57.1%
(FPCore (x y z t) :precision binary64 (if (<= t 0.0055) (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) 1.0) (* (sqrt 2.0) (* (* -1.0 (* x (- (/ y x) 0.5))) (sqrt z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 0.0055) {
tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.0;
} else {
tmp = sqrt(2.0) * ((-1.0 * (x * ((y / x) - 0.5))) * sqrt(z));
}
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 <= 0.0055d0) then
tmp = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * 1.0d0
else
tmp = sqrt(2.0d0) * (((-1.0d0) * (x * ((y / x) - 0.5d0))) * sqrt(z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 0.0055) {
tmp = (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * 1.0;
} else {
tmp = Math.sqrt(2.0) * ((-1.0 * (x * ((y / x) - 0.5))) * Math.sqrt(z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 0.0055: tmp = (((x * 0.5) - y) * math.sqrt((z * 2.0))) * 1.0 else: tmp = math.sqrt(2.0) * ((-1.0 * (x * ((y / x) - 0.5))) * math.sqrt(z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 0.0055) tmp = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * 1.0); else tmp = Float64(sqrt(2.0) * Float64(Float64(-1.0 * Float64(x * Float64(Float64(y / x) - 0.5))) * sqrt(z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 0.0055) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.0; else tmp = sqrt(2.0) * ((-1.0 * (x * ((y / x) - 0.5))) * sqrt(z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 0.0055], N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(-1.0 * N[(x * N[(N[(y / x), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.0055:\\
\;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(\left(-1 \cdot \left(x \cdot \left(\frac{y}{x} - 0.5\right)\right)\right) \cdot \sqrt{z}\right)\\
\end{array}
\end{array}
if t < 0.0054999999999999997Initial program 99.4%
Taylor expanded in t around 0
Applied rewrites57.6%
if 0.0054999999999999997 < t Initial program 99.4%
Applied rewrites99.2%
Taylor expanded in t around 0
Applied rewrites57.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lift-/.f6457.1
Applied rewrites57.1%
(FPCore (x y z t) :precision binary64 (if (<= t 3.6e+72) (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) 1.0) (* (sqrt 2.0) (* x (* -1.0 (* (/ y x) (sqrt z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.6e+72) {
tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.0;
} else {
tmp = sqrt(2.0) * (x * (-1.0 * ((y / x) * sqrt(z))));
}
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 <= 3.6d+72) then
tmp = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * 1.0d0
else
tmp = sqrt(2.0d0) * (x * ((-1.0d0) * ((y / x) * sqrt(z))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.6e+72) {
tmp = (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * 1.0;
} else {
tmp = Math.sqrt(2.0) * (x * (-1.0 * ((y / x) * Math.sqrt(z))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 3.6e+72: tmp = (((x * 0.5) - y) * math.sqrt((z * 2.0))) * 1.0 else: tmp = math.sqrt(2.0) * (x * (-1.0 * ((y / x) * math.sqrt(z)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 3.6e+72) tmp = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * 1.0); else tmp = Float64(sqrt(2.0) * Float64(x * Float64(-1.0 * Float64(Float64(y / x) * sqrt(z))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 3.6e+72) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.0; else tmp = sqrt(2.0) * (x * (-1.0 * ((y / x) * sqrt(z)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 3.6e+72], N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(x * N[(-1.0 * N[(N[(y / x), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.6 \cdot 10^{+72}:\\
\;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(x \cdot \left(-1 \cdot \left(\frac{y}{x} \cdot \sqrt{z}\right)\right)\right)\\
\end{array}
\end{array}
if t < 3.60000000000000035e72Initial program 99.4%
Taylor expanded in t around 0
Applied rewrites57.6%
if 3.60000000000000035e72 < t Initial program 99.4%
Applied rewrites99.2%
Taylor expanded in x around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-sqrt.f64N/A
lower-*.f64N/A
lift-sqrt.f6493.0
Applied rewrites93.0%
Taylor expanded in t around 0
lift-sqrt.f6457.1
Applied rewrites57.1%
Taylor expanded in x around 0
lower-*.f64N/A
lift-/.f64N/A
lift-sqrt.f64N/A
lift-*.f6430.4
Applied rewrites30.4%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) 1.0))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.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))) * 1.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))) * 1.0;
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * 1.0
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * 1.0) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 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] * 1.0), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1
\end{array}
Initial program 99.4%
Taylor expanded in t around 0
Applied rewrites57.6%
(FPCore (x y z t) :precision binary64 (* (sqrt 2.0) (* (- (* 0.5 x) y) (sqrt z))))
double code(double x, double y, double z, double t) {
return sqrt(2.0) * (((0.5 * x) - y) * 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(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(z));
}
def code(x, y, z, t): return math.sqrt(2.0) * (((0.5 * x) - y) * math.sqrt(z))
function code(x, y, z, t) return Float64(sqrt(2.0) * Float64(Float64(Float64(0.5 * x) - y) * sqrt(z))) end
function tmp = code(x, y, z, t) tmp = sqrt(2.0) * (((0.5 * x) - y) * sqrt(z)); end
code[x_, y_, z_, t_] := N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2} \cdot \left(\left(0.5 \cdot x - y\right) \cdot \sqrt{z}\right)
\end{array}
Initial program 99.4%
Applied rewrites99.2%
Taylor expanded in t around 0
Applied rewrites57.4%
(FPCore (x y z t)
:precision binary64
(if (<= y -1.95e-38)
(* (- (sqrt (* (+ z z) 1.0))) y)
(if (<= y 6.6e+52)
(* (sqrt 2.0) (* 0.5 (* x (sqrt z))))
(* (sqrt 2.0) (* (* -1.0 y) (sqrt z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.95e-38) {
tmp = -sqrt(((z + z) * 1.0)) * y;
} else if (y <= 6.6e+52) {
tmp = sqrt(2.0) * (0.5 * (x * sqrt(z)));
} else {
tmp = sqrt(2.0) * ((-1.0 * y) * sqrt(z));
}
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 (y <= (-1.95d-38)) then
tmp = -sqrt(((z + z) * 1.0d0)) * y
else if (y <= 6.6d+52) then
tmp = sqrt(2.0d0) * (0.5d0 * (x * sqrt(z)))
else
tmp = sqrt(2.0d0) * (((-1.0d0) * y) * sqrt(z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.95e-38) {
tmp = -Math.sqrt(((z + z) * 1.0)) * y;
} else if (y <= 6.6e+52) {
tmp = Math.sqrt(2.0) * (0.5 * (x * Math.sqrt(z)));
} else {
tmp = Math.sqrt(2.0) * ((-1.0 * y) * Math.sqrt(z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.95e-38: tmp = -math.sqrt(((z + z) * 1.0)) * y elif y <= 6.6e+52: tmp = math.sqrt(2.0) * (0.5 * (x * math.sqrt(z))) else: tmp = math.sqrt(2.0) * ((-1.0 * y) * math.sqrt(z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.95e-38) tmp = Float64(Float64(-sqrt(Float64(Float64(z + z) * 1.0))) * y); elseif (y <= 6.6e+52) tmp = Float64(sqrt(2.0) * Float64(0.5 * Float64(x * sqrt(z)))); else tmp = Float64(sqrt(2.0) * Float64(Float64(-1.0 * y) * sqrt(z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.95e-38) tmp = -sqrt(((z + z) * 1.0)) * y; elseif (y <= 6.6e+52) tmp = sqrt(2.0) * (0.5 * (x * sqrt(z))); else tmp = sqrt(2.0) * ((-1.0 * y) * sqrt(z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.95e-38], N[((-N[Sqrt[N[(N[(z + z), $MachinePrecision] * 1.0), $MachinePrecision]], $MachinePrecision]) * y), $MachinePrecision], If[LessEqual[y, 6.6e+52], N[(N[Sqrt[2.0], $MachinePrecision] * N[(0.5 * N[(x * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[(-1.0 * y), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-38}:\\
\;\;\;\;\left(-\sqrt{\left(z + z\right) \cdot 1}\right) \cdot y\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+52}:\\
\;\;\;\;\sqrt{2} \cdot \left(0.5 \cdot \left(x \cdot \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(\left(-1 \cdot y\right) \cdot \sqrt{z}\right)\\
\end{array}
\end{array}
if y < -1.95e-38Initial program 99.4%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.3%
Taylor expanded in t around 0
Applied rewrites30.9%
if -1.95e-38 < y < 6.6e52Initial program 99.4%
Applied rewrites99.2%
Taylor expanded in t around 0
Applied rewrites57.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lift-/.f6457.1
Applied rewrites57.1%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f64N/A
lift-sqrt.f6429.5
Applied rewrites29.5%
if 6.6e52 < y Initial program 99.4%
Applied rewrites99.2%
Taylor expanded in t around 0
Applied rewrites57.4%
Taylor expanded in x around 0
lower-*.f6430.8
Applied rewrites30.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- (sqrt (* (+ z z) 1.0))) y)))
(if (<= y -1.95e-38)
t_1
(if (<= y 6.6e+52) (* (sqrt 2.0) (* 0.5 (* x (sqrt z)))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = -sqrt(((z + z) * 1.0)) * y;
double tmp;
if (y <= -1.95e-38) {
tmp = t_1;
} else if (y <= 6.6e+52) {
tmp = sqrt(2.0) * (0.5 * (x * sqrt(z)));
} 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 + z) * 1.0d0)) * y
if (y <= (-1.95d-38)) then
tmp = t_1
else if (y <= 6.6d+52) then
tmp = sqrt(2.0d0) * (0.5d0 * (x * sqrt(z)))
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 + z) * 1.0)) * y;
double tmp;
if (y <= -1.95e-38) {
tmp = t_1;
} else if (y <= 6.6e+52) {
tmp = Math.sqrt(2.0) * (0.5 * (x * Math.sqrt(z)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = -math.sqrt(((z + z) * 1.0)) * y tmp = 0 if y <= -1.95e-38: tmp = t_1 elif y <= 6.6e+52: tmp = math.sqrt(2.0) * (0.5 * (x * math.sqrt(z))) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(-sqrt(Float64(Float64(z + z) * 1.0))) * y) tmp = 0.0 if (y <= -1.95e-38) tmp = t_1; elseif (y <= 6.6e+52) tmp = Float64(sqrt(2.0) * Float64(0.5 * Float64(x * sqrt(z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -sqrt(((z + z) * 1.0)) * y; tmp = 0.0; if (y <= -1.95e-38) tmp = t_1; elseif (y <= 6.6e+52) tmp = sqrt(2.0) * (0.5 * (x * sqrt(z))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[((-N[Sqrt[N[(N[(z + z), $MachinePrecision] * 1.0), $MachinePrecision]], $MachinePrecision]) * y), $MachinePrecision]}, If[LessEqual[y, -1.95e-38], t$95$1, If[LessEqual[y, 6.6e+52], N[(N[Sqrt[2.0], $MachinePrecision] * N[(0.5 * N[(x * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-\sqrt{\left(z + z\right) \cdot 1}\right) \cdot y\\
\mathbf{if}\;y \leq -1.95 \cdot 10^{-38}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+52}:\\
\;\;\;\;\sqrt{2} \cdot \left(0.5 \cdot \left(x \cdot \sqrt{z}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.95e-38 or 6.6e52 < y Initial program 99.4%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.3%
Taylor expanded in t around 0
Applied rewrites30.9%
if -1.95e-38 < y < 6.6e52Initial program 99.4%
Applied rewrites99.2%
Taylor expanded in t around 0
Applied rewrites57.4%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lift-/.f6457.1
Applied rewrites57.1%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f64N/A
lift-sqrt.f6429.5
Applied rewrites29.5%
(FPCore (x y z t) :precision binary64 (* (- (sqrt (* (+ z z) 1.0))) y))
double code(double x, double y, double z, double t) {
return -sqrt(((z + z) * 1.0)) * 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) * 1.0d0)) * y
end function
public static double code(double x, double y, double z, double t) {
return -Math.sqrt(((z + z) * 1.0)) * y;
}
def code(x, y, z, t): return -math.sqrt(((z + z) * 1.0)) * y
function code(x, y, z, t) return Float64(Float64(-sqrt(Float64(Float64(z + z) * 1.0))) * y) end
function tmp = code(x, y, z, t) tmp = -sqrt(((z + z) * 1.0)) * y; end
code[x_, y_, z_, t_] := N[((-N[Sqrt[N[(N[(z + z), $MachinePrecision] * 1.0), $MachinePrecision]], $MachinePrecision]) * y), $MachinePrecision]
\begin{array}{l}
\\
\left(-\sqrt{\left(z + z\right) \cdot 1}\right) \cdot y
\end{array}
Initial program 99.4%
Taylor expanded in x around 0
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites64.3%
Taylor expanded in t around 0
Applied rewrites30.9%
herbie shell --seed 2025134
(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))))