
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Initial program 99.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z z))) (t_2 (fma (* t t) 0.5 1.0)))
(if (<= t 0.0255)
(* t_2 (* (- (* 0.5 x) y) t_1))
(if (<= t 7.8e+133)
(* (* (sqrt (* (+ z z) (exp (* t t)))) x) 0.5)
(* t_1 (* t_2 (- (* x 0.5) y)))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double t_2 = fma((t * t), 0.5, 1.0);
double tmp;
if (t <= 0.0255) {
tmp = t_2 * (((0.5 * x) - y) * t_1);
} else if (t <= 7.8e+133) {
tmp = (sqrt(((z + z) * exp((t * t)))) * x) * 0.5;
} else {
tmp = t_1 * (t_2 * ((x * 0.5) - y));
}
return tmp;
}
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) t_2 = fma(Float64(t * t), 0.5, 1.0) tmp = 0.0 if (t <= 0.0255) tmp = Float64(t_2 * Float64(Float64(Float64(0.5 * x) - y) * t_1)); elseif (t <= 7.8e+133) tmp = Float64(Float64(sqrt(Float64(Float64(z + z) * exp(Float64(t * t)))) * x) * 0.5); else tmp = Float64(t_1 * Float64(t_2 * Float64(Float64(x * 0.5) - y))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]}, If[LessEqual[t, 0.0255], N[(t$95$2 * N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.8e+133], N[(N[(N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] * 0.5), $MachinePrecision], N[(t$95$1 * N[(t$95$2 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
t_2 := \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\\
\mathbf{if}\;t \leq 0.0255:\\
\;\;\;\;t\_2 \cdot \left(\left(0.5 \cdot x - y\right) \cdot t\_1\right)\\
\mathbf{elif}\;t \leq 7.8 \cdot 10^{+133}:\\
\;\;\;\;\left(\sqrt{\left(z + z\right) \cdot e^{t \cdot t}} \cdot x\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \left(x \cdot 0.5 - y\right)\right)\\
\end{array}
\end{array}
if t < 0.0254999999999999984Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites85.6%
if 0.0254999999999999984 < t < 7.80000000000000028e133Initial program 99.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites62.1%
if 7.80000000000000028e133 < t Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites85.6%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*r*N/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
lift-+.f64N/A
lift-sqrt.f64N/A
count-2-revN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z z))) (t_2 (fma (* t t) 0.5 1.0)))
(if (<= t 0.11)
(* t_2 (* (- (* 0.5 x) y) t_1))
(if (<= t 1.3e+49)
(* (- (sqrt (* (+ z z) (exp (* t t))))) y)
(* t_1 (* t_2 (- (* x 0.5) y)))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double t_2 = fma((t * t), 0.5, 1.0);
double tmp;
if (t <= 0.11) {
tmp = t_2 * (((0.5 * x) - y) * t_1);
} else if (t <= 1.3e+49) {
tmp = -sqrt(((z + z) * exp((t * t)))) * y;
} else {
tmp = t_1 * (t_2 * ((x * 0.5) - y));
}
return tmp;
}
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) t_2 = fma(Float64(t * t), 0.5, 1.0) tmp = 0.0 if (t <= 0.11) tmp = Float64(t_2 * Float64(Float64(Float64(0.5 * x) - y) * t_1)); elseif (t <= 1.3e+49) tmp = Float64(Float64(-sqrt(Float64(Float64(z + z) * exp(Float64(t * t))))) * y); else tmp = Float64(t_1 * Float64(t_2 * Float64(Float64(x * 0.5) - y))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]}, If[LessEqual[t, 0.11], N[(t$95$2 * N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.3e+49], N[((-N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) * y), $MachinePrecision], N[(t$95$1 * N[(t$95$2 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
t_2 := \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\\
\mathbf{if}\;t \leq 0.11:\\
\;\;\;\;t\_2 \cdot \left(\left(0.5 \cdot x - y\right) \cdot t\_1\right)\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{+49}:\\
\;\;\;\;\left(-\sqrt{\left(z + z\right) \cdot e^{t \cdot t}}\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \left(x \cdot 0.5 - y\right)\right)\\
\end{array}
\end{array}
if t < 0.110000000000000001Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites85.6%
if 0.110000000000000001 < t < 1.29999999999999994e49Initial program 99.4%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites63.7%
if 1.29999999999999994e49 < t Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites85.6%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*r*N/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
lift-+.f64N/A
lift-sqrt.f64N/A
count-2-revN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.4%
(FPCore (x y z t) :precision binary64 (* (sqrt (+ z z)) (* (fma (* t t) 0.5 1.0) (- (* x 0.5) y))))
double code(double x, double y, double z, double t) {
return sqrt((z + z)) * (fma((t * t), 0.5, 1.0) * ((x * 0.5) - y));
}
function code(x, y, z, t) return Float64(sqrt(Float64(z + z)) * Float64(fma(Float64(t * t), 0.5, 1.0) * Float64(Float64(x * 0.5) - y))) end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z + z} \cdot \left(\mathsf{fma}\left(t \cdot t, 0.5, 1\right) \cdot \left(x \cdot 0.5 - y\right)\right)
\end{array}
Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites85.6%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-*r*N/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
lift-+.f64N/A
lift-sqrt.f64N/A
count-2-revN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (sqrt (+ z z)) (- (* x 0.5) y)))) (if (<= t 1.45) t_1 (* (* (* t t) 0.5) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z)) * ((x * 0.5) - y);
double tmp;
if (t <= 1.45) {
tmp = t_1;
} else {
tmp = ((t * t) * 0.5) * 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)) * ((x * 0.5d0) - y)
if (t <= 1.45d0) then
tmp = t_1
else
tmp = ((t * t) * 0.5d0) * 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)) * ((x * 0.5) - y);
double tmp;
if (t <= 1.45) {
tmp = t_1;
} else {
tmp = ((t * t) * 0.5) * t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z + z)) * ((x * 0.5) - y) tmp = 0 if t <= 1.45: tmp = t_1 else: tmp = ((t * t) * 0.5) * t_1 return tmp
function code(x, y, z, t) t_1 = Float64(sqrt(Float64(z + z)) * Float64(Float64(x * 0.5) - y)) tmp = 0.0 if (t <= 1.45) tmp = t_1; else tmp = Float64(Float64(Float64(t * t) * 0.5) * t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z + z)) * ((x * 0.5) - y); tmp = 0.0; if (t <= 1.45) tmp = t_1; else tmp = ((t * t) * 0.5) * t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 1.45], t$95$1, N[(N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision] * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z} \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{if}\;t \leq 1.45:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t \cdot t\right) \cdot 0.5\right) \cdot t\_1\\
\end{array}
\end{array}
if t < 1.44999999999999996Initial program 99.4%
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.4
Applied rewrites99.4%
Taylor expanded in t around 0
lift-+.f64N/A
pow-flipN/A
lift-+.f64N/A
count-2-revN/A
metadata-evalN/A
pow1/2N/A
*-commutativeN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
metadata-evalN/A
pow-negN/A
pow1/2N/A
lower-/.f64N/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6456.9
Applied rewrites56.9%
Taylor expanded in z around 0
lower-*.f64N/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6457.0
Applied rewrites57.0%
if 1.44999999999999996 < t Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites85.6%
Taylor expanded in t around inf
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f64N/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6441.5
Applied rewrites41.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (+ z z)))) (if (<= t 4.4e+56) (* t_1 (- (* x 0.5) y)) (* (* (* (* t t) x) t_1) 0.25))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double tmp;
if (t <= 4.4e+56) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = (((t * t) * x) * t_1) * 0.25;
}
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 <= 4.4d+56) then
tmp = t_1 * ((x * 0.5d0) - y)
else
tmp = (((t * t) * x) * t_1) * 0.25d0
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 <= 4.4e+56) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = (((t * t) * x) * t_1) * 0.25;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z + z)) tmp = 0 if t <= 4.4e+56: tmp = t_1 * ((x * 0.5) - y) else: tmp = (((t * t) * x) * t_1) * 0.25 return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) tmp = 0.0 if (t <= 4.4e+56) tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y)); else tmp = Float64(Float64(Float64(Float64(t * t) * x) * t_1) * 0.25); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z + z)); tmp = 0.0; if (t <= 4.4e+56) tmp = t_1 * ((x * 0.5) - y); else tmp = (((t * t) * x) * t_1) * 0.25; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 4.4e+56], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(t * t), $MachinePrecision] * x), $MachinePrecision] * t$95$1), $MachinePrecision] * 0.25), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
\mathbf{if}\;t \leq 4.4 \cdot 10^{+56}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(t \cdot t\right) \cdot x\right) \cdot t\_1\right) \cdot 0.25\\
\end{array}
\end{array}
if t < 4.40000000000000032e56Initial program 99.4%
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.4
Applied rewrites99.4%
Taylor expanded in t around 0
lift-+.f64N/A
pow-flipN/A
lift-+.f64N/A
count-2-revN/A
metadata-evalN/A
pow1/2N/A
*-commutativeN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
metadata-evalN/A
pow-negN/A
pow1/2N/A
lower-/.f64N/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6456.9
Applied rewrites56.9%
Taylor expanded in z around 0
lower-*.f64N/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6457.0
Applied rewrites57.0%
if 4.40000000000000032e56 < t Initial program 99.4%
Taylor expanded in t around 0
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
Applied rewrites85.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f64N/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f6450.9
Applied rewrites50.9%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f6428.4
Applied rewrites28.4%
(FPCore (x y z t)
:precision binary64
(if (<= t 9.5e+79)
(* (sqrt (+ z z)) (- (* x 0.5) y))
(if (<= t 8.2e+183)
(* (- (sqrt (sqrt (* (+ z z) (+ z z))))) y)
(* (* (* x z) (sqrt (/ 2.0 z))) 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 9.5e+79) {
tmp = sqrt((z + z)) * ((x * 0.5) - y);
} else if (t <= 8.2e+183) {
tmp = -sqrt(sqrt(((z + z) * (z + z)))) * y;
} else {
tmp = ((x * z) * sqrt((2.0 / z))) * 0.5;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 9.5d+79) then
tmp = sqrt((z + z)) * ((x * 0.5d0) - y)
else if (t <= 8.2d+183) then
tmp = -sqrt(sqrt(((z + z) * (z + z)))) * y
else
tmp = ((x * z) * sqrt((2.0d0 / z))) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 9.5e+79) {
tmp = Math.sqrt((z + z)) * ((x * 0.5) - y);
} else if (t <= 8.2e+183) {
tmp = -Math.sqrt(Math.sqrt(((z + z) * (z + z)))) * y;
} else {
tmp = ((x * z) * Math.sqrt((2.0 / z))) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 9.5e+79: tmp = math.sqrt((z + z)) * ((x * 0.5) - y) elif t <= 8.2e+183: tmp = -math.sqrt(math.sqrt(((z + z) * (z + z)))) * y else: tmp = ((x * z) * math.sqrt((2.0 / z))) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 9.5e+79) tmp = Float64(sqrt(Float64(z + z)) * Float64(Float64(x * 0.5) - y)); elseif (t <= 8.2e+183) tmp = Float64(Float64(-sqrt(sqrt(Float64(Float64(z + z) * Float64(z + z))))) * y); else tmp = Float64(Float64(Float64(x * z) * sqrt(Float64(2.0 / z))) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 9.5e+79) tmp = sqrt((z + z)) * ((x * 0.5) - y); elseif (t <= 8.2e+183) tmp = -sqrt(sqrt(((z + z) * (z + z)))) * y; else tmp = ((x * z) * sqrt((2.0 / z))) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 9.5e+79], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.2e+183], N[((-N[Sqrt[N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[(z + z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]) * y), $MachinePrecision], N[(N[(N[(x * z), $MachinePrecision] * N[Sqrt[N[(2.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9.5 \cdot 10^{+79}:\\
\;\;\;\;\sqrt{z + z} \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{+183}:\\
\;\;\;\;\left(-\sqrt{\sqrt{\left(z + z\right) \cdot \left(z + z\right)}}\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x \cdot z\right) \cdot \sqrt{\frac{2}{z}}\right) \cdot 0.5\\
\end{array}
\end{array}
if t < 9.49999999999999994e79Initial program 99.4%
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.4
Applied rewrites99.4%
Taylor expanded in t around 0
lift-+.f64N/A
pow-flipN/A
lift-+.f64N/A
count-2-revN/A
metadata-evalN/A
pow1/2N/A
*-commutativeN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
metadata-evalN/A
pow-negN/A
pow1/2N/A
lower-/.f64N/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6456.9
Applied rewrites56.9%
Taylor expanded in z around 0
lower-*.f64N/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6457.0
Applied rewrites57.0%
if 9.49999999999999994e79 < t < 8.20000000000000029e183Initial program 99.4%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites63.7%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6430.4
Applied rewrites30.4%
lift-+.f64N/A
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f64N/A
lift-+.f64N/A
lift-+.f6428.3
Applied rewrites28.3%
if 8.20000000000000029e183 < t Initial program 99.4%
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.4
Applied rewrites99.4%
Taylor expanded in t around 0
lift-+.f64N/A
pow-flipN/A
lift-+.f64N/A
count-2-revN/A
metadata-evalN/A
pow1/2N/A
*-commutativeN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
metadata-evalN/A
pow-negN/A
pow1/2N/A
lower-/.f64N/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6456.9
Applied rewrites56.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f6429.2
Applied rewrites29.2%
Taylor expanded in z around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6429.1
Applied rewrites29.1%
(FPCore (x y z t) :precision binary64 (if (<= t 1.3e+185) (* (sqrt (+ z z)) (- (* x 0.5) y)) (* (* (* x z) (sqrt (/ 2.0 z))) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.3e+185) {
tmp = sqrt((z + z)) * ((x * 0.5) - y);
} else {
tmp = ((x * z) * sqrt((2.0 / z))) * 0.5;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 1.3d+185) then
tmp = sqrt((z + z)) * ((x * 0.5d0) - y)
else
tmp = ((x * z) * sqrt((2.0d0 / z))) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.3e+185) {
tmp = Math.sqrt((z + z)) * ((x * 0.5) - y);
} else {
tmp = ((x * z) * Math.sqrt((2.0 / z))) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.3e+185: tmp = math.sqrt((z + z)) * ((x * 0.5) - y) else: tmp = ((x * z) * math.sqrt((2.0 / z))) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.3e+185) tmp = Float64(sqrt(Float64(z + z)) * Float64(Float64(x * 0.5) - y)); else tmp = Float64(Float64(Float64(x * z) * sqrt(Float64(2.0 / z))) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.3e+185) tmp = sqrt((z + z)) * ((x * 0.5) - y); else tmp = ((x * z) * sqrt((2.0 / z))) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.3e+185], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * z), $MachinePrecision] * N[Sqrt[N[(2.0 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.3 \cdot 10^{+185}:\\
\;\;\;\;\sqrt{z + z} \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x \cdot z\right) \cdot \sqrt{\frac{2}{z}}\right) \cdot 0.5\\
\end{array}
\end{array}
if t < 1.3e185Initial program 99.4%
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.4
Applied rewrites99.4%
Taylor expanded in t around 0
lift-+.f64N/A
pow-flipN/A
lift-+.f64N/A
count-2-revN/A
metadata-evalN/A
pow1/2N/A
*-commutativeN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
metadata-evalN/A
pow-negN/A
pow1/2N/A
lower-/.f64N/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6456.9
Applied rewrites56.9%
Taylor expanded in z around 0
lower-*.f64N/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6457.0
Applied rewrites57.0%
if 1.3e185 < t Initial program 99.4%
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.4
Applied rewrites99.4%
Taylor expanded in t around 0
lift-+.f64N/A
pow-flipN/A
lift-+.f64N/A
count-2-revN/A
metadata-evalN/A
pow1/2N/A
*-commutativeN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
metadata-evalN/A
pow-negN/A
pow1/2N/A
lower-/.f64N/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6456.9
Applied rewrites56.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f6429.2
Applied rewrites29.2%
Taylor expanded in z around inf
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6429.1
Applied rewrites29.1%
(FPCore (x y z t) :precision binary64 (* (sqrt (+ z z)) (- (* x 0.5) y)))
double code(double x, double y, double z, double t) {
return sqrt((z + z)) * ((x * 0.5) - 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)) * ((x * 0.5d0) - y)
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z + z)) * ((x * 0.5) - y);
}
def code(x, y, z, t): return math.sqrt((z + z)) * ((x * 0.5) - y)
function code(x, y, z, t) return Float64(sqrt(Float64(z + z)) * Float64(Float64(x * 0.5) - y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z + z)) * ((x * 0.5) - y); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z + z} \cdot \left(x \cdot 0.5 - y\right)
\end{array}
Initial program 99.4%
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.4
Applied rewrites99.4%
Taylor expanded in t around 0
lift-+.f64N/A
pow-flipN/A
lift-+.f64N/A
count-2-revN/A
metadata-evalN/A
pow1/2N/A
*-commutativeN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
metadata-evalN/A
pow-negN/A
pow1/2N/A
lower-/.f64N/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6456.9
Applied rewrites56.9%
Taylor expanded in z around 0
lower-*.f64N/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
lower-*.f6457.0
Applied rewrites57.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (+ z z))) (t_2 (* (* t_1 x) 0.5))) (if (<= x -1.08e+52) t_2 (if (<= x 3.8e-56) (* (- 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 <= -1.08e+52) {
tmp = t_2;
} else if (x <= 3.8e-56) {
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 <= (-1.08d+52)) then
tmp = t_2
else if (x <= 3.8d-56) 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 <= -1.08e+52) {
tmp = t_2;
} else if (x <= 3.8e-56) {
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 <= -1.08e+52: tmp = t_2 elif x <= 3.8e-56: 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(Float64(t_1 * x) * 0.5) tmp = 0.0 if (x <= -1.08e+52) tmp = t_2; elseif (x <= 3.8e-56) tmp = Float64(Float64(-t_1) * 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 <= -1.08e+52) tmp = t_2; elseif (x <= 3.8e-56) 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[(N[(t$95$1 * x), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[x, -1.08e+52], t$95$2, If[LessEqual[x, 3.8e-56], N[((-t$95$1) * y), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
t_2 := \left(t\_1 \cdot x\right) \cdot 0.5\\
\mathbf{if}\;x \leq -1.08 \cdot 10^{+52}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-56}:\\
\;\;\;\;\left(-t\_1\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -1.07999999999999997e52 or 3.8000000000000002e-56 < x Initial program 99.4%
lift-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
pow-negN/A
lower-/.f64N/A
lower-pow.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.4
Applied rewrites99.4%
Taylor expanded in t around 0
lift-+.f64N/A
pow-flipN/A
lift-+.f64N/A
count-2-revN/A
metadata-evalN/A
pow1/2N/A
*-commutativeN/A
lower-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
metadata-evalN/A
pow-negN/A
pow1/2N/A
lower-/.f64N/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6456.9
Applied rewrites56.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f6429.2
Applied rewrites29.2%
if -1.07999999999999997e52 < x < 3.8000000000000002e-56Initial program 99.4%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites63.7%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6430.4
Applied rewrites30.4%
(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(Float64(-sqrt(Float64(z + z))) * 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}
\\
\left(-\sqrt{z + z}\right) \cdot y
\end{array}
Initial program 99.4%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites63.7%
Taylor expanded in t around 0
mul-1-negN/A
lower-neg.f64N/A
lower-sqrt.f64N/A
count-2-revN/A
lift-+.f6430.4
Applied rewrites30.4%
herbie shell --seed 2025139
(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))))