
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - 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 * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - 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 * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(y - z\right)}{t - z}
\end{array}
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= x_m 10000.0)
(/ (* x_m (- y z)) (- t z))
(* (/ x_m (- z t)) (- z y)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 10000.0) {
tmp = (x_m * (y - z)) / (t - z);
} else {
tmp = (x_m / (z - t)) * (z - y);
}
return x_s * tmp;
}
x\_m = private
x\_s = private
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_s, x_m, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x_m <= 10000.0d0) then
tmp = (x_m * (y - z)) / (t - z)
else
tmp = (x_m / (z - t)) * (z - y)
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (x_m <= 10000.0) {
tmp = (x_m * (y - z)) / (t - z);
} else {
tmp = (x_m / (z - t)) * (z - y);
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if x_m <= 10000.0: tmp = (x_m * (y - z)) / (t - z) else: tmp = (x_m / (z - t)) * (z - y) return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (x_m <= 10000.0) tmp = Float64(Float64(x_m * Float64(y - z)) / Float64(t - z)); else tmp = Float64(Float64(x_m / Float64(z - t)) * Float64(z - y)); end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (x_m <= 10000.0) tmp = (x_m * (y - z)) / (t - z); else tmp = (x_m / (z - t)) * (z - y); end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[x$95$m, 10000.0], N[(N[(x$95$m * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 10000:\\
\;\;\;\;\frac{x\_m \cdot \left(y - z\right)}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x\_m}{z - t} \cdot \left(z - y\right)\\
\end{array}
\end{array}
if x < 1e4Initial program 96.8%
if 1e4 < x Initial program 70.5%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
sub-negateN/A
sub-negateN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6497.5
Applied rewrites97.5%
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
frac-2negN/A
metadata-evalN/A
sub-negateN/A
lower-/.f64N/A
lower--.f6497.3
Applied rewrites97.3%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
metadata-evalN/A
sub-negateN/A
frac-2negN/A
mult-flipN/A
division-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lift-/.f64N/A
lift--.f64N/A
lift--.f6497.0
Applied rewrites97.0%
lift-/.f64N/A
lift--.f64N/A
lift--.f64N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
lift--.f6496.7
Applied rewrites96.7%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (* x_m (/ (- z y) (- z t)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m * ((z - y) / (z - t)));
}
x\_m = private
x\_s = private
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_s, x_m, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * (x_m * ((z - y) / (z - t)))
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
return x_s * (x_m * ((z - y) / (z - t)));
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * (x_m * ((z - y) / (z - t)))
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * Float64(x_m * Float64(Float64(z - y) / Float64(z - t)))) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * (x_m * ((z - y) / (z - t))); end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * N[(x$95$m * N[(N[(z - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \left(x\_m \cdot \frac{z - y}{z - t}\right)
\end{array}
Initial program 84.0%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
sub-negateN/A
sub-negateN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6497.3
Applied rewrites97.3%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (- x_m (* x_m (/ y z)))))
(*
x_s
(if (<= z -1.14e+68)
t_1
(if (<= z -3.4e-177)
(* x_m (/ y (- t z)))
(if (<= z 1.15e+26) (/ (* x_m (- y z)) t) t_1))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = x_m - (x_m * (y / z));
double tmp;
if (z <= -1.14e+68) {
tmp = t_1;
} else if (z <= -3.4e-177) {
tmp = x_m * (y / (t - z));
} else if (z <= 1.15e+26) {
tmp = (x_m * (y - z)) / t;
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = private
x\_s = private
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_s, x_m, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
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_m - (x_m * (y / z))
if (z <= (-1.14d+68)) then
tmp = t_1
else if (z <= (-3.4d-177)) then
tmp = x_m * (y / (t - z))
else if (z <= 1.15d+26) then
tmp = (x_m * (y - z)) / t
else
tmp = t_1
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = x_m - (x_m * (y / z));
double tmp;
if (z <= -1.14e+68) {
tmp = t_1;
} else if (z <= -3.4e-177) {
tmp = x_m * (y / (t - z));
} else if (z <= 1.15e+26) {
tmp = (x_m * (y - z)) / t;
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = x_m - (x_m * (y / z)) tmp = 0 if z <= -1.14e+68: tmp = t_1 elif z <= -3.4e-177: tmp = x_m * (y / (t - z)) elif z <= 1.15e+26: tmp = (x_m * (y - z)) / t else: tmp = t_1 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(x_m - Float64(x_m * Float64(y / z))) tmp = 0.0 if (z <= -1.14e+68) tmp = t_1; elseif (z <= -3.4e-177) tmp = Float64(x_m * Float64(y / Float64(t - z))); elseif (z <= 1.15e+26) tmp = Float64(Float64(x_m * Float64(y - z)) / t); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = x_m - (x_m * (y / z)); tmp = 0.0; if (z <= -1.14e+68) tmp = t_1; elseif (z <= -3.4e-177) tmp = x_m * (y / (t - z)); elseif (z <= 1.15e+26) tmp = (x_m * (y - z)) / t; else tmp = t_1; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m - N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -1.14e+68], t$95$1, If[LessEqual[z, -3.4e-177], N[(x$95$m * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.15e+26], N[(N[(x$95$m * N[(y - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := x\_m - x\_m \cdot \frac{y}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.14 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{-177}:\\
\;\;\;\;x\_m \cdot \frac{y}{t - z}\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+26}:\\
\;\;\;\;\frac{x\_m \cdot \left(y - z\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -1.13999999999999988e68 or 1.15e26 < z Initial program 72.3%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6468.6
Applied rewrites68.6%
Taylor expanded in t around 0
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6478.7
Applied rewrites78.7%
if -1.13999999999999988e68 < z < -3.4000000000000001e-177Initial program 93.2%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6463.3
Applied rewrites63.3%
if -3.4000000000000001e-177 < z < 1.15e26Initial program 92.5%
Taylor expanded in z around 0
Applied rewrites73.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (- x_m (* x_m (/ y z)))))
(*
x_s
(if (<= z -1.14e+68)
t_1
(if (<= z -1.65e-81)
(* x_m (/ y (- t z)))
(if (<= z 4.3e+26) (/ (* x_m y) (- t z)) t_1))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = x_m - (x_m * (y / z));
double tmp;
if (z <= -1.14e+68) {
tmp = t_1;
} else if (z <= -1.65e-81) {
tmp = x_m * (y / (t - z));
} else if (z <= 4.3e+26) {
tmp = (x_m * y) / (t - z);
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = private
x\_s = private
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_s, x_m, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
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_m - (x_m * (y / z))
if (z <= (-1.14d+68)) then
tmp = t_1
else if (z <= (-1.65d-81)) then
tmp = x_m * (y / (t - z))
else if (z <= 4.3d+26) then
tmp = (x_m * y) / (t - z)
else
tmp = t_1
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = x_m - (x_m * (y / z));
double tmp;
if (z <= -1.14e+68) {
tmp = t_1;
} else if (z <= -1.65e-81) {
tmp = x_m * (y / (t - z));
} else if (z <= 4.3e+26) {
tmp = (x_m * y) / (t - z);
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = x_m - (x_m * (y / z)) tmp = 0 if z <= -1.14e+68: tmp = t_1 elif z <= -1.65e-81: tmp = x_m * (y / (t - z)) elif z <= 4.3e+26: tmp = (x_m * y) / (t - z) else: tmp = t_1 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(x_m - Float64(x_m * Float64(y / z))) tmp = 0.0 if (z <= -1.14e+68) tmp = t_1; elseif (z <= -1.65e-81) tmp = Float64(x_m * Float64(y / Float64(t - z))); elseif (z <= 4.3e+26) tmp = Float64(Float64(x_m * y) / Float64(t - z)); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = x_m - (x_m * (y / z)); tmp = 0.0; if (z <= -1.14e+68) tmp = t_1; elseif (z <= -1.65e-81) tmp = x_m * (y / (t - z)); elseif (z <= 4.3e+26) tmp = (x_m * y) / (t - z); else tmp = t_1; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m - N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -1.14e+68], t$95$1, If[LessEqual[z, -1.65e-81], N[(x$95$m * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.3e+26], N[(N[(x$95$m * y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := x\_m - x\_m \cdot \frac{y}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.14 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{-81}:\\
\;\;\;\;x\_m \cdot \frac{y}{t - z}\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+26}:\\
\;\;\;\;\frac{x\_m \cdot y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -1.13999999999999988e68 or 4.2999999999999998e26 < z Initial program 72.2%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6468.6
Applied rewrites68.6%
Taylor expanded in t around 0
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6478.8
Applied rewrites78.8%
if -1.13999999999999988e68 < z < -1.64999999999999994e-81Initial program 93.6%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6456.1
Applied rewrites56.1%
if -1.64999999999999994e-81 < z < 4.2999999999999998e26Initial program 92.6%
Taylor expanded in y around inf
Applied rewrites76.9%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (- x_m (* x_m (/ y z)))))
(*
x_s
(if (<= z -1.14e+68) t_1 (if (<= z 6e+26) (* x_m (/ y (- t z))) t_1)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = x_m - (x_m * (y / z));
double tmp;
if (z <= -1.14e+68) {
tmp = t_1;
} else if (z <= 6e+26) {
tmp = x_m * (y / (t - z));
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = private
x\_s = private
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_s, x_m, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
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_m - (x_m * (y / z))
if (z <= (-1.14d+68)) then
tmp = t_1
else if (z <= 6d+26) then
tmp = x_m * (y / (t - z))
else
tmp = t_1
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = x_m - (x_m * (y / z));
double tmp;
if (z <= -1.14e+68) {
tmp = t_1;
} else if (z <= 6e+26) {
tmp = x_m * (y / (t - z));
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = x_m - (x_m * (y / z)) tmp = 0 if z <= -1.14e+68: tmp = t_1 elif z <= 6e+26: tmp = x_m * (y / (t - z)) else: tmp = t_1 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(x_m - Float64(x_m * Float64(y / z))) tmp = 0.0 if (z <= -1.14e+68) tmp = t_1; elseif (z <= 6e+26) tmp = Float64(x_m * Float64(y / Float64(t - z))); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = x_m - (x_m * (y / z)); tmp = 0.0; if (z <= -1.14e+68) tmp = t_1; elseif (z <= 6e+26) tmp = x_m * (y / (t - z)); else tmp = t_1; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m - N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -1.14e+68], t$95$1, If[LessEqual[z, 6e+26], N[(x$95$m * N[(y / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := x\_m - x\_m \cdot \frac{y}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.14 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+26}:\\
\;\;\;\;x\_m \cdot \frac{y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -1.13999999999999988e68 or 5.99999999999999994e26 < z Initial program 72.2%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6468.6
Applied rewrites68.6%
Taylor expanded in t around 0
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6478.7
Applied rewrites78.7%
if -1.13999999999999988e68 < z < 5.99999999999999994e26Initial program 92.8%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6473.5
Applied rewrites73.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (- x_m (* x_m (/ y z)))))
(*
x_s
(if (<= z -1.9e-121)
t_1
(if (<= z 1.2e-110)
(/ (* y x_m) t)
(if (<= z 2.4e-10) (* z (/ x_m (- t))) t_1))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = x_m - (x_m * (y / z));
double tmp;
if (z <= -1.9e-121) {
tmp = t_1;
} else if (z <= 1.2e-110) {
tmp = (y * x_m) / t;
} else if (z <= 2.4e-10) {
tmp = z * (x_m / -t);
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = private
x\_s = private
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_s, x_m, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
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_m - (x_m * (y / z))
if (z <= (-1.9d-121)) then
tmp = t_1
else if (z <= 1.2d-110) then
tmp = (y * x_m) / t
else if (z <= 2.4d-10) then
tmp = z * (x_m / -t)
else
tmp = t_1
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = x_m - (x_m * (y / z));
double tmp;
if (z <= -1.9e-121) {
tmp = t_1;
} else if (z <= 1.2e-110) {
tmp = (y * x_m) / t;
} else if (z <= 2.4e-10) {
tmp = z * (x_m / -t);
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): t_1 = x_m - (x_m * (y / z)) tmp = 0 if z <= -1.9e-121: tmp = t_1 elif z <= 1.2e-110: tmp = (y * x_m) / t elif z <= 2.4e-10: tmp = z * (x_m / -t) else: tmp = t_1 return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(x_m - Float64(x_m * Float64(y / z))) tmp = 0.0 if (z <= -1.9e-121) tmp = t_1; elseif (z <= 1.2e-110) tmp = Float64(Float64(y * x_m) / t); elseif (z <= 2.4e-10) tmp = Float64(z * Float64(x_m / Float64(-t))); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) t_1 = x_m - (x_m * (y / z)); tmp = 0.0; if (z <= -1.9e-121) tmp = t_1; elseif (z <= 1.2e-110) tmp = (y * x_m) / t; elseif (z <= 2.4e-10) tmp = z * (x_m / -t); else tmp = t_1; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(x$95$m - N[(x$95$m * N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -1.9e-121], t$95$1, If[LessEqual[z, 1.2e-110], N[(N[(y * x$95$m), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 2.4e-10], N[(z * N[(x$95$m / (-t)), $MachinePrecision]), $MachinePrecision], t$95$1]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := x\_m - x\_m \cdot \frac{y}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{-121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-110}:\\
\;\;\;\;\frac{y \cdot x\_m}{t}\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-10}:\\
\;\;\;\;z \cdot \frac{x\_m}{-t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -1.9e-121 or 2.4e-10 < z Initial program 78.7%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6462.0
Applied rewrites62.0%
Taylor expanded in t around 0
lower--.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6469.3
Applied rewrites69.3%
if -1.9e-121 < z < 1.20000000000000003e-110Initial program 92.2%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6473.0
Applied rewrites73.0%
if 1.20000000000000003e-110 < z < 2.4e-10Initial program 93.0%
Taylor expanded in y around 0
associate-*r/N/A
mul-1-negN/A
sub-negateN/A
frac-2neg-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6443.9
Applied rewrites43.9%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6431.5
Applied rewrites31.5%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6431.6
Applied rewrites31.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (/ (* (- z y) x_m) z)))
(*
x_s
(if (<= z -3.6e+100)
(fma t (/ x_m z) x_m)
(if (<= z -1.9e-121)
t_1
(if (<= z 1.2e-110)
(/ (* y x_m) t)
(if (<= z 2.4e-10) (* z (/ x_m (- t))) t_1)))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = ((z - y) * x_m) / z;
double tmp;
if (z <= -3.6e+100) {
tmp = fma(t, (x_m / z), x_m);
} else if (z <= -1.9e-121) {
tmp = t_1;
} else if (z <= 1.2e-110) {
tmp = (y * x_m) / t;
} else if (z <= 2.4e-10) {
tmp = z * (x_m / -t);
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = Float64(Float64(Float64(z - y) * x_m) / z) tmp = 0.0 if (z <= -3.6e+100) tmp = fma(t, Float64(x_m / z), x_m); elseif (z <= -1.9e-121) tmp = t_1; elseif (z <= 1.2e-110) tmp = Float64(Float64(y * x_m) / t); elseif (z <= 2.4e-10) tmp = Float64(z * Float64(x_m / Float64(-t))); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] * x$95$m), $MachinePrecision] / z), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -3.6e+100], N[(t * N[(x$95$m / z), $MachinePrecision] + x$95$m), $MachinePrecision], If[LessEqual[z, -1.9e-121], t$95$1, If[LessEqual[z, 1.2e-110], N[(N[(y * x$95$m), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 2.4e-10], N[(z * N[(x$95$m / (-t)), $MachinePrecision]), $MachinePrecision], t$95$1]]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := \frac{\left(z - y\right) \cdot x\_m}{z}\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+100}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{x\_m}{z}, x\_m\right)\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-110}:\\
\;\;\;\;\frac{y \cdot x\_m}{t}\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-10}:\\
\;\;\;\;z \cdot \frac{x\_m}{-t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -3.6e100Initial program 67.3%
Taylor expanded in y around 0
associate-*r/N/A
mul-1-negN/A
sub-negateN/A
frac-2neg-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6455.9
Applied rewrites55.9%
Taylor expanded in z around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6468.9
Applied rewrites68.9%
if -3.6e100 < z < -1.9e-121 or 2.4e-10 < z Initial program 83.1%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
sub-negateN/A
sub-negateN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6499.2
Applied rewrites99.2%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f6453.2
Applied rewrites53.2%
if -1.9e-121 < z < 1.20000000000000003e-110Initial program 92.2%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6473.0
Applied rewrites73.0%
if 1.20000000000000003e-110 < z < 2.4e-10Initial program 93.0%
Taylor expanded in y around 0
associate-*r/N/A
mul-1-negN/A
sub-negateN/A
frac-2neg-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6443.9
Applied rewrites43.9%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6431.5
Applied rewrites31.5%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6431.6
Applied rewrites31.6%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(let* ((t_1 (fma t (/ x_m z) x_m)))
(*
x_s
(if (<= z -8.5e+70)
t_1
(if (<= z 1.95e-110)
(* x_m (/ y t))
(if (<= z 1.5e+22) (* z (/ x_m (- t))) t_1))))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double t_1 = fma(t, (x_m / z), x_m);
double tmp;
if (z <= -8.5e+70) {
tmp = t_1;
} else if (z <= 1.95e-110) {
tmp = x_m * (y / t);
} else if (z <= 1.5e+22) {
tmp = z * (x_m / -t);
} else {
tmp = t_1;
}
return x_s * tmp;
}
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) t_1 = fma(t, Float64(x_m / z), x_m) tmp = 0.0 if (z <= -8.5e+70) tmp = t_1; elseif (z <= 1.95e-110) tmp = Float64(x_m * Float64(y / t)); elseif (z <= 1.5e+22) tmp = Float64(z * Float64(x_m / Float64(-t))); else tmp = t_1; end return Float64(x_s * tmp) end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x$95$m / z), $MachinePrecision] + x$95$m), $MachinePrecision]}, N[(x$95$s * If[LessEqual[z, -8.5e+70], t$95$1, If[LessEqual[z, 1.95e-110], N[(x$95$m * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e+22], N[(z * N[(x$95$m / (-t)), $MachinePrecision]), $MachinePrecision], t$95$1]]]), $MachinePrecision]]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t, \frac{x\_m}{z}, x\_m\right)\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{-110}:\\
\;\;\;\;x\_m \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+22}:\\
\;\;\;\;z \cdot \frac{x\_m}{-t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -8.4999999999999996e70 or 1.5e22 < z Initial program 72.5%
Taylor expanded in y around 0
associate-*r/N/A
mul-1-negN/A
sub-negateN/A
frac-2neg-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6457.6
Applied rewrites57.6%
Taylor expanded in z around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6463.3
Applied rewrites63.3%
if -8.4999999999999996e70 < z < 1.95e-110Initial program 92.5%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
sub-negateN/A
sub-negateN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6494.9
Applied rewrites94.9%
Taylor expanded in z around 0
lower-/.f6463.5
Applied rewrites63.5%
if 1.95e-110 < z < 1.5e22Initial program 93.3%
Taylor expanded in y around 0
associate-*r/N/A
mul-1-negN/A
sub-negateN/A
frac-2neg-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6446.4
Applied rewrites46.4%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6430.3
Applied rewrites30.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6430.5
Applied rewrites30.5%
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z t)
:precision binary64
(*
x_s
(if (<= z -1.14e+68)
x_m
(if (<= z 1.95e-110)
(* x_m (/ y t))
(if (<= z 1.5e+22) (* z (/ x_m (- t))) x_m)))))x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -1.14e+68) {
tmp = x_m;
} else if (z <= 1.95e-110) {
tmp = x_m * (y / t);
} else if (z <= 1.5e+22) {
tmp = z * (x_m / -t);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = private
x\_s = private
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_s, x_m, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.14d+68)) then
tmp = x_m
else if (z <= 1.95d-110) then
tmp = x_m * (y / t)
else if (z <= 1.5d+22) then
tmp = z * (x_m / -t)
else
tmp = x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -1.14e+68) {
tmp = x_m;
} else if (z <= 1.95e-110) {
tmp = x_m * (y / t);
} else if (z <= 1.5e+22) {
tmp = z * (x_m / -t);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= -1.14e+68: tmp = x_m elif z <= 1.95e-110: tmp = x_m * (y / t) elif z <= 1.5e+22: tmp = z * (x_m / -t) else: tmp = x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= -1.14e+68) tmp = x_m; elseif (z <= 1.95e-110) tmp = Float64(x_m * Float64(y / t)); elseif (z <= 1.5e+22) tmp = Float64(z * Float64(x_m / Float64(-t))); else tmp = x_m; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (z <= -1.14e+68) tmp = x_m; elseif (z <= 1.95e-110) tmp = x_m * (y / t); elseif (z <= 1.5e+22) tmp = z * (x_m / -t); else tmp = x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -1.14e+68], x$95$m, If[LessEqual[z, 1.95e-110], N[(x$95$m * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.5e+22], N[(z * N[(x$95$m / (-t)), $MachinePrecision]), $MachinePrecision], x$95$m]]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.14 \cdot 10^{+68}:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{-110}:\\
\;\;\;\;x\_m \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+22}:\\
\;\;\;\;z \cdot \frac{x\_m}{-t}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -1.13999999999999988e68 or 1.5e22 < z Initial program 72.5%
Taylor expanded in z around inf
Applied rewrites63.2%
if -1.13999999999999988e68 < z < 1.95e-110Initial program 92.6%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
sub-negateN/A
sub-negateN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6494.9
Applied rewrites94.9%
Taylor expanded in z around 0
lower-/.f6463.8
Applied rewrites63.8%
if 1.95e-110 < z < 1.5e22Initial program 93.3%
Taylor expanded in y around 0
associate-*r/N/A
mul-1-negN/A
sub-negateN/A
frac-2neg-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6446.4
Applied rewrites46.4%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6430.3
Applied rewrites30.3%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6430.5
Applied rewrites30.5%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= z -1.14e+68) x_m (if (<= z 1.3e+27) (* x_m (/ y t)) x_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -1.14e+68) {
tmp = x_m;
} else if (z <= 1.3e+27) {
tmp = x_m * (y / t);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = private
x\_s = private
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_s, x_m, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.14d+68)) then
tmp = x_m
else if (z <= 1.3d+27) then
tmp = x_m * (y / t)
else
tmp = x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -1.14e+68) {
tmp = x_m;
} else if (z <= 1.3e+27) {
tmp = x_m * (y / t);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= -1.14e+68: tmp = x_m elif z <= 1.3e+27: tmp = x_m * (y / t) else: tmp = x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= -1.14e+68) tmp = x_m; elseif (z <= 1.3e+27) tmp = Float64(x_m * Float64(y / t)); else tmp = x_m; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (z <= -1.14e+68) tmp = x_m; elseif (z <= 1.3e+27) tmp = x_m * (y / t); else tmp = x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -1.14e+68], x$95$m, If[LessEqual[z, 1.3e+27], N[(x$95$m * N[(y / t), $MachinePrecision]), $MachinePrecision], x$95$m]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.14 \cdot 10^{+68}:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+27}:\\
\;\;\;\;x\_m \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -1.13999999999999988e68 or 1.30000000000000004e27 < z Initial program 72.2%
Taylor expanded in z around inf
Applied rewrites63.6%
if -1.13999999999999988e68 < z < 1.30000000000000004e27Initial program 92.8%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
sub-negateN/A
sub-negateN/A
frac-2neg-revN/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6495.5
Applied rewrites95.5%
Taylor expanded in z around 0
lower-/.f6460.2
Applied rewrites60.2%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= z -1.14e+68) x_m (if (<= z 1.3e+27) (/ (* y x_m) t) x_m))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -1.14e+68) {
tmp = x_m;
} else if (z <= 1.3e+27) {
tmp = (y * x_m) / t;
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = private
x\_s = private
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_s, x_m, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.14d+68)) then
tmp = x_m
else if (z <= 1.3d+27) then
tmp = (y * x_m) / t
else
tmp = x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (z <= -1.14e+68) {
tmp = x_m;
} else if (z <= 1.3e+27) {
tmp = (y * x_m) / t;
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if z <= -1.14e+68: tmp = x_m elif z <= 1.3e+27: tmp = (y * x_m) / t else: tmp = x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (z <= -1.14e+68) tmp = x_m; elseif (z <= 1.3e+27) tmp = Float64(Float64(y * x_m) / t); else tmp = x_m; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (z <= -1.14e+68) tmp = x_m; elseif (z <= 1.3e+27) tmp = (y * x_m) / t; else tmp = x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[z, -1.14e+68], x$95$m, If[LessEqual[z, 1.3e+27], N[(N[(y * x$95$m), $MachinePrecision] / t), $MachinePrecision], x$95$m]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;z \leq -1.14 \cdot 10^{+68}:\\
\;\;\;\;x\_m\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+27}:\\
\;\;\;\;\frac{y \cdot x\_m}{t}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if z < -1.13999999999999988e68 or 1.30000000000000004e27 < z Initial program 72.2%
Taylor expanded in z around inf
Applied rewrites63.6%
if -1.13999999999999988e68 < z < 1.30000000000000004e27Initial program 92.8%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6457.7
Applied rewrites57.7%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s (if (<= (/ (* x_m (- y z)) (- t z)) 0.0) (* t (/ x_m z)) x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (((x_m * (y - z)) / (t - z)) <= 0.0) {
tmp = t * (x_m / z);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = private
x\_s = private
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_s, x_m, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (((x_m * (y - z)) / (t - z)) <= 0.0d0) then
tmp = t * (x_m / z)
else
tmp = x_m
end if
code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
double tmp;
if (((x_m * (y - z)) / (t - z)) <= 0.0) {
tmp = t * (x_m / z);
} else {
tmp = x_m;
}
return x_s * tmp;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): tmp = 0 if ((x_m * (y - z)) / (t - z)) <= 0.0: tmp = t * (x_m / z) else: tmp = x_m return x_s * tmp
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) tmp = 0.0 if (Float64(Float64(x_m * Float64(y - z)) / Float64(t - z)) <= 0.0) tmp = Float64(t * Float64(x_m / z)); else tmp = x_m; end return Float64(x_s * tmp) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp_2 = code(x_s, x_m, y, z, t) tmp = 0.0; if (((x_m * (y - z)) / (t - z)) <= 0.0) tmp = t * (x_m / z); else tmp = x_m; end tmp_2 = x_s * tmp; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * If[LessEqual[N[(N[(x$95$m * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], 0.0], N[(t * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], x$95$m]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{x\_m \cdot \left(y - z\right)}{t - z} \leq 0:\\
\;\;\;\;t \cdot \frac{x\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;x\_m\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -0.0Initial program 88.2%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r/N/A
sub-divN/A
distribute-lft-out--N/A
associate-*r/N/A
+-commutativeN/A
lower-+.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6425.1
Applied rewrites25.1%
Taylor expanded in t around inf
lower-/.f64N/A
lift-*.f644.8
Applied rewrites4.8%
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f646.8
Applied rewrites6.8%
if -0.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 81.5%
Taylor expanded in z around inf
Applied rewrites54.6%
x\_m = (fabs.f64 x) x\_s = (copysign.f64 #s(literal 1 binary64) x) (FPCore (x_s x_m y z t) :precision binary64 (* x_s x_m))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z, double t) {
return x_s * x_m;
}
x\_m = private
x\_s = private
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_s, x_m, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x_s
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x_s * x_m
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z, double t) {
return x_s * x_m;
}
x\_m = math.fabs(x) x\_s = math.copysign(1.0, x) def code(x_s, x_m, y, z, t): return x_s * x_m
x\_m = abs(x) x\_s = copysign(1.0, x) function code(x_s, x_m, y, z, t) return Float64(x_s * x_m) end
x\_m = abs(x); x\_s = sign(x) * abs(1.0); function tmp = code(x_s, x_m, y, z, t) tmp = x_s * x_m; end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_, t_] := N[(x$95$s * x$95$m), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)
\\
x\_s \cdot x\_m
\end{array}
Initial program 84.0%
Taylor expanded in z around inf
Applied rewrites35.5%
herbie shell --seed 2025127
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
(/ (* x (- y z)) (- t z)))