
(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 11 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 6e+195)
(* x_m (/ (- z y) (- z t)))
(* (- y z) (/ x_m (- t z))))))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 <= 6e+195) {
tmp = x_m * ((z - y) / (z - t));
} else {
tmp = (y - z) * (x_m / (t - z));
}
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 <= 6d+195) then
tmp = x_m * ((z - y) / (z - t))
else
tmp = (y - z) * (x_m / (t - z))
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 <= 6e+195) {
tmp = x_m * ((z - y) / (z - t));
} else {
tmp = (y - z) * (x_m / (t - z));
}
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 <= 6e+195: tmp = x_m * ((z - y) / (z - t)) else: tmp = (y - z) * (x_m / (t - z)) 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 <= 6e+195) tmp = Float64(x_m * Float64(Float64(z - y) / Float64(z - t))); else tmp = Float64(Float64(y - z) * Float64(x_m / Float64(t - z))); 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 <= 6e+195) tmp = x_m * ((z - y) / (z - t)); else tmp = (y - z) * (x_m / (t - z)); 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, 6e+195], N[(x$95$m * N[(N[(z - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(x$95$m / N[(t - z), $MachinePrecision]), $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 6 \cdot 10^{+195}:\\
\;\;\;\;x\_m \cdot \frac{z - y}{z - t}\\
\mathbf{else}:\\
\;\;\;\;\left(y - z\right) \cdot \frac{x\_m}{t - z}\\
\end{array}
\end{array}
if x < 6.0000000000000001e195Initial program 83.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
sub-negate-revN/A
lower--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.2%
if 6.0000000000000001e195 < x Initial program 83.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lower-/.f64N/A
lift--.f6484.8
Applied rewrites84.8%
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 83.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
sub-negate-revN/A
lower--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.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
(let* ((t_1 (- x_m (* x_m (/ y z)))))
(*
x_s
(if (<= z -1.5e+22) t_1 (if (<= z 1.45e-22) (/ (* 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.5e+22) {
tmp = t_1;
} else if (z <= 1.45e-22) {
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.5d+22)) then
tmp = t_1
else if (z <= 1.45d-22) 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.5e+22) {
tmp = t_1;
} else if (z <= 1.45e-22) {
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.5e+22: tmp = t_1 elif z <= 1.45e-22: 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.5e+22) tmp = t_1; elseif (z <= 1.45e-22) 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.5e+22) tmp = t_1; elseif (z <= 1.45e-22) 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.5e+22], t$95$1, If[LessEqual[z, 1.45e-22], 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.5 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-22}:\\
\;\;\;\;\frac{x\_m \cdot \left(y - z\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -1.5e22 or 1.4500000000000001e-22 < z Initial program 83.7%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6447.6
Applied rewrites47.6%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6452.0
Applied rewrites52.0%
if -1.5e22 < z < 1.4500000000000001e-22Initial program 83.7%
Taylor expanded in z around 0
Applied rewrites47.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.5e+22) t_1 (if (<= z 1.95e-67) (* 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.5e+22) {
tmp = t_1;
} else if (z <= 1.95e-67) {
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.5d+22)) then
tmp = t_1
else if (z <= 1.95d-67) 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.5e+22) {
tmp = t_1;
} else if (z <= 1.95e-67) {
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.5e+22: tmp = t_1 elif z <= 1.95e-67: 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.5e+22) tmp = t_1; elseif (z <= 1.95e-67) tmp = Float64(x_m * Float64(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.5e+22) tmp = t_1; elseif (z <= 1.95e-67) 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.5e+22], t$95$1, If[LessEqual[z, 1.95e-67], N[(x$95$m * N[(N[(y - z), $MachinePrecision] / 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.5 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{-67}:\\
\;\;\;\;x\_m \cdot \frac{y - z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -1.5e22 or 1.9499999999999999e-67 < z Initial program 83.7%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6447.6
Applied rewrites47.6%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6452.0
Applied rewrites52.0%
if -1.5e22 < z < 1.9499999999999999e-67Initial program 83.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
sub-negate-revN/A
lower--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.2%
Taylor expanded in t around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
sub-negate-revN/A
lower--.f6451.0
Applied rewrites51.0%
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.45e+22) t_1 (if (<= z 105000.0) (* y (/ x_m (- 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.45e+22) {
tmp = t_1;
} else if (z <= 105000.0) {
tmp = y * (x_m / (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.45d+22)) then
tmp = t_1
else if (z <= 105000.0d0) then
tmp = y * (x_m / (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.45e+22) {
tmp = t_1;
} else if (z <= 105000.0) {
tmp = y * (x_m / (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.45e+22: tmp = t_1 elif z <= 105000.0: tmp = y * (x_m / (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.45e+22) tmp = t_1; elseif (z <= 105000.0) tmp = Float64(y * Float64(x_m / 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.45e+22) tmp = t_1; elseif (z <= 105000.0) tmp = y * (x_m / (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.45e+22], t$95$1, If[LessEqual[z, 105000.0], N[(y * N[(x$95$m / 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.45 \cdot 10^{+22}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 105000:\\
\;\;\;\;y \cdot \frac{x\_m}{t - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if z < -1.45e22 or 105000 < z Initial program 83.7%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6447.6
Applied rewrites47.6%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f6452.0
Applied rewrites52.0%
if -1.45e22 < z < 105000Initial program 83.7%
Taylor expanded in y around inf
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6450.2
Applied rewrites50.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.45e+22)
(fma t (/ x_m z) x_m)
(if (<= z 500.0)
(* y (/ x_m (- t z)))
(if (<= z 6e+153) (* z (/ x_m (- z t))) (* x_m 1.0))))))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.45e+22) {
tmp = fma(t, (x_m / z), x_m);
} else if (z <= 500.0) {
tmp = y * (x_m / (t - z));
} else if (z <= 6e+153) {
tmp = z * (x_m / (z - t));
} else {
tmp = x_m * 1.0;
}
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.45e+22) tmp = fma(t, Float64(x_m / z), x_m); elseif (z <= 500.0) tmp = Float64(y * Float64(x_m / Float64(t - z))); elseif (z <= 6e+153) tmp = Float64(z * Float64(x_m / Float64(z - t))); else tmp = Float64(x_m * 1.0); 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_] := N[(x$95$s * If[LessEqual[z, -1.45e+22], N[(t * N[(x$95$m / z), $MachinePrecision] + x$95$m), $MachinePrecision], If[LessEqual[z, 500.0], N[(y * N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e+153], N[(z * N[(x$95$m / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * 1.0), $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}\;z \leq -1.45 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{x\_m}{z}, x\_m\right)\\
\mathbf{elif}\;z \leq 500:\\
\;\;\;\;y \cdot \frac{x\_m}{t - z}\\
\mathbf{elif}\;z \leq 6 \cdot 10^{+153}:\\
\;\;\;\;z \cdot \frac{x\_m}{z - t}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot 1\\
\end{array}
\end{array}
if z < -1.45e22Initial program 83.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negate-revN/A
lower--.f6444.4
Applied rewrites44.4%
Taylor expanded in z around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6436.3
Applied rewrites36.3%
if -1.45e22 < z < 500Initial program 83.7%
Taylor expanded in y around inf
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6450.2
Applied rewrites50.2%
if 500 < z < 6.00000000000000037e153Initial program 83.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negate-revN/A
lower--.f6444.4
Applied rewrites44.4%
lift-*.f64N/A
lift--.f64N/A
lift-/.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6446.2
Applied rewrites46.2%
if 6.00000000000000037e153 < z Initial program 83.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
sub-negate-revN/A
lower--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.2%
Taylor expanded in z around inf
Applied rewrites35.1%
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.45e+22)
(fma t (/ x_m z) x_m)
(if (<= z 5.5e+118) (* y (/ x_m (- t z))) (* x_m 1.0)))))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.45e+22) {
tmp = fma(t, (x_m / z), x_m);
} else if (z <= 5.5e+118) {
tmp = y * (x_m / (t - z));
} else {
tmp = x_m * 1.0;
}
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.45e+22) tmp = fma(t, Float64(x_m / z), x_m); elseif (z <= 5.5e+118) tmp = Float64(y * Float64(x_m / Float64(t - z))); else tmp = Float64(x_m * 1.0); 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_] := N[(x$95$s * If[LessEqual[z, -1.45e+22], N[(t * N[(x$95$m / z), $MachinePrecision] + x$95$m), $MachinePrecision], If[LessEqual[z, 5.5e+118], N[(y * N[(x$95$m / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * 1.0), $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}\;z \leq -1.45 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{x\_m}{z}, x\_m\right)\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{+118}:\\
\;\;\;\;y \cdot \frac{x\_m}{t - z}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot 1\\
\end{array}
\end{array}
if z < -1.45e22Initial program 83.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negate-revN/A
lower--.f6444.4
Applied rewrites44.4%
Taylor expanded in z around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6436.3
Applied rewrites36.3%
if -1.45e22 < z < 5.5000000000000003e118Initial program 83.7%
Taylor expanded in y around inf
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f6450.2
Applied rewrites50.2%
if 5.5000000000000003e118 < z Initial program 83.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
sub-negate-revN/A
lower--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.2%
Taylor expanded in z around inf
Applied rewrites35.1%
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.65e+22)
(fma t (/ x_m z) x_m)
(if (<= z 3e+80) (* x_m (/ y t)) (* x_m 1.0)))))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.65e+22) {
tmp = fma(t, (x_m / z), x_m);
} else if (z <= 3e+80) {
tmp = x_m * (y / t);
} else {
tmp = x_m * 1.0;
}
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.65e+22) tmp = fma(t, Float64(x_m / z), x_m); elseif (z <= 3e+80) tmp = Float64(x_m * Float64(y / t)); else tmp = Float64(x_m * 1.0); 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_] := N[(x$95$s * If[LessEqual[z, -1.65e+22], N[(t * N[(x$95$m / z), $MachinePrecision] + x$95$m), $MachinePrecision], If[LessEqual[z, 3e+80], N[(x$95$m * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x$95$m * 1.0), $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}\;z \leq -1.65 \cdot 10^{+22}:\\
\;\;\;\;\mathsf{fma}\left(t, \frac{x\_m}{z}, x\_m\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+80}:\\
\;\;\;\;x\_m \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot 1\\
\end{array}
\end{array}
if z < -1.6499999999999999e22Initial program 83.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
sub-negate-revN/A
lower--.f6444.4
Applied rewrites44.4%
Taylor expanded in z around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6436.3
Applied rewrites36.3%
if -1.6499999999999999e22 < z < 2.99999999999999987e80Initial program 83.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
sub-negate-revN/A
lower--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.2%
Taylor expanded in z around 0
lower-/.f6440.4
Applied rewrites40.4%
if 2.99999999999999987e80 < z Initial program 83.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
sub-negate-revN/A
lower--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.2%
Taylor expanded in z around inf
Applied rewrites35.1%
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.65e+22)
(* x_m 1.0)
(if (<= z 3e+80) (* x_m (/ y t)) (* x_m 1.0)))))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.65e+22) {
tmp = x_m * 1.0;
} else if (z <= 3e+80) {
tmp = x_m * (y / t);
} else {
tmp = x_m * 1.0;
}
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.65d+22)) then
tmp = x_m * 1.0d0
else if (z <= 3d+80) then
tmp = x_m * (y / t)
else
tmp = x_m * 1.0d0
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.65e+22) {
tmp = x_m * 1.0;
} else if (z <= 3e+80) {
tmp = x_m * (y / t);
} else {
tmp = x_m * 1.0;
}
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.65e+22: tmp = x_m * 1.0 elif z <= 3e+80: tmp = x_m * (y / t) else: tmp = x_m * 1.0 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.65e+22) tmp = Float64(x_m * 1.0); elseif (z <= 3e+80) tmp = Float64(x_m * Float64(y / t)); else tmp = Float64(x_m * 1.0); 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.65e+22) tmp = x_m * 1.0; elseif (z <= 3e+80) tmp = x_m * (y / t); else tmp = x_m * 1.0; 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.65e+22], N[(x$95$m * 1.0), $MachinePrecision], If[LessEqual[z, 3e+80], N[(x$95$m * N[(y / t), $MachinePrecision]), $MachinePrecision], N[(x$95$m * 1.0), $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}\;z \leq -1.65 \cdot 10^{+22}:\\
\;\;\;\;x\_m \cdot 1\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+80}:\\
\;\;\;\;x\_m \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot 1\\
\end{array}
\end{array}
if z < -1.6499999999999999e22 or 2.99999999999999987e80 < z Initial program 83.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
sub-negate-revN/A
lower--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.2%
Taylor expanded in z around inf
Applied rewrites35.1%
if -1.6499999999999999e22 < z < 2.99999999999999987e80Initial program 83.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
sub-negate-revN/A
lower--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.2%
Taylor expanded in z around 0
lower-/.f6440.4
Applied rewrites40.4%
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.3e+22)
(* x_m 1.0)
(if (<= z 105000.0) (* y (/ x_m t)) (* x_m 1.0)))))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.3e+22) {
tmp = x_m * 1.0;
} else if (z <= 105000.0) {
tmp = y * (x_m / t);
} else {
tmp = x_m * 1.0;
}
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.3d+22)) then
tmp = x_m * 1.0d0
else if (z <= 105000.0d0) then
tmp = y * (x_m / t)
else
tmp = x_m * 1.0d0
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.3e+22) {
tmp = x_m * 1.0;
} else if (z <= 105000.0) {
tmp = y * (x_m / t);
} else {
tmp = x_m * 1.0;
}
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.3e+22: tmp = x_m * 1.0 elif z <= 105000.0: tmp = y * (x_m / t) else: tmp = x_m * 1.0 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.3e+22) tmp = Float64(x_m * 1.0); elseif (z <= 105000.0) tmp = Float64(y * Float64(x_m / t)); else tmp = Float64(x_m * 1.0); 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.3e+22) tmp = x_m * 1.0; elseif (z <= 105000.0) tmp = y * (x_m / t); else tmp = x_m * 1.0; 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.3e+22], N[(x$95$m * 1.0), $MachinePrecision], If[LessEqual[z, 105000.0], N[(y * N[(x$95$m / t), $MachinePrecision]), $MachinePrecision], N[(x$95$m * 1.0), $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}\;z \leq -1.3 \cdot 10^{+22}:\\
\;\;\;\;x\_m \cdot 1\\
\mathbf{elif}\;z \leq 105000:\\
\;\;\;\;y \cdot \frac{x\_m}{t}\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot 1\\
\end{array}
\end{array}
if z < -1.3e22 or 105000 < z Initial program 83.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
sub-negate-revN/A
lower--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.2%
Taylor expanded in z around inf
Applied rewrites35.1%
if -1.3e22 < z < 105000Initial program 83.7%
Taylor expanded in z around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6438.3
Applied rewrites38.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6437.9
Applied rewrites37.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 (* x_s (* x_m 1.0)))
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 * 1.0);
}
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 * 1.0d0)
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 * 1.0);
}
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 * 1.0)
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 * 1.0)) 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 * 1.0); 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 * 1.0), $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 1\right)
\end{array}
Initial program 83.7%
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
frac-2negN/A
lower-/.f64N/A
sub-negate-revN/A
lower--.f64N/A
sub-negate-revN/A
lower--.f6497.2
Applied rewrites97.2%
Taylor expanded in z around inf
Applied rewrites35.1%
herbie shell --seed 2025136
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
(/ (* x (- y z)) (- t z)))