
(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 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (pow (exp t) (/ t 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * pow(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.pow(Math.exp(t), (t / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.pow(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(t) ^ Float64(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[Power[N[Exp[t], $MachinePrecision], N[(t / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot {\left(e^{t}\right)}^{\left(\frac{t}{2}\right)}
\end{array}
Initial program 99.5%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
pow2N/A
associate-/l*N/A
exp-prodN/A
lower-pow.f64N/A
lower-exp.f64N/A
lower-/.f6499.5
Applied rewrites99.5%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Initial program 99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (fma (* t t) 0.5 1.0))))
(if (<= t 0.11)
t_1
(if (<= t 2.45e+146) (* (- (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.11) {
tmp = t_1;
} else if (t <= 2.45e+146) {
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.11) tmp = t_1; elseif (t <= 2.45e+146) 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.11], t$95$1, If[LessEqual[t, 2.45e+146], 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.11:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.45 \cdot 10^{+146}:\\
\;\;\;\;\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.110000000000000001 or 2.4500000000000001e146 < t Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6485.4
Applied rewrites85.4%
if 0.110000000000000001 < t < 2.4500000000000001e146Initial program 99.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites63.2%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (fma (* t t) 0.5 1.0)))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * fma((t * t), 0.5, 1.0);
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * fma(Float64(t * t), 0.5, 1.0)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)
\end{array}
Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6485.4
Applied rewrites85.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z z))))
(if (<= t 1.1)
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) 1.0)
(if (<= t 5.8e+88)
(/ (* t_1 (- (* (* x x) 0.25) (* y y))) y)
(* (* (* (* t t) (* t_1 0.5)) 0.5) x)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double tmp;
if (t <= 1.1) {
tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.0;
} else if (t <= 5.8e+88) {
tmp = (t_1 * (((x * x) * 0.25) - (y * y))) / y;
} else {
tmp = (((t * t) * (t_1 * 0.5)) * 0.5) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z + z))
if (t <= 1.1d0) then
tmp = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * 1.0d0
else if (t <= 5.8d+88) then
tmp = (t_1 * (((x * x) * 0.25d0) - (y * y))) / y
else
tmp = (((t * t) * (t_1 * 0.5d0)) * 0.5d0) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + z));
double tmp;
if (t <= 1.1) {
tmp = (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * 1.0;
} else if (t <= 5.8e+88) {
tmp = (t_1 * (((x * x) * 0.25) - (y * y))) / y;
} else {
tmp = (((t * t) * (t_1 * 0.5)) * 0.5) * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z + z)) tmp = 0 if t <= 1.1: tmp = (((x * 0.5) - y) * math.sqrt((z * 2.0))) * 1.0 elif t <= 5.8e+88: tmp = (t_1 * (((x * x) * 0.25) - (y * y))) / y else: tmp = (((t * t) * (t_1 * 0.5)) * 0.5) * x return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) tmp = 0.0 if (t <= 1.1) tmp = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * 1.0); elseif (t <= 5.8e+88) tmp = Float64(Float64(t_1 * Float64(Float64(Float64(x * x) * 0.25) - Float64(y * y))) / y); else tmp = Float64(Float64(Float64(Float64(t * t) * Float64(t_1 * 0.5)) * 0.5) * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z + z)); tmp = 0.0; if (t <= 1.1) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.0; elseif (t <= 5.8e+88) tmp = (t_1 * (((x * x) * 0.25) - (y * y))) / y; else tmp = (((t * t) * (t_1 * 0.5)) * 0.5) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.1], 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, 5.8e+88], N[(N[(t$95$1 * N[(N[(N[(x * x), $MachinePrecision] * 0.25), $MachinePrecision] - N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(N[(t * t), $MachinePrecision] * N[(t$95$1 * 0.5), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
\mathbf{if}\;t \leq 1.1:\\
\;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{+88}:\\
\;\;\;\;\frac{t\_1 \cdot \left(\left(x \cdot x\right) \cdot 0.25 - y \cdot y\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(t \cdot t\right) \cdot \left(t\_1 \cdot 0.5\right)\right) \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if t < 1.1000000000000001Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.8%
if 1.1000000000000001 < t < 5.7999999999999999e88Initial program 99.5%
Applied rewrites72.3%
Taylor expanded in t around 0
associate-*r*N/A
lower-*.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f64N/A
lower--.f64N/A
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6450.2
Applied rewrites50.2%
Taylor expanded in x around 0
Applied rewrites33.8%
if 5.7999999999999999e88 < t Initial program 99.5%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites62.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6451.3
Applied rewrites51.3%
Taylor expanded in t around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-+.f64N/A
lift-sqrt.f64N/A
count-2-revN/A
*-commutativeN/A
sqrt-prodN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites28.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z z))))
(if (<= t 780.0)
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) 1.0)
(if (<= t 3.4e+88)
(/ (* t_1 (- (* y y))) (fma 0.5 x y))
(* (* (* (* t t) (* t_1 0.5)) 0.5) x)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double tmp;
if (t <= 780.0) {
tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.0;
} else if (t <= 3.4e+88) {
tmp = (t_1 * -(y * y)) / fma(0.5, x, y);
} else {
tmp = (((t * t) * (t_1 * 0.5)) * 0.5) * x;
}
return tmp;
}
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) tmp = 0.0 if (t <= 780.0) tmp = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * 1.0); elseif (t <= 3.4e+88) tmp = Float64(Float64(t_1 * Float64(-Float64(y * y))) / fma(0.5, x, y)); else tmp = Float64(Float64(Float64(Float64(t * t) * Float64(t_1 * 0.5)) * 0.5) * x); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 780.0], 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, 3.4e+88], N[(N[(t$95$1 * (-N[(y * y), $MachinePrecision])), $MachinePrecision] / N[(0.5 * x + y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(t * t), $MachinePrecision] * N[(t$95$1 * 0.5), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
\mathbf{if}\;t \leq 780:\\
\;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+88}:\\
\;\;\;\;\frac{t\_1 \cdot \left(-y \cdot y\right)}{\mathsf{fma}\left(0.5, x, y\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(t \cdot t\right) \cdot \left(t\_1 \cdot 0.5\right)\right) \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if t < 780Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.8%
if 780 < t < 3.40000000000000004e88Initial program 99.5%
Applied rewrites72.3%
Taylor expanded in t around 0
associate-*r*N/A
lower-*.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f64N/A
lower--.f64N/A
*-commutativeN/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lift-*.f6450.2
Applied rewrites50.2%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f64N/A
pow2N/A
lift-*.f6428.4
Applied rewrites28.4%
if 3.40000000000000004e88 < t Initial program 99.5%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites62.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6451.3
Applied rewrites51.3%
Taylor expanded in t around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-+.f64N/A
lift-sqrt.f64N/A
count-2-revN/A
*-commutativeN/A
sqrt-prodN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites28.1%
(FPCore (x y z t) :precision binary64 (if (<= t 3.55e+75) (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) 1.0) (* (* (* (* t t) (* (sqrt (+ z z)) 0.5)) 0.5) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.55e+75) {
tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.0;
} else {
tmp = (((t * t) * (sqrt((z + z)) * 0.5)) * 0.5) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 3.55d+75) then
tmp = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * 1.0d0
else
tmp = (((t * t) * (sqrt((z + z)) * 0.5d0)) * 0.5d0) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.55e+75) {
tmp = (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * 1.0;
} else {
tmp = (((t * t) * (Math.sqrt((z + z)) * 0.5)) * 0.5) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 3.55e+75: tmp = (((x * 0.5) - y) * math.sqrt((z * 2.0))) * 1.0 else: tmp = (((t * t) * (math.sqrt((z + z)) * 0.5)) * 0.5) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 3.55e+75) tmp = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * 1.0); else tmp = Float64(Float64(Float64(Float64(t * t) * Float64(sqrt(Float64(z + z)) * 0.5)) * 0.5) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 3.55e+75) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.0; else tmp = (((t * t) * (sqrt((z + z)) * 0.5)) * 0.5) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 3.55e+75], N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(N[(t * t), $MachinePrecision] * N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.55 \cdot 10^{+75}:\\
\;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(t \cdot t\right) \cdot \left(\sqrt{z + z} \cdot 0.5\right)\right) \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if t < 3.54999999999999991e75Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.8%
if 3.54999999999999991e75 < t Initial program 99.5%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites62.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6451.3
Applied rewrites51.3%
Taylor expanded in t around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-+.f64N/A
lift-sqrt.f64N/A
count-2-revN/A
*-commutativeN/A
sqrt-prodN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites28.1%
(FPCore (x y z t) :precision binary64 (if (<= t 3.55e+75) (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) 1.0) (* (* (sqrt (* (+ z z) (fma t t 1.0))) 0.5) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.55e+75) {
tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * 1.0;
} else {
tmp = (sqrt(((z + z) * fma(t, t, 1.0))) * 0.5) * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 3.55e+75) tmp = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * 1.0); else tmp = Float64(Float64(sqrt(Float64(Float64(z + z) * fma(t, t, 1.0))) * 0.5) * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 3.55e+75], N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.55 \cdot 10^{+75}:\\
\;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\left(z + z\right) \cdot \mathsf{fma}\left(t, t, 1\right)} \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if t < 3.54999999999999991e75Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.8%
if 3.54999999999999991e75 < t Initial program 99.5%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites62.8%
Taylor expanded in t around 0
+-commutativeN/A
pow2N/A
lower-fma.f6450.9
Applied rewrites50.9%
(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.5%
Taylor expanded in t around 0
Applied rewrites56.8%
(FPCore (x y z t) :precision binary64 (* (* (- (* 0.5 x) y) (sqrt z)) (sqrt 2.0)))
double code(double x, double y, double z, double t) {
return (((0.5 * x) - y) * sqrt(z)) * sqrt(2.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((0.5d0 * x) - y) * sqrt(z)) * sqrt(2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (((0.5 * x) - y) * Math.sqrt(z)) * Math.sqrt(2.0);
}
def code(x, y, z, t): return (((0.5 * x) - y) * math.sqrt(z)) * math.sqrt(2.0)
function code(x, y, z, t) return Float64(Float64(Float64(Float64(0.5 * x) - y) * sqrt(z)) * sqrt(2.0)) end
function tmp = code(x, y, z, t) tmp = (((0.5 * x) - y) * sqrt(z)) * sqrt(2.0); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(0.5 \cdot x - y\right) \cdot \sqrt{z}\right) \cdot \sqrt{2}
\end{array}
Initial program 99.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
Applied rewrites99.6%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-sqrt.f6456.6
Applied rewrites56.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z z))) (t_2 (* (* t_1 0.5) x)))
(if (<= x -56000000000.0)
t_2
(if (<= x 1.22e+85) (* (- (* y t_1)) 1.0) t_2))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double t_2 = (t_1 * 0.5) * x;
double tmp;
if (x <= -56000000000.0) {
tmp = t_2;
} else if (x <= 1.22e+85) {
tmp = -(y * t_1) * 1.0;
} else {
tmp = t_2;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
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 * 0.5d0) * x
if (x <= (-56000000000.0d0)) then
tmp = t_2
else if (x <= 1.22d+85) then
tmp = -(y * t_1) * 1.0d0
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 * 0.5) * x;
double tmp;
if (x <= -56000000000.0) {
tmp = t_2;
} else if (x <= 1.22e+85) {
tmp = -(y * t_1) * 1.0;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z + z)) t_2 = (t_1 * 0.5) * x tmp = 0 if x <= -56000000000.0: tmp = t_2 elif x <= 1.22e+85: tmp = -(y * t_1) * 1.0 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) t_2 = Float64(Float64(t_1 * 0.5) * x) tmp = 0.0 if (x <= -56000000000.0) tmp = t_2; elseif (x <= 1.22e+85) tmp = Float64(Float64(-Float64(y * t_1)) * 1.0); 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 * 0.5) * x; tmp = 0.0; if (x <= -56000000000.0) tmp = t_2; elseif (x <= 1.22e+85) tmp = -(y * t_1) * 1.0; 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 * 0.5), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -56000000000.0], t$95$2, If[LessEqual[x, 1.22e+85], N[((-N[(y * t$95$1), $MachinePrecision]) * 1.0), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
t_2 := \left(t\_1 \cdot 0.5\right) \cdot x\\
\mathbf{if}\;x \leq -56000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{+85}:\\
\;\;\;\;\left(-y \cdot t\_1\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -5.6e10 or 1.22e85 < x Initial program 99.5%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites62.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6429.7
Applied rewrites29.7%
if -5.6e10 < x < 1.22e85Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.8%
Taylor expanded in x around 0
mul-1-negN/A
lower-neg.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6429.6
Applied rewrites29.6%
(FPCore (x y z t) :precision binary64 (* (* (sqrt (+ z z)) 0.5) x))
double code(double x, double y, double z, double t) {
return (sqrt((z + z)) * 0.5) * x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (sqrt((z + z)) * 0.5d0) * x
end function
public static double code(double x, double y, double z, double t) {
return (Math.sqrt((z + z)) * 0.5) * x;
}
def code(x, y, z, t): return (math.sqrt((z + z)) * 0.5) * x
function code(x, y, z, t) return Float64(Float64(sqrt(Float64(z + z)) * 0.5) * x) end
function tmp = code(x, y, z, t) tmp = (sqrt((z + z)) * 0.5) * x; end
code[x_, y_, z_, t_] := N[(N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\left(\sqrt{z + z} \cdot 0.5\right) \cdot x
\end{array}
Initial program 99.5%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites62.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6429.7
Applied rewrites29.7%
(FPCore (x y z t) :precision binary64 (* (* -0.5 (sqrt (+ z z))) x))
double code(double x, double y, double z, double t) {
return (-0.5 * sqrt((z + z))) * x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((-0.5d0) * sqrt((z + z))) * x
end function
public static double code(double x, double y, double z, double t) {
return (-0.5 * Math.sqrt((z + z))) * x;
}
def code(x, y, z, t): return (-0.5 * math.sqrt((z + z))) * x
function code(x, y, z, t) return Float64(Float64(-0.5 * sqrt(Float64(z + z))) * x) end
function tmp = code(x, y, z, t) tmp = (-0.5 * sqrt((z + z))) * x; end
code[x_, y_, z_, t_] := N[(N[(-0.5 * N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\left(-0.5 \cdot \sqrt{z + z}\right) \cdot x
\end{array}
Initial program 99.5%
Taylor expanded in x around inf
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites62.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
sqrt-prodN/A
lift-sqrt.f64N/A
*-commutativeN/A
count-2-revN/A
lift-+.f6429.7
Applied rewrites29.7%
Taylor expanded in z around -inf
sqrt-unprodN/A
metadata-evalN/A
lower-*.f64N/A
sqrt-prodN/A
*-commutativeN/A
count-2-revN/A
lift-sqrt.f64N/A
lift-+.f642.4
Applied rewrites2.4%
herbie shell --seed 2025131
(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))))