
(FPCore (x y z t) :precision binary64 (* (* (- (* x 1/2) y) (sqrt (* z 2))) (exp (/ (* t t) 2))))
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 * 1/2), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (* (- (* x 1/2) y) (sqrt (* z 2))) (exp (/ (* t t) 2))))
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 * 1/2), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot \frac{1}{2} - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
(FPCore (x y z t) :precision binary64 (* (- (* 1/2 x) y) (sqrt (* (exp (* t t)) (+ z z)))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * sqrt((exp((t * t)) * (z + z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((0.5d0 * x) - y) * sqrt((exp((t * t)) * (z + z)))
end function
public static double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * Math.sqrt((Math.exp((t * t)) * (z + z)));
}
def code(x, y, z, t): return ((0.5 * x) - y) * math.sqrt((math.exp((t * t)) * (z + z)))
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(exp(Float64(t * t)) * Float64(z + z)))) end
function tmp = code(x, y, z, t) tmp = ((0.5 * x) - y) * sqrt((exp((t * t)) * (z + z))); end
code[x_, y_, z_, t_] := N[(N[(N[(1/2 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision] * N[(z + z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\left(\frac{1}{2} \cdot x - y\right) \cdot \sqrt{e^{t \cdot t} \cdot \left(z + z\right)}
Initial program 99.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
exp-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6499.8%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.8%
Applied rewrites99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z z))) (t_2 (* (fabs t) (fabs t))))
(if (<= (fabs t) 5188146770730811/72057594037927936)
(* (* (- (* 1/2 x) y) t_1) (- (* t_2 1/2) -1))
(if (<=
(fabs t)
114999999999999997377225245734177625043124954484653241178190190737365693104128)
(* (* -1 y) (sqrt (* (exp t_2) (+ z z))))
(* (* t_1 (- (* x 1/2) y)) (+ 1 (* 1/2 (sqrt (* t_2 t_2)))))))))double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double t_2 = fabs(t) * fabs(t);
double tmp;
if (fabs(t) <= 0.072) {
tmp = (((0.5 * x) - y) * t_1) * ((t_2 * 0.5) - -1.0);
} else if (fabs(t) <= 1.15e+77) {
tmp = (-1.0 * y) * sqrt((exp(t_2) * (z + z)));
} else {
tmp = (t_1 * ((x * 0.5) - y)) * (1.0 + (0.5 * sqrt((t_2 * 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 = abs(t) * abs(t)
if (abs(t) <= 0.072d0) then
tmp = (((0.5d0 * x) - y) * t_1) * ((t_2 * 0.5d0) - (-1.0d0))
else if (abs(t) <= 1.15d+77) then
tmp = ((-1.0d0) * y) * sqrt((exp(t_2) * (z + z)))
else
tmp = (t_1 * ((x * 0.5d0) - y)) * (1.0d0 + (0.5d0 * sqrt((t_2 * 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 = Math.abs(t) * Math.abs(t);
double tmp;
if (Math.abs(t) <= 0.072) {
tmp = (((0.5 * x) - y) * t_1) * ((t_2 * 0.5) - -1.0);
} else if (Math.abs(t) <= 1.15e+77) {
tmp = (-1.0 * y) * Math.sqrt((Math.exp(t_2) * (z + z)));
} else {
tmp = (t_1 * ((x * 0.5) - y)) * (1.0 + (0.5 * Math.sqrt((t_2 * t_2))));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z + z)) t_2 = math.fabs(t) * math.fabs(t) tmp = 0 if math.fabs(t) <= 0.072: tmp = (((0.5 * x) - y) * t_1) * ((t_2 * 0.5) - -1.0) elif math.fabs(t) <= 1.15e+77: tmp = (-1.0 * y) * math.sqrt((math.exp(t_2) * (z + z))) else: tmp = (t_1 * ((x * 0.5) - y)) * (1.0 + (0.5 * math.sqrt((t_2 * t_2)))) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) t_2 = Float64(abs(t) * abs(t)) tmp = 0.0 if (abs(t) <= 0.072) tmp = Float64(Float64(Float64(Float64(0.5 * x) - y) * t_1) * Float64(Float64(t_2 * 0.5) - -1.0)); elseif (abs(t) <= 1.15e+77) tmp = Float64(Float64(-1.0 * y) * sqrt(Float64(exp(t_2) * Float64(z + z)))); else tmp = Float64(Float64(t_1 * Float64(Float64(x * 0.5) - y)) * Float64(1.0 + Float64(0.5 * sqrt(Float64(t_2 * t_2))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z + z)); t_2 = abs(t) * abs(t); tmp = 0.0; if (abs(t) <= 0.072) tmp = (((0.5 * x) - y) * t_1) * ((t_2 * 0.5) - -1.0); elseif (abs(t) <= 1.15e+77) tmp = (-1.0 * y) * sqrt((exp(t_2) * (z + z))); else tmp = (t_1 * ((x * 0.5) - y)) * (1.0 + (0.5 * sqrt((t_2 * 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[Abs[t], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[t], $MachinePrecision], 5188146770730811/72057594037927936], N[(N[(N[(N[(1/2 * x), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision] * N[(N[(t$95$2 * 1/2), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 114999999999999997377225245734177625043124954484653241178190190737365693104128], N[(N[(-1 * y), $MachinePrecision] * N[Sqrt[N[(N[Exp[t$95$2], $MachinePrecision] * N[(z + z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[(N[(x * 1/2), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] * N[(1 + N[(1/2 * N[Sqrt[N[(t$95$2 * t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \sqrt{z + z}\\
t_2 := \left|t\right| \cdot \left|t\right|\\
\mathbf{if}\;\left|t\right| \leq \frac{5188146770730811}{72057594037927936}:\\
\;\;\;\;\left(\left(\frac{1}{2} \cdot x - y\right) \cdot t\_1\right) \cdot \left(t\_2 \cdot \frac{1}{2} - -1\right)\\
\mathbf{elif}\;\left|t\right| \leq 114999999999999997377225245734177625043124954484653241178190190737365693104128:\\
\;\;\;\;\left(-1 \cdot y\right) \cdot \sqrt{e^{t\_2} \cdot \left(z + z\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 \cdot \left(x \cdot \frac{1}{2} - y\right)\right) \cdot \left(1 + \frac{1}{2} \cdot \sqrt{t\_2 \cdot t\_2}\right)\\
\end{array}
if t < 0.071999999999999995Initial program 99.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
exp-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6499.8%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.8%
Applied rewrites99.8%
Applied rewrites99.5%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6485.7%
Applied rewrites85.7%
Applied rewrites85.7%
if 0.071999999999999995 < t < 1.15e77Initial program 99.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
exp-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6499.8%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.8%
Applied rewrites99.8%
Taylor expanded in x around 0
lower-*.f6463.2%
Applied rewrites63.2%
if 1.15e77 < t Initial program 99.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
exp-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6499.8%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.8%
Applied rewrites99.8%
Applied rewrites99.5%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6485.7%
Applied rewrites85.7%
lift-pow.f64N/A
pow2N/A
fabs-sqrN/A
rem-sqrt-square-revN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f64N/A
lower-*.f64N/A
lower-*.f6490.4%
Applied rewrites90.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (+ z z))) (t_2 (* (fabs t) (fabs t))))
(if (<=
(fabs t)
114000000000000000865428808608050761646285597494424303650608906106020105814016)
(* (* (- (* t_2 1/2) -1) (- (* 1/2 x) y)) t_1)
(* (* t_1 (- (* x 1/2) y)) (+ 1 (* 1/2 (sqrt (* t_2 t_2))))))))double code(double x, double y, double z, double t) {
double t_1 = sqrt((z + z));
double t_2 = fabs(t) * fabs(t);
double tmp;
if (fabs(t) <= 1.14e+77) {
tmp = (((t_2 * 0.5) - -1.0) * ((0.5 * x) - y)) * t_1;
} else {
tmp = (t_1 * ((x * 0.5) - y)) * (1.0 + (0.5 * sqrt((t_2 * 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 = abs(t) * abs(t)
if (abs(t) <= 1.14d+77) then
tmp = (((t_2 * 0.5d0) - (-1.0d0)) * ((0.5d0 * x) - y)) * t_1
else
tmp = (t_1 * ((x * 0.5d0) - y)) * (1.0d0 + (0.5d0 * sqrt((t_2 * 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 = Math.abs(t) * Math.abs(t);
double tmp;
if (Math.abs(t) <= 1.14e+77) {
tmp = (((t_2 * 0.5) - -1.0) * ((0.5 * x) - y)) * t_1;
} else {
tmp = (t_1 * ((x * 0.5) - y)) * (1.0 + (0.5 * Math.sqrt((t_2 * t_2))));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z + z)) t_2 = math.fabs(t) * math.fabs(t) tmp = 0 if math.fabs(t) <= 1.14e+77: tmp = (((t_2 * 0.5) - -1.0) * ((0.5 * x) - y)) * t_1 else: tmp = (t_1 * ((x * 0.5) - y)) * (1.0 + (0.5 * math.sqrt((t_2 * t_2)))) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z + z)) t_2 = Float64(abs(t) * abs(t)) tmp = 0.0 if (abs(t) <= 1.14e+77) tmp = Float64(Float64(Float64(Float64(t_2 * 0.5) - -1.0) * Float64(Float64(0.5 * x) - y)) * t_1); else tmp = Float64(Float64(t_1 * Float64(Float64(x * 0.5) - y)) * Float64(1.0 + Float64(0.5 * sqrt(Float64(t_2 * t_2))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z + z)); t_2 = abs(t) * abs(t); tmp = 0.0; if (abs(t) <= 1.14e+77) tmp = (((t_2 * 0.5) - -1.0) * ((0.5 * x) - y)) * t_1; else tmp = (t_1 * ((x * 0.5) - y)) * (1.0 + (0.5 * sqrt((t_2 * 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[Abs[t], $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[t], $MachinePrecision], 114000000000000000865428808608050761646285597494424303650608906106020105814016], N[(N[(N[(N[(t$95$2 * 1/2), $MachinePrecision] - -1), $MachinePrecision] * N[(N[(1/2 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(t$95$1 * N[(N[(x * 1/2), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] * N[(1 + N[(1/2 * N[Sqrt[N[(t$95$2 * t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \sqrt{z + z}\\
t_2 := \left|t\right| \cdot \left|t\right|\\
\mathbf{if}\;\left|t\right| \leq 114000000000000000865428808608050761646285597494424303650608906106020105814016:\\
\;\;\;\;\left(\left(t\_2 \cdot \frac{1}{2} - -1\right) \cdot \left(\frac{1}{2} \cdot x - y\right)\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 \cdot \left(x \cdot \frac{1}{2} - y\right)\right) \cdot \left(1 + \frac{1}{2} \cdot \sqrt{t\_2 \cdot t\_2}\right)\\
\end{array}
if t < 1.14e77Initial program 99.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
exp-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6499.8%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.8%
Applied rewrites99.8%
Applied rewrites99.5%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6485.7%
Applied rewrites85.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.9%
if 1.14e77 < t Initial program 99.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
exp-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6499.8%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.8%
Applied rewrites99.8%
Applied rewrites99.5%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6485.7%
Applied rewrites85.7%
lift-pow.f64N/A
pow2N/A
fabs-sqrN/A
rem-sqrt-square-revN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f64N/A
lower-*.f64N/A
lower-*.f6490.4%
Applied rewrites90.4%
(FPCore (x y z t) :precision binary64 (* (* (- (* (* t t) 1/2) -1) (- (* 1/2 x) y)) (sqrt (+ z z))))
double code(double x, double y, double z, double t) {
return ((((t * t) * 0.5) - -1.0) * ((0.5 * x) - y)) * sqrt((z + z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((((t * t) * 0.5d0) - (-1.0d0)) * ((0.5d0 * x) - y)) * sqrt((z + z))
end function
public static double code(double x, double y, double z, double t) {
return ((((t * t) * 0.5) - -1.0) * ((0.5 * x) - y)) * Math.sqrt((z + z));
}
def code(x, y, z, t): return ((((t * t) * 0.5) - -1.0) * ((0.5 * x) - y)) * math.sqrt((z + z))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(Float64(t * t) * 0.5) - -1.0) * Float64(Float64(0.5 * x) - y)) * sqrt(Float64(z + z))) end
function tmp = code(x, y, z, t) tmp = ((((t * t) * 0.5) - -1.0) * ((0.5 * x) - y)) * sqrt((z + z)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(t * t), $MachinePrecision] * 1/2), $MachinePrecision] - -1), $MachinePrecision] * N[(N[(1/2 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\left(\left(\left(t \cdot t\right) \cdot \frac{1}{2} - -1\right) \cdot \left(\frac{1}{2} \cdot x - y\right)\right) \cdot \sqrt{z + z}
Initial program 99.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
exp-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-exp.f6499.8%
lift-*.f64N/A
*-commutativeN/A
count-2-revN/A
lower-+.f6499.8%
Applied rewrites99.8%
Applied rewrites99.5%
Taylor expanded in t around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6485.7%
Applied rewrites85.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites87.9%
(FPCore (x y z t)
:precision binary64
(if (<= (fabs t) 1770887431076117/73786976294838206464)
(* (- (* x 1/2) y) (* 1 (sqrt (+ z z))))
(if (<=
(fabs t)
255000000000000002631991338672421740743079323854364804099691828430959303615898816521146967894851781029838828254694268021323551226807374148894617343277586228235347024330191602629918229981433693836541736577152926552980098253848576)
(* (* z (* (sqrt (/ 2 z)) (- (* 1/2 x) y))) 1)
(* (* (sqrt (sqrt (* (+ z z) (+ z z)))) (- y)) 1))))double code(double x, double y, double z, double t) {
double tmp;
if (fabs(t) <= 2.4e-5) {
tmp = ((x * 0.5) - y) * (1.0 * sqrt((z + z)));
} else if (fabs(t) <= 2.55e+227) {
tmp = (z * (sqrt((2.0 / z)) * ((0.5 * x) - y))) * 1.0;
} else {
tmp = (sqrt(sqrt(((z + z) * (z + z)))) * -y) * 1.0;
}
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 (abs(t) <= 2.4d-5) then
tmp = ((x * 0.5d0) - y) * (1.0d0 * sqrt((z + z)))
else if (abs(t) <= 2.55d+227) then
tmp = (z * (sqrt((2.0d0 / z)) * ((0.5d0 * x) - y))) * 1.0d0
else
tmp = (sqrt(sqrt(((z + z) * (z + z)))) * -y) * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (Math.abs(t) <= 2.4e-5) {
tmp = ((x * 0.5) - y) * (1.0 * Math.sqrt((z + z)));
} else if (Math.abs(t) <= 2.55e+227) {
tmp = (z * (Math.sqrt((2.0 / z)) * ((0.5 * x) - y))) * 1.0;
} else {
tmp = (Math.sqrt(Math.sqrt(((z + z) * (z + z)))) * -y) * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if math.fabs(t) <= 2.4e-5: tmp = ((x * 0.5) - y) * (1.0 * math.sqrt((z + z))) elif math.fabs(t) <= 2.55e+227: tmp = (z * (math.sqrt((2.0 / z)) * ((0.5 * x) - y))) * 1.0 else: tmp = (math.sqrt(math.sqrt(((z + z) * (z + z)))) * -y) * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (abs(t) <= 2.4e-5) tmp = Float64(Float64(Float64(x * 0.5) - y) * Float64(1.0 * sqrt(Float64(z + z)))); elseif (abs(t) <= 2.55e+227) tmp = Float64(Float64(z * Float64(sqrt(Float64(2.0 / z)) * Float64(Float64(0.5 * x) - y))) * 1.0); else tmp = Float64(Float64(sqrt(sqrt(Float64(Float64(z + z) * Float64(z + z)))) * Float64(-y)) * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (abs(t) <= 2.4e-5) tmp = ((x * 0.5) - y) * (1.0 * sqrt((z + z))); elseif (abs(t) <= 2.55e+227) tmp = (z * (sqrt((2.0 / z)) * ((0.5 * x) - y))) * 1.0; else tmp = (sqrt(sqrt(((z + z) * (z + z)))) * -y) * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[Abs[t], $MachinePrecision], 1770887431076117/73786976294838206464], N[(N[(N[(x * 1/2), $MachinePrecision] - y), $MachinePrecision] * N[(1 * N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 255000000000000002631991338672421740743079323854364804099691828430959303615898816521146967894851781029838828254694268021323551226807374148894617343277586228235347024330191602629918229981433693836541736577152926552980098253848576], N[(N[(z * N[(N[Sqrt[N[(2 / z), $MachinePrecision]], $MachinePrecision] * N[(N[(1/2 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1), $MachinePrecision], N[(N[(N[Sqrt[N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[(z + z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision] * 1), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\left|t\right| \leq \frac{1770887431076117}{73786976294838206464}:\\
\;\;\;\;\left(x \cdot \frac{1}{2} - y\right) \cdot \left(1 \cdot \sqrt{z + z}\right)\\
\mathbf{elif}\;\left|t\right| \leq 255000000000000002631991338672421740743079323854364804099691828430959303615898816521146967894851781029838828254694268021323551226807374148894617343277586228235347024330191602629918229981433693836541736577152926552980098253848576:\\
\;\;\;\;\left(z \cdot \left(\sqrt{\frac{2}{z}} \cdot \left(\frac{1}{2} \cdot x - y\right)\right)\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\sqrt{\left(z + z\right) \cdot \left(z + z\right)}} \cdot \left(-y\right)\right) \cdot 1\\
\end{array}
if t < 2.4000000000000001e-5Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6456.7%
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f6456.7%
Applied rewrites56.7%
if 2.4000000000000001e-5 < t < 2.55e227Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6456.5%
Applied rewrites56.5%
if 2.55e227 < t Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6429.6%
Applied rewrites29.6%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
count-2-revN/A
lift-+.f64N/A
pow1/2N/A
lift-sqrt.f64N/A
lower-neg.f6429.6%
Applied rewrites29.6%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6427.8%
Applied rewrites27.8%
(FPCore (x y z t)
:precision binary64
(if (<=
(exp (/ (* t t) 2))
28999999999999998363139381331051510536143881206408543710211823249733286587361152019470147911680)
(* (- (* x 1/2) y) (* 1 (sqrt (+ z z))))
(* (* (sqrt (sqrt (* (+ z z) (+ z z)))) (- y)) 1)))double code(double x, double y, double z, double t) {
double tmp;
if (exp(((t * t) / 2.0)) <= 2.9e+94) {
tmp = ((x * 0.5) - y) * (1.0 * sqrt((z + z)));
} else {
tmp = (sqrt(sqrt(((z + z) * (z + z)))) * -y) * 1.0;
}
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.9d+94) then
tmp = ((x * 0.5d0) - y) * (1.0d0 * sqrt((z + z)))
else
tmp = (sqrt(sqrt(((z + z) * (z + z)))) * -y) * 1.0d0
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.9e+94) {
tmp = ((x * 0.5) - y) * (1.0 * Math.sqrt((z + z)));
} else {
tmp = (Math.sqrt(Math.sqrt(((z + z) * (z + z)))) * -y) * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if math.exp(((t * t) / 2.0)) <= 2.9e+94: tmp = ((x * 0.5) - y) * (1.0 * math.sqrt((z + z))) else: tmp = (math.sqrt(math.sqrt(((z + z) * (z + z)))) * -y) * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (exp(Float64(Float64(t * t) / 2.0)) <= 2.9e+94) tmp = Float64(Float64(Float64(x * 0.5) - y) * Float64(1.0 * sqrt(Float64(z + z)))); else tmp = Float64(Float64(sqrt(sqrt(Float64(Float64(z + z) * Float64(z + z)))) * Float64(-y)) * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (exp(((t * t) / 2.0)) <= 2.9e+94) tmp = ((x * 0.5) - y) * (1.0 * sqrt((z + z))); else tmp = (sqrt(sqrt(((z + z) * (z + z)))) * -y) * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[Exp[N[(N[(t * t), $MachinePrecision] / 2), $MachinePrecision]], $MachinePrecision], 28999999999999998363139381331051510536143881206408543710211823249733286587361152019470147911680], N[(N[(N[(x * 1/2), $MachinePrecision] - y), $MachinePrecision] * N[(1 * N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[Sqrt[N[(N[(z + z), $MachinePrecision] * N[(z + z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision] * 1), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;e^{\frac{t \cdot t}{2}} \leq 28999999999999998363139381331051510536143881206408543710211823249733286587361152019470147911680:\\
\;\;\;\;\left(x \cdot \frac{1}{2} - y\right) \cdot \left(1 \cdot \sqrt{z + z}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{\sqrt{\left(z + z\right) \cdot \left(z + z\right)}} \cdot \left(-y\right)\right) \cdot 1\\
\end{array}
if (exp.f64 (/.f64 (*.f64 t t) #s(literal 2 binary64))) < 2.8999999999999998e94Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6456.7%
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f6456.7%
Applied rewrites56.7%
if 2.8999999999999998e94 < (exp.f64 (/.f64 (*.f64 t t) #s(literal 2 binary64))) Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6429.6%
Applied rewrites29.6%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
count-2-revN/A
lift-+.f64N/A
pow1/2N/A
lift-sqrt.f64N/A
lower-neg.f6429.6%
Applied rewrites29.6%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6427.8%
Applied rewrites27.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (/ 2 z))))
(if (<= (fabs t) 17199999999999999496683520)
(* (- (* x 1/2) y) (* 1 (sqrt (+ z z))))
(if (<=
(fabs t)
14199999999999999638195998498193324196805236950177319794238247704009338647377528415507535715657374835872707053017639867579697448519847674783154831048254589302103907213607358465998220156406064333455360)
(* (* z (* -1 (* y t_1))) 1)
(* (* z (* 1/2 (* x t_1))) 1)))))double code(double x, double y, double z, double t) {
double t_1 = sqrt((2.0 / z));
double tmp;
if (fabs(t) <= 1.72e+25) {
tmp = ((x * 0.5) - y) * (1.0 * sqrt((z + z)));
} else if (fabs(t) <= 1.42e+199) {
tmp = (z * (-1.0 * (y * t_1))) * 1.0;
} else {
tmp = (z * (0.5 * (x * t_1))) * 1.0;
}
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((2.0d0 / z))
if (abs(t) <= 1.72d+25) then
tmp = ((x * 0.5d0) - y) * (1.0d0 * sqrt((z + z)))
else if (abs(t) <= 1.42d+199) then
tmp = (z * ((-1.0d0) * (y * t_1))) * 1.0d0
else
tmp = (z * (0.5d0 * (x * t_1))) * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((2.0 / z));
double tmp;
if (Math.abs(t) <= 1.72e+25) {
tmp = ((x * 0.5) - y) * (1.0 * Math.sqrt((z + z)));
} else if (Math.abs(t) <= 1.42e+199) {
tmp = (z * (-1.0 * (y * t_1))) * 1.0;
} else {
tmp = (z * (0.5 * (x * t_1))) * 1.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((2.0 / z)) tmp = 0 if math.fabs(t) <= 1.72e+25: tmp = ((x * 0.5) - y) * (1.0 * math.sqrt((z + z))) elif math.fabs(t) <= 1.42e+199: tmp = (z * (-1.0 * (y * t_1))) * 1.0 else: tmp = (z * (0.5 * (x * t_1))) * 1.0 return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(2.0 / z)) tmp = 0.0 if (abs(t) <= 1.72e+25) tmp = Float64(Float64(Float64(x * 0.5) - y) * Float64(1.0 * sqrt(Float64(z + z)))); elseif (abs(t) <= 1.42e+199) tmp = Float64(Float64(z * Float64(-1.0 * Float64(y * t_1))) * 1.0); else tmp = Float64(Float64(z * Float64(0.5 * Float64(x * t_1))) * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((2.0 / z)); tmp = 0.0; if (abs(t) <= 1.72e+25) tmp = ((x * 0.5) - y) * (1.0 * sqrt((z + z))); elseif (abs(t) <= 1.42e+199) tmp = (z * (-1.0 * (y * t_1))) * 1.0; else tmp = (z * (0.5 * (x * t_1))) * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(2 / z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Abs[t], $MachinePrecision], 17199999999999999496683520], N[(N[(N[(x * 1/2), $MachinePrecision] - y), $MachinePrecision] * N[(1 * N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[t], $MachinePrecision], 14199999999999999638195998498193324196805236950177319794238247704009338647377528415507535715657374835872707053017639867579697448519847674783154831048254589302103907213607358465998220156406064333455360], N[(N[(z * N[(-1 * N[(y * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1), $MachinePrecision], N[(N[(z * N[(1/2 * N[(x * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \sqrt{\frac{2}{z}}\\
\mathbf{if}\;\left|t\right| \leq 17199999999999999496683520:\\
\;\;\;\;\left(x \cdot \frac{1}{2} - y\right) \cdot \left(1 \cdot \sqrt{z + z}\right)\\
\mathbf{elif}\;\left|t\right| \leq 14199999999999999638195998498193324196805236950177319794238247704009338647377528415507535715657374835872707053017639867579697448519847674783154831048254589302103907213607358465998220156406064333455360:\\
\;\;\;\;\left(z \cdot \left(-1 \cdot \left(y \cdot t\_1\right)\right)\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot \left(\frac{1}{2} \cdot \left(x \cdot t\_1\right)\right)\right) \cdot 1\\
\end{array}
if t < 1.7199999999999999e25Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6456.7%
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f6456.7%
Applied rewrites56.7%
if 1.7199999999999999e25 < t < 1.42e199Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6456.5%
Applied rewrites56.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6429.6%
Applied rewrites29.6%
if 1.42e199 < t Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6456.5%
Applied rewrites56.5%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6429.9%
Applied rewrites29.9%
(FPCore (x y z t)
:precision binary64
(if (<=
y
-1000000000000000068957567536844582937679826098352437099093782830596656320642208754566186799616905285426599982929417458880300383900478261195703581718577367397759832385751351296)
(* (* z (* -1 (* y (sqrt (/ 2 z))))) 1)
(* (- (* x 1/2) y) (* 1 (sqrt (+ z z))))))double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1e+174) {
tmp = (z * (-1.0 * (y * sqrt((2.0 / z))))) * 1.0;
} else {
tmp = ((x * 0.5) - y) * (1.0 * sqrt((z + z)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1d+174)) then
tmp = (z * ((-1.0d0) * (y * sqrt((2.0d0 / z))))) * 1.0d0
else
tmp = ((x * 0.5d0) - y) * (1.0d0 * sqrt((z + z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1e+174) {
tmp = (z * (-1.0 * (y * Math.sqrt((2.0 / z))))) * 1.0;
} else {
tmp = ((x * 0.5) - y) * (1.0 * Math.sqrt((z + z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1e+174: tmp = (z * (-1.0 * (y * math.sqrt((2.0 / z))))) * 1.0 else: tmp = ((x * 0.5) - y) * (1.0 * math.sqrt((z + z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1e+174) tmp = Float64(Float64(z * Float64(-1.0 * Float64(y * sqrt(Float64(2.0 / z))))) * 1.0); else tmp = Float64(Float64(Float64(x * 0.5) - y) * Float64(1.0 * sqrt(Float64(z + z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1e+174) tmp = (z * (-1.0 * (y * sqrt((2.0 / z))))) * 1.0; else tmp = ((x * 0.5) - y) * (1.0 * sqrt((z + z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1000000000000000068957567536844582937679826098352437099093782830596656320642208754566186799616905285426599982929417458880300383900478261195703581718577367397759832385751351296], N[(N[(z * N[(-1 * N[(y * N[Sqrt[N[(2 / z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1), $MachinePrecision], N[(N[(N[(x * 1/2), $MachinePrecision] - y), $MachinePrecision] * N[(1 * N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;y \leq -1000000000000000068957567536844582937679826098352437099093782830596656320642208754566186799616905285426599982929417458880300383900478261195703581718577367397759832385751351296:\\
\;\;\;\;\left(z \cdot \left(-1 \cdot \left(y \cdot \sqrt{\frac{2}{z}}\right)\right)\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \frac{1}{2} - y\right) \cdot \left(1 \cdot \sqrt{z + z}\right)\\
\end{array}
if y < -1.0000000000000001e174Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f6456.5%
Applied rewrites56.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-/.f6429.6%
Applied rewrites29.6%
if -1.0000000000000001e174 < y Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6456.7%
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f6456.7%
Applied rewrites56.7%
(FPCore (x y z t) :precision binary64 (* (- (* x 1/2) y) (* 1 (sqrt (+ z z)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * (1.0 * sqrt((z + z)));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * 0.5d0) - y) * (1.0d0 * sqrt((z + z)))
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * (1.0 * Math.sqrt((z + z)));
}
def code(x, y, z, t): return ((x * 0.5) - y) * (1.0 * math.sqrt((z + z)))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * Float64(1.0 * sqrt(Float64(z + z)))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * (1.0 * sqrt((z + z))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 1/2), $MachinePrecision] - y), $MachinePrecision] * N[(1 * N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x \cdot \frac{1}{2} - y\right) \cdot \left(1 \cdot \sqrt{z + z}\right)
Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6456.7%
lift-*.f64N/A
*-commutativeN/A
count-2N/A
lift-+.f6456.7%
Applied rewrites56.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* (sqrt (+ z z)) (- y)) 1)))
(if (<=
y
-5410876812138479/31828687130226345097944463881396533766429193651030253916189694521162207808802136034115584)
t_1
(if (<=
y
4113761393303015/411376139330301510538742295639337626245683966408394965837152256)
(* (* 1/2 (* x (sqrt (* 2 z)))) 1)
t_1))))double code(double x, double y, double z, double t) {
double t_1 = (sqrt((z + z)) * -y) * 1.0;
double tmp;
if (y <= -1.7e-73) {
tmp = t_1;
} else if (y <= 1e-47) {
tmp = (0.5 * (x * sqrt((2.0 * z)))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (sqrt((z + z)) * -y) * 1.0d0
if (y <= (-1.7d-73)) then
tmp = t_1
else if (y <= 1d-47) then
tmp = (0.5d0 * (x * sqrt((2.0d0 * z)))) * 1.0d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (Math.sqrt((z + z)) * -y) * 1.0;
double tmp;
if (y <= -1.7e-73) {
tmp = t_1;
} else if (y <= 1e-47) {
tmp = (0.5 * (x * Math.sqrt((2.0 * z)))) * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (math.sqrt((z + z)) * -y) * 1.0 tmp = 0 if y <= -1.7e-73: tmp = t_1 elif y <= 1e-47: tmp = (0.5 * (x * math.sqrt((2.0 * z)))) * 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(sqrt(Float64(z + z)) * Float64(-y)) * 1.0) tmp = 0.0 if (y <= -1.7e-73) tmp = t_1; elseif (y <= 1e-47) tmp = Float64(Float64(0.5 * Float64(x * sqrt(Float64(2.0 * z)))) * 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (sqrt((z + z)) * -y) * 1.0; tmp = 0.0; if (y <= -1.7e-73) tmp = t_1; elseif (y <= 1e-47) tmp = (0.5 * (x * sqrt((2.0 * z)))) * 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision] * 1), $MachinePrecision]}, If[LessEqual[y, -5410876812138479/31828687130226345097944463881396533766429193651030253916189694521162207808802136034115584], t$95$1, If[LessEqual[y, 4113761393303015/411376139330301510538742295639337626245683966408394965837152256], N[(N[(1/2 * N[(x * N[Sqrt[N[(2 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(\sqrt{z + z} \cdot \left(-y\right)\right) \cdot 1\\
\mathbf{if}\;y \leq \frac{-5410876812138479}{31828687130226345097944463881396533766429193651030253916189694521162207808802136034115584}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq \frac{4113761393303015}{411376139330301510538742295639337626245683966408394965837152256}:\\
\;\;\;\;\left(\frac{1}{2} \cdot \left(x \cdot \sqrt{2 \cdot z}\right)\right) \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -1.7000000000000001e-73 or 9.9999999999999997e-48 < y Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6429.6%
Applied rewrites29.6%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
count-2-revN/A
lift-+.f64N/A
pow1/2N/A
lift-sqrt.f64N/A
lower-neg.f6429.6%
Applied rewrites29.6%
if -1.7000000000000001e-73 < y < 9.9999999999999997e-48Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
Taylor expanded in x around inf
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6429.9%
Applied rewrites29.9%
(FPCore (x y z t) :precision binary64 (* (* (sqrt (+ z z)) (- y)) 1))
double code(double x, double y, double z, double t) {
return (sqrt((z + z)) * -y) * 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 = (sqrt((z + z)) * -y) * 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return (Math.sqrt((z + z)) * -y) * 1.0;
}
def code(x, y, z, t): return (math.sqrt((z + z)) * -y) * 1.0
function code(x, y, z, t) return Float64(Float64(sqrt(Float64(z + z)) * Float64(-y)) * 1.0) end
function tmp = code(x, y, z, t) tmp = (sqrt((z + z)) * -y) * 1.0; end
code[x_, y_, z_, t_] := N[(N[(N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision] * 1), $MachinePrecision]
\left(\sqrt{z + z} \cdot \left(-y\right)\right) \cdot 1
Initial program 99.5%
Taylor expanded in t around 0
Applied rewrites56.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-*.f64N/A
lower-sqrt.f64N/A
lower-*.f6429.6%
Applied rewrites29.6%
lift-*.f64N/A
mul-1-negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lift-sqrt.f64N/A
pow1/2N/A
lift-*.f64N/A
*-commutativeN/A
*-commutativeN/A
count-2-revN/A
lift-+.f64N/A
pow1/2N/A
lift-sqrt.f64N/A
lower-neg.f6429.6%
Applied rewrites29.6%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
(* (* (- (* x 1/2) y) (sqrt (* z 2))) (exp (/ (* t t) 2))))