
(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}
Sampling outcomes in binary64 precision:
Herbie found 16 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) 0.5))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) * 0.5));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) * 0.5d0))
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) * 0.5));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) * 0.5))
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) * 0.5))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) * 0.5)); 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] * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\left(t \cdot t\right) \cdot 0.5}
\end{array}
Initial program 99.5%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6499.5
Applied rewrites99.5%
(FPCore (x y z t) :precision binary64 (if (<= (exp (/ (* t t) 2.0)) 2.0) (* (sqrt (+ z z)) (- (* x 0.5) y)) (* (* (* t t) (* (sqrt (* 2.0 z)) (- (* 0.5 x) y))) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if (exp(((t * t) / 2.0)) <= 2.0) {
tmp = sqrt((z + z)) * ((x * 0.5) - y);
} else {
tmp = ((t * t) * (sqrt((2.0 * z)) * ((0.5 * x) - y))) * 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 (exp(((t * t) / 2.0d0)) <= 2.0d0) then
tmp = sqrt((z + z)) * ((x * 0.5d0) - y)
else
tmp = ((t * t) * (sqrt((2.0d0 * z)) * ((0.5d0 * x) - y))) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (Math.exp(((t * t) / 2.0)) <= 2.0) {
tmp = Math.sqrt((z + z)) * ((x * 0.5) - y);
} else {
tmp = ((t * t) * (Math.sqrt((2.0 * z)) * ((0.5 * x) - y))) * 0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if math.exp(((t * t) / 2.0)) <= 2.0: tmp = math.sqrt((z + z)) * ((x * 0.5) - y) else: tmp = ((t * t) * (math.sqrt((2.0 * z)) * ((0.5 * x) - y))) * 0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (exp(Float64(Float64(t * t) / 2.0)) <= 2.0) tmp = Float64(sqrt(Float64(z + z)) * Float64(Float64(x * 0.5) - y)); else tmp = Float64(Float64(Float64(t * t) * Float64(sqrt(Float64(2.0 * z)) * Float64(Float64(0.5 * x) - y))) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (exp(((t * t) / 2.0)) <= 2.0) tmp = sqrt((z + z)) * ((x * 0.5) - y); else tmp = ((t * t) * (sqrt((2.0 * z)) * ((0.5 * x) - y))) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t * t), $MachinePrecision] * N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{\frac{t \cdot t}{2}} \leq 2:\\
\;\;\;\;\sqrt{z + z} \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t \cdot t\right) \cdot \left(\sqrt{2 \cdot z} \cdot \left(0.5 \cdot x - y\right)\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if (exp.f64 (/.f64 (*.f64 t t) #s(literal 2 binary64))) < 2Initial program 99.7%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6498.3
Applied rewrites98.3%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6449.8
Applied rewrites49.8%
lift-*.f64N/A
count-2-revN/A
lower-+.f6449.8
Applied rewrites49.8%
Taylor expanded in x around 0
flip-+N/A
lower--.f64N/A
*-commutativeN/A
lift-*.f6498.3
Applied rewrites98.3%
if 2 < (exp.f64 (/.f64 (*.f64 t t) #s(literal 2 binary64))) Initial program 99.3%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites73.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites70.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (exp (/ (* t t) 2.0)) 2.0)
(* (sqrt (+ z z)) t_1)
(* (* t (* t (* (sqrt (* 2.0 z)) t_1))) 0.5))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (exp(((t * t) / 2.0)) <= 2.0) {
tmp = sqrt((z + z)) * t_1;
} else {
tmp = (t * (t * (sqrt((2.0 * z)) * t_1))) * 0.5;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x * 0.5d0) - y
if (exp(((t * t) / 2.0d0)) <= 2.0d0) then
tmp = sqrt((z + z)) * t_1
else
tmp = (t * (t * (sqrt((2.0d0 * z)) * t_1))) * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (Math.exp(((t * t) / 2.0)) <= 2.0) {
tmp = Math.sqrt((z + z)) * t_1;
} else {
tmp = (t * (t * (Math.sqrt((2.0 * z)) * t_1))) * 0.5;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if math.exp(((t * t) / 2.0)) <= 2.0: tmp = math.sqrt((z + z)) * t_1 else: tmp = (t * (t * (math.sqrt((2.0 * z)) * t_1))) * 0.5 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (exp(Float64(Float64(t * t) / 2.0)) <= 2.0) tmp = Float64(sqrt(Float64(z + z)) * t_1); else tmp = Float64(Float64(t * Float64(t * Float64(sqrt(Float64(2.0 * z)) * t_1))) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if (exp(((t * t) / 2.0)) <= 2.0) tmp = sqrt((z + z)) * t_1; else tmp = (t * (t * (sqrt((2.0 * z)) * t_1))) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(t * N[(t * N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;e^{\frac{t \cdot t}{2}} \leq 2:\\
\;\;\;\;\sqrt{z + z} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(t \cdot \left(t \cdot \left(\sqrt{2 \cdot z} \cdot t\_1\right)\right)\right) \cdot 0.5\\
\end{array}
\end{array}
if (exp.f64 (/.f64 (*.f64 t t) #s(literal 2 binary64))) < 2Initial program 99.7%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6498.3
Applied rewrites98.3%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6449.8
Applied rewrites49.8%
lift-*.f64N/A
count-2-revN/A
lower-+.f6449.8
Applied rewrites49.8%
Taylor expanded in x around 0
flip-+N/A
lower--.f64N/A
*-commutativeN/A
lift-*.f6498.3
Applied rewrites98.3%
if 2 < (exp.f64 (/.f64 (*.f64 t t) #s(literal 2 binary64))) Initial program 99.3%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites73.2%
Taylor expanded in y around inf
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites54.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites70.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
sqrt-prodN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites63.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (or (<= t 0.22) (not (<= t 7.2e+39)))
(*
(* (- (* x 0.5) y) t_1)
(fma
(fma (fma 0.020833333333333332 (* t t) 0.125) (* t t) 0.5)
(* t t)
1.0))
(* (* (- y) t_1) (exp (* (* t t) 0.5))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t <= 0.22) || !(t <= 7.2e+39)) {
tmp = (((x * 0.5) - y) * t_1) * fma(fma(fma(0.020833333333333332, (t * t), 0.125), (t * t), 0.5), (t * t), 1.0);
} else {
tmp = (-y * t_1) * exp(((t * t) * 0.5));
}
return tmp;
}
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if ((t <= 0.22) || !(t <= 7.2e+39)) tmp = Float64(Float64(Float64(Float64(x * 0.5) - y) * t_1) * fma(fma(fma(0.020833333333333332, Float64(t * t), 0.125), Float64(t * t), 0.5), Float64(t * t), 1.0)); else tmp = Float64(Float64(Float64(-y) * t_1) * exp(Float64(Float64(t * t) * 0.5))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[t, 0.22], N[Not[LessEqual[t, 7.2e+39]], $MachinePrecision]], N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(N[(N[(0.020833333333333332 * N[(t * t), $MachinePrecision] + 0.125), $MachinePrecision] * N[(t * t), $MachinePrecision] + 0.5), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[((-y) * t$95$1), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 0.22 \lor \neg \left(t \leq 7.2 \cdot 10^{+39}\right):\\
\;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot t\_1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.020833333333333332, t \cdot t, 0.125\right), t \cdot t, 0.5\right), t \cdot t, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-y\right) \cdot t\_1\right) \cdot e^{\left(t \cdot t\right) \cdot 0.5}\\
\end{array}
\end{array}
if t < 0.220000000000000001 or 7.19999999999999969e39 < t Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6496.1
Applied rewrites96.1%
if 0.220000000000000001 < t < 7.19999999999999969e39Initial program 100.0%
lift-exp.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
exp-sqrtN/A
pow1/2N/A
exp-prodN/A
*-commutativeN/A
lower-exp.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6463.6
Applied rewrites63.6%
Final simplification94.7%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (fma (fma (fma 0.020833333333333332 (* t t) 0.125) (* t t) 0.5) (* t t) 1.0)))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * fma(fma(fma(0.020833333333333332, (t * t), 0.125), (t * t), 0.5), (t * t), 1.0);
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * fma(fma(fma(0.020833333333333332, Float64(t * t), 0.125), Float64(t * t), 0.5), Float64(t * t), 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[(N[(0.020833333333333332 * N[(t * t), $MachinePrecision] + 0.125), $MachinePrecision] * N[(t * t), $MachinePrecision] + 0.5), $MachinePrecision] * N[(t * t), $MachinePrecision] + 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(\mathsf{fma}\left(\mathsf{fma}\left(0.020833333333333332, t \cdot t, 0.125\right), t \cdot t, 0.5\right), t \cdot t, 1\right)
\end{array}
Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6493.2
Applied rewrites93.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* z 2.0))))
(if (<= t 1.05e+45)
(* (* t_1 t_2) (fma (* t t) 0.5 1.0))
(if (<= t 7e+127)
(* (* (- y) t_2) (fma (* (* t t) 0.125) (* t t) 1.0))
(* (* (* (* t t) t_1) (sqrt (* 2.0 z))) 0.5)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double t_2 = sqrt((z * 2.0));
double tmp;
if (t <= 1.05e+45) {
tmp = (t_1 * t_2) * fma((t * t), 0.5, 1.0);
} else if (t <= 7e+127) {
tmp = (-y * t_2) * fma(((t * t) * 0.125), (t * t), 1.0);
} else {
tmp = (((t * t) * t_1) * sqrt((2.0 * z))) * 0.5;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) t_2 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 1.05e+45) tmp = Float64(Float64(t_1 * t_2) * fma(Float64(t * t), 0.5, 1.0)); elseif (t <= 7e+127) tmp = Float64(Float64(Float64(-y) * t_2) * fma(Float64(Float64(t * t) * 0.125), Float64(t * t), 1.0)); else tmp = Float64(Float64(Float64(Float64(t * t) * t_1) * sqrt(Float64(2.0 * z))) * 0.5); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.05e+45], N[(N[(t$95$1 * t$95$2), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7e+127], N[(N[((-y) * t$95$2), $MachinePrecision] * N[(N[(N[(t * t), $MachinePrecision] * 0.125), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(t * t), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
t_2 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 1.05 \cdot 10^{+45}:\\
\;\;\;\;\left(t\_1 \cdot t\_2\right) \cdot \mathsf{fma}\left(t \cdot t, 0.5, 1\right)\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+127}:\\
\;\;\;\;\left(\left(-y\right) \cdot t\_2\right) \cdot \mathsf{fma}\left(\left(t \cdot t\right) \cdot 0.125, t \cdot t, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(t \cdot t\right) \cdot t\_1\right) \cdot \sqrt{2 \cdot z}\right) \cdot 0.5\\
\end{array}
\end{array}
if t < 1.04999999999999997e45Initial program 99.8%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6485.3
Applied rewrites85.3%
if 1.04999999999999997e45 < t < 6.99999999999999956e127Initial program 100.0%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6489.5
Applied rewrites89.5%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6483.6
Applied rewrites83.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6483.6
Applied rewrites83.6%
if 6.99999999999999956e127 < t Initial program 97.1%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in y around inf
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites77.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.1%
Applied rewrites100.0%
(FPCore (x y z t) :precision binary64 (* (- (* 0.5 x) y) (* (sqrt (* 2.0 z)) (fma (fma (* t t) 0.125 0.5) (* t t) 1.0))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * (sqrt((2.0 * z)) * fma(fma((t * t), 0.125, 0.5), (t * t), 1.0));
}
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * Float64(sqrt(Float64(2.0 * z)) * fma(fma(Float64(t * t), 0.125, 0.5), Float64(t * t), 1.0))) end
code[x_, y_, z_, t_] := N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(t * t), $MachinePrecision] * 0.125 + 0.5), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot x - y\right) \cdot \left(\sqrt{2 \cdot z} \cdot \mathsf{fma}\left(\mathsf{fma}\left(t \cdot t, 0.125, 0.5\right), t \cdot t, 1\right)\right)
\end{array}
Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6489.9
Applied rewrites89.9%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-sqrt.f64N/A
sqrt-prodN/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower--.f64N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites90.3%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (+ z z))) (fma (fma 0.125 (* t t) 0.5) (* t t) 1.0)))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z + z))) * fma(fma(0.125, (t * t), 0.5), (t * t), 1.0);
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z + z))) * fma(fma(0.125, Float64(t * t), 0.5), Float64(t * t), 1.0)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(0.125 * N[(t * t), $MachinePrecision] + 0.5), $MachinePrecision] * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z + z}\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.125, t \cdot t, 0.5\right), t \cdot t, 1\right)
\end{array}
Initial program 99.5%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6489.9
Applied rewrites89.9%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6489.9
Applied rewrites89.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 1.4)
(* (sqrt (+ z z)) t_1)
(* (* (* (* t t) t_1) (sqrt (* 2.0 z))) 0.5))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 1.4) {
tmp = sqrt((z + z)) * t_1;
} else {
tmp = (((t * t) * t_1) * 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) :: t_1
real(8) :: tmp
t_1 = (x * 0.5d0) - y
if (t <= 1.4d0) then
tmp = sqrt((z + z)) * t_1
else
tmp = (((t * t) * t_1) * 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 t_1 = (x * 0.5) - y;
double tmp;
if (t <= 1.4) {
tmp = Math.sqrt((z + z)) * t_1;
} else {
tmp = (((t * t) * t_1) * Math.sqrt((2.0 * z))) * 0.5;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 1.4: tmp = math.sqrt((z + z)) * t_1 else: tmp = (((t * t) * t_1) * math.sqrt((2.0 * z))) * 0.5 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 1.4) tmp = Float64(sqrt(Float64(z + z)) * t_1); else tmp = Float64(Float64(Float64(Float64(t * t) * t_1) * sqrt(Float64(2.0 * z))) * 0.5); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if (t <= 1.4) tmp = sqrt((z + z)) * t_1; else tmp = (((t * t) * t_1) * sqrt((2.0 * z))) * 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t, 1.4], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[(N[(t * t), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 1.4:\\
\;\;\;\;\sqrt{z + z} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(t \cdot t\right) \cdot t\_1\right) \cdot \sqrt{2 \cdot z}\right) \cdot 0.5\\
\end{array}
\end{array}
if t < 1.3999999999999999Initial program 99.8%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6467.0
Applied rewrites67.0%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6435.3
Applied rewrites35.3%
lift-*.f64N/A
count-2-revN/A
lower-+.f6435.3
Applied rewrites35.3%
Taylor expanded in x around 0
flip-+N/A
lower--.f64N/A
*-commutativeN/A
lift-*.f6467.0
Applied rewrites67.0%
if 1.3999999999999999 < t Initial program 98.4%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites71.6%
Taylor expanded in y around inf
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites55.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites68.7%
Applied rewrites71.6%
(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-*.f6483.8
Applied rewrites83.8%
(FPCore (x y z t) :precision binary64 (if (<= t 1.65e+20) (* (sqrt (+ z z)) (- (* x 0.5) y)) (* y (* (* (* t t) (sqrt (* 2.0 z))) -0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.65e+20) {
tmp = sqrt((z + z)) * ((x * 0.5) - y);
} else {
tmp = y * (((t * t) * 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.65d+20) then
tmp = sqrt((z + z)) * ((x * 0.5d0) - y)
else
tmp = y * (((t * t) * 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.65e+20) {
tmp = Math.sqrt((z + z)) * ((x * 0.5) - y);
} else {
tmp = y * (((t * t) * Math.sqrt((2.0 * z))) * -0.5);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.65e+20: tmp = math.sqrt((z + z)) * ((x * 0.5) - y) else: tmp = y * (((t * t) * math.sqrt((2.0 * z))) * -0.5) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.65e+20) tmp = Float64(sqrt(Float64(z + z)) * Float64(Float64(x * 0.5) - y)); else tmp = Float64(y * Float64(Float64(Float64(t * t) * 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.65e+20) tmp = sqrt((z + z)) * ((x * 0.5) - y); else tmp = y * (((t * t) * sqrt((2.0 * z))) * -0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.65e+20], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(N[(t * t), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.65 \cdot 10^{+20}:\\
\;\;\;\;\sqrt{z + z} \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\left(\left(t \cdot t\right) \cdot \sqrt{2 \cdot z}\right) \cdot -0.5\right)\\
\end{array}
\end{array}
if t < 1.65e20Initial program 99.8%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6466.2
Applied rewrites66.2%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6435.1
Applied rewrites35.1%
lift-*.f64N/A
count-2-revN/A
lower-+.f6435.1
Applied rewrites35.1%
Taylor expanded in x around 0
flip-+N/A
lower--.f64N/A
*-commutativeN/A
lift-*.f6466.2
Applied rewrites66.2%
if 1.65e20 < t Initial program 98.3%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites74.6%
Taylor expanded in y around inf
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites57.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*l*N/A
*-commutativeN/A
sqrt-prodN/A
lift-sqrt.f64N/A
lift-*.f64N/A
lower-*.f64N/A
pow2N/A
lift-*.f6457.7
lift-*.f64N/A
*-commutativeN/A
lift-*.f6457.7
Applied rewrites57.7%
(FPCore (x y z t) :precision binary64 (if (<= t 2.4e+65) (* (sqrt (+ z z)) (- (* x 0.5) y)) (* (* (* t t) (* x (sqrt (* 2.0 z)))) 0.25)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.4e+65) {
tmp = sqrt((z + z)) * ((x * 0.5) - y);
} else {
tmp = ((t * t) * (x * sqrt((2.0 * z)))) * 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) :: tmp
if (t <= 2.4d+65) then
tmp = sqrt((z + z)) * ((x * 0.5d0) - y)
else
tmp = ((t * t) * (x * sqrt((2.0d0 * z)))) * 0.25d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.4e+65) {
tmp = Math.sqrt((z + z)) * ((x * 0.5) - y);
} else {
tmp = ((t * t) * (x * Math.sqrt((2.0 * z)))) * 0.25;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 2.4e+65: tmp = math.sqrt((z + z)) * ((x * 0.5) - y) else: tmp = ((t * t) * (x * math.sqrt((2.0 * z)))) * 0.25 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 2.4e+65) tmp = Float64(sqrt(Float64(z + z)) * Float64(Float64(x * 0.5) - y)); else tmp = Float64(Float64(Float64(t * t) * Float64(x * sqrt(Float64(2.0 * z)))) * 0.25); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 2.4e+65) tmp = sqrt((z + z)) * ((x * 0.5) - y); else tmp = ((t * t) * (x * sqrt((2.0 * z)))) * 0.25; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 2.4e+65], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t * t), $MachinePrecision] * N[(x * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.4 \cdot 10^{+65}:\\
\;\;\;\;\sqrt{z + z} \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t \cdot t\right) \cdot \left(x \cdot \sqrt{2 \cdot z}\right)\right) \cdot 0.25\\
\end{array}
\end{array}
if t < 2.4000000000000002e65Initial program 99.8%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6463.4
Applied rewrites63.4%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6433.5
Applied rewrites33.5%
lift-*.f64N/A
count-2-revN/A
lower-+.f6433.5
Applied rewrites33.5%
Taylor expanded in x around 0
flip-+N/A
lower--.f64N/A
*-commutativeN/A
lift-*.f6463.4
Applied rewrites63.4%
if 2.4000000000000002e65 < t Initial program 98.0%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites84.6%
Taylor expanded in y around inf
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites64.1%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
sqrt-prodN/A
lift-sqrt.f64N/A
lift-*.f6454.0
Applied rewrites54.0%
(FPCore (x y z t) :precision binary64 (if (<= t 1.65e+20) (* (sqrt (+ z z)) (- (* x 0.5) y)) (* (* (* t t) (* y (sqrt (* 2.0 z)))) -0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.65e+20) {
tmp = sqrt((z + z)) * ((x * 0.5) - y);
} else {
tmp = ((t * t) * (y * 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.65d+20) then
tmp = sqrt((z + z)) * ((x * 0.5d0) - y)
else
tmp = ((t * t) * (y * 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.65e+20) {
tmp = Math.sqrt((z + z)) * ((x * 0.5) - y);
} else {
tmp = ((t * t) * (y * Math.sqrt((2.0 * z)))) * -0.5;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.65e+20: tmp = math.sqrt((z + z)) * ((x * 0.5) - y) else: tmp = ((t * t) * (y * math.sqrt((2.0 * z)))) * -0.5 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.65e+20) tmp = Float64(sqrt(Float64(z + z)) * Float64(Float64(x * 0.5) - y)); else tmp = Float64(Float64(Float64(t * t) * Float64(y * 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.65e+20) tmp = sqrt((z + z)) * ((x * 0.5) - y); else tmp = ((t * t) * (y * sqrt((2.0 * z)))) * -0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.65e+20], N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t * t), $MachinePrecision] * N[(y * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.65 \cdot 10^{+20}:\\
\;\;\;\;\sqrt{z + z} \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(t \cdot t\right) \cdot \left(y \cdot \sqrt{2 \cdot z}\right)\right) \cdot -0.5\\
\end{array}
\end{array}
if t < 1.65e20Initial program 99.8%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6466.2
Applied rewrites66.2%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6435.1
Applied rewrites35.1%
lift-*.f64N/A
count-2-revN/A
lower-+.f6435.1
Applied rewrites35.1%
Taylor expanded in x around 0
flip-+N/A
lower--.f64N/A
*-commutativeN/A
lift-*.f6466.2
Applied rewrites66.2%
if 1.65e20 < t Initial program 98.3%
Taylor expanded in t around 0
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-sqrt.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites74.6%
Taylor expanded in y around inf
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites57.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
sqrt-prodN/A
lift-sqrt.f64N/A
lift-*.f64N/A
lower-*.f6451.2
lift-*.f64N/A
*-commutativeN/A
lift-*.f6451.2
Applied rewrites51.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z z))))
(if (or (<= x -2.05e-6) (not (<= x 2e-37)))
(* t_1 (* x 0.5))
(* t_1 (- y)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double tmp;
if ((x <= -2.05e-6) || !(x <= 2e-37)) {
tmp = t_1 * (x * 0.5);
} else {
tmp = t_1 * -y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z + z))
if ((x <= (-2.05d-6)) .or. (.not. (x <= 2d-37))) then
tmp = t_1 * (x * 0.5d0)
else
tmp = t_1 * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z + z));
double tmp;
if ((x <= -2.05e-6) || !(x <= 2e-37)) {
tmp = t_1 * (x * 0.5);
} else {
tmp = t_1 * -y;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z + z)) tmp = 0 if (x <= -2.05e-6) or not (x <= 2e-37): tmp = t_1 * (x * 0.5) else: tmp = t_1 * -y return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) tmp = 0.0 if ((x <= -2.05e-6) || !(x <= 2e-37)) tmp = Float64(t_1 * Float64(x * 0.5)); else tmp = Float64(t_1 * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z + z)); tmp = 0.0; if ((x <= -2.05e-6) || ~((x <= 2e-37))) tmp = t_1 * (x * 0.5); else tmp = t_1 * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[x, -2.05e-6], N[Not[LessEqual[x, 2e-37]], $MachinePrecision]], N[(t$95$1 * N[(x * 0.5), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z + z}\\
\mathbf{if}\;x \leq -2.05 \cdot 10^{-6} \lor \neg \left(x \leq 2 \cdot 10^{-37}\right):\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(-y\right)\\
\end{array}
\end{array}
if x < -2.0499999999999999e-6 or 2.00000000000000013e-37 < x Initial program 99.9%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6453.9
Applied rewrites53.9%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6413.0
Applied rewrites13.0%
lift-*.f64N/A
count-2-revN/A
lower-+.f6413.0
Applied rewrites13.0%
Taylor expanded in x around inf
flip-+N/A
*-commutativeN/A
lift-*.f6443.0
Applied rewrites43.0%
if -2.0499999999999999e-6 < x < 2.00000000000000013e-37Initial program 99.1%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6452.6
Applied rewrites52.6%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6444.5
Applied rewrites44.5%
lift-*.f64N/A
count-2-revN/A
lower-+.f6444.5
Applied rewrites44.5%
Final simplification43.7%
(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.5%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6453.2
Applied rewrites53.2%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6428.9
Applied rewrites28.9%
lift-*.f64N/A
count-2-revN/A
lower-+.f6428.9
Applied rewrites28.9%
Taylor expanded in x around 0
flip-+N/A
lower--.f64N/A
*-commutativeN/A
lift-*.f6453.2
Applied rewrites53.2%
(FPCore (x y z t) :precision binary64 (* (sqrt (+ z z)) (- y)))
double code(double x, double y, double z, double t) {
return sqrt((z + z)) * -y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((z + z)) * -y
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z + z)) * -y;
}
def code(x, y, z, t): return math.sqrt((z + z)) * -y
function code(x, y, z, t) return Float64(sqrt(Float64(z + z)) * Float64(-y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z + z)) * -y; end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z + z} \cdot \left(-y\right)
\end{array}
Initial program 99.5%
Taylor expanded in t around 0
associate-*r*N/A
sqrt-prodN/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6453.2
Applied rewrites53.2%
Taylor expanded in x around 0
mul-1-negN/A
lift-neg.f6428.9
Applied rewrites28.9%
lift-*.f64N/A
count-2-revN/A
lower-+.f6428.9
Applied rewrites28.9%
herbie shell --seed 2025085
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
:alt
(! :herbie-platform default (* (* (- (* x 1/2) y) (sqrt (* z 2))) (pow (exp 1) (/ (* t t) 2))))
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))