
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
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 * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
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 * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
x_m = (fabs.f64 x)
z_m = (fabs.f64 z)
(FPCore (x_m y z_m t)
:precision binary64
(let* ((t_1 (- (* x_m x_m) (* (* y 4.0) (- (* z_m z_m) t)))))
(if (<= t_1 (- INFINITY))
(- (* x_m x_m) (* t (fma -4.0 y (* 4.0 (/ (* (* y z_m) z_m) t)))))
(if (<= t_1 INFINITY) t_1 (* (fma (- t z_m) 4.0 (/ x_m y)) y)))))x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m, double t) {
double t_1 = (x_m * x_m) - ((y * 4.0) * ((z_m * z_m) - t));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x_m * x_m) - (t * fma(-4.0, y, (4.0 * (((y * z_m) * z_m) / t))));
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma((t - z_m), 4.0, (x_m / y)) * y;
}
return tmp;
}
x_m = abs(x) z_m = abs(z) function code(x_m, y, z_m, t) t_1 = Float64(Float64(x_m * x_m) - Float64(Float64(y * 4.0) * Float64(Float64(z_m * z_m) - t))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x_m * x_m) - Float64(t * fma(-4.0, y, Float64(4.0 * Float64(Float64(Float64(y * z_m) * z_m) / t))))); elseif (t_1 <= Inf) tmp = t_1; else tmp = Float64(fma(Float64(t - z_m), 4.0, Float64(x_m / y)) * y); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
code[x$95$m_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(t * N[(-4.0 * y + N[(4.0 * N[(N[(N[(y * z$95$m), $MachinePrecision] * z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(N[(t - z$95$m), $MachinePrecision] * 4.0 + N[(x$95$m / y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|
\\
\begin{array}{l}
t_1 := x\_m \cdot x\_m - \left(y \cdot 4\right) \cdot \left(z\_m \cdot z\_m - t\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x\_m \cdot x\_m - t \cdot \mathsf{fma}\left(-4, y, 4 \cdot \frac{\left(y \cdot z\_m\right) \cdot z\_m}{t}\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - z\_m, 4, \frac{x\_m}{y}\right) \cdot y\\
\end{array}
\end{array}
if (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) < -inf.0Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites86.5%
Applied rewrites90.0%
if -inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) < +inf.0Initial program 90.6%
if +inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) Initial program 90.6%
Taylor expanded in y around inf
Applied rewrites87.0%
Applied rewrites46.5%
x_m = (fabs.f64 x) z_m = (fabs.f64 z) (FPCore (x_m y z_m t) :precision binary64 (let* ((t_1 (- (* x_m x_m) (* (* y 4.0) (- (* z_m z_m) t))))) (if (<= t_1 INFINITY) t_1 (* (fma (- t z_m) 4.0 (/ x_m y)) y))))
x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m, double t) {
double t_1 = (x_m * x_m) - ((y * 4.0) * ((z_m * z_m) - t));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma((t - z_m), 4.0, (x_m / y)) * y;
}
return tmp;
}
x_m = abs(x) z_m = abs(z) function code(x_m, y, z_m, t) t_1 = Float64(Float64(x_m * x_m) - Float64(Float64(y * 4.0) * Float64(Float64(z_m * z_m) - t))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(fma(Float64(t - z_m), 4.0, Float64(x_m / y)) * y); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
code[x$95$m_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(N[(t - z$95$m), $MachinePrecision] * 4.0 + N[(x$95$m / y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|
\\
\begin{array}{l}
t_1 := x\_m \cdot x\_m - \left(y \cdot 4\right) \cdot \left(z\_m \cdot z\_m - t\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - z\_m, 4, \frac{x\_m}{y}\right) \cdot y\\
\end{array}
\end{array}
if (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) < +inf.0Initial program 90.6%
if +inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) Initial program 90.6%
Taylor expanded in y around inf
Applied rewrites87.0%
Applied rewrites46.5%
x_m = (fabs.f64 x)
z_m = (fabs.f64 z)
(FPCore (x_m y z_m t)
:precision binary64
(if (<= z_m 8.2e-8)
(- (* x_m x_m) (* t (* -4.0 y)))
(if (<= z_m 5.5e+198)
(- (* x_m x_m) (* (- z_m t) (* y 4.0)))
(- x_m (* t (* y (* 4.0 (/ z_m t))))))))x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 8.2e-8) {
tmp = (x_m * x_m) - (t * (-4.0 * y));
} else if (z_m <= 5.5e+198) {
tmp = (x_m * x_m) - ((z_m - t) * (y * 4.0));
} else {
tmp = x_m - (t * (y * (4.0 * (z_m / t))));
}
return tmp;
}
x_m = private
z_m = 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_m, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 8.2d-8) then
tmp = (x_m * x_m) - (t * ((-4.0d0) * y))
else if (z_m <= 5.5d+198) then
tmp = (x_m * x_m) - ((z_m - t) * (y * 4.0d0))
else
tmp = x_m - (t * (y * (4.0d0 * (z_m / t))))
end if
code = tmp
end function
x_m = Math.abs(x);
z_m = Math.abs(z);
public static double code(double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 8.2e-8) {
tmp = (x_m * x_m) - (t * (-4.0 * y));
} else if (z_m <= 5.5e+198) {
tmp = (x_m * x_m) - ((z_m - t) * (y * 4.0));
} else {
tmp = x_m - (t * (y * (4.0 * (z_m / t))));
}
return tmp;
}
x_m = math.fabs(x) z_m = math.fabs(z) def code(x_m, y, z_m, t): tmp = 0 if z_m <= 8.2e-8: tmp = (x_m * x_m) - (t * (-4.0 * y)) elif z_m <= 5.5e+198: tmp = (x_m * x_m) - ((z_m - t) * (y * 4.0)) else: tmp = x_m - (t * (y * (4.0 * (z_m / t)))) return tmp
x_m = abs(x) z_m = abs(z) function code(x_m, y, z_m, t) tmp = 0.0 if (z_m <= 8.2e-8) tmp = Float64(Float64(x_m * x_m) - Float64(t * Float64(-4.0 * y))); elseif (z_m <= 5.5e+198) tmp = Float64(Float64(x_m * x_m) - Float64(Float64(z_m - t) * Float64(y * 4.0))); else tmp = Float64(x_m - Float64(t * Float64(y * Float64(4.0 * Float64(z_m / t))))); end return tmp end
x_m = abs(x); z_m = abs(z); function tmp_2 = code(x_m, y, z_m, t) tmp = 0.0; if (z_m <= 8.2e-8) tmp = (x_m * x_m) - (t * (-4.0 * y)); elseif (z_m <= 5.5e+198) tmp = (x_m * x_m) - ((z_m - t) * (y * 4.0)); else tmp = x_m - (t * (y * (4.0 * (z_m / t)))); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] code[x$95$m_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 8.2e-8], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(t * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 5.5e+198], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(N[(z$95$m - t), $MachinePrecision] * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m - N[(t * N[(y * N[(4.0 * N[(z$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 8.2 \cdot 10^{-8}:\\
\;\;\;\;x\_m \cdot x\_m - t \cdot \left(-4 \cdot y\right)\\
\mathbf{elif}\;z\_m \leq 5.5 \cdot 10^{+198}:\\
\;\;\;\;x\_m \cdot x\_m - \left(z\_m - t\right) \cdot \left(y \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m - t \cdot \left(y \cdot \left(4 \cdot \frac{z\_m}{t}\right)\right)\\
\end{array}
\end{array}
if z < 8.20000000000000063e-8Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites86.5%
Taylor expanded in z around 0
Applied rewrites65.7%
if 8.20000000000000063e-8 < z < 5.5000000000000004e198Initial program 90.6%
Applied rewrites50.6%
Applied rewrites70.5%
if 5.5000000000000004e198 < z Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites86.5%
Applied rewrites44.0%
Taylor expanded in z around inf
Applied rewrites22.0%
x_m = (fabs.f64 x) z_m = (fabs.f64 z) (FPCore (x_m y z_m t) :precision binary64 (if (<= z_m 8.2e-8) (- (* x_m x_m) (* t (* -4.0 y))) (- (* x_m x_m) (* (- z_m t) (* y 4.0)))))
x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 8.2e-8) {
tmp = (x_m * x_m) - (t * (-4.0 * y));
} else {
tmp = (x_m * x_m) - ((z_m - t) * (y * 4.0));
}
return tmp;
}
x_m = private
z_m = 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_m, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 8.2d-8) then
tmp = (x_m * x_m) - (t * ((-4.0d0) * y))
else
tmp = (x_m * x_m) - ((z_m - t) * (y * 4.0d0))
end if
code = tmp
end function
x_m = Math.abs(x);
z_m = Math.abs(z);
public static double code(double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 8.2e-8) {
tmp = (x_m * x_m) - (t * (-4.0 * y));
} else {
tmp = (x_m * x_m) - ((z_m - t) * (y * 4.0));
}
return tmp;
}
x_m = math.fabs(x) z_m = math.fabs(z) def code(x_m, y, z_m, t): tmp = 0 if z_m <= 8.2e-8: tmp = (x_m * x_m) - (t * (-4.0 * y)) else: tmp = (x_m * x_m) - ((z_m - t) * (y * 4.0)) return tmp
x_m = abs(x) z_m = abs(z) function code(x_m, y, z_m, t) tmp = 0.0 if (z_m <= 8.2e-8) tmp = Float64(Float64(x_m * x_m) - Float64(t * Float64(-4.0 * y))); else tmp = Float64(Float64(x_m * x_m) - Float64(Float64(z_m - t) * Float64(y * 4.0))); end return tmp end
x_m = abs(x); z_m = abs(z); function tmp_2 = code(x_m, y, z_m, t) tmp = 0.0; if (z_m <= 8.2e-8) tmp = (x_m * x_m) - (t * (-4.0 * y)); else tmp = (x_m * x_m) - ((z_m - t) * (y * 4.0)); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] code[x$95$m_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 8.2e-8], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(t * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(N[(z$95$m - t), $MachinePrecision] * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 8.2 \cdot 10^{-8}:\\
\;\;\;\;x\_m \cdot x\_m - t \cdot \left(-4 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot x\_m - \left(z\_m - t\right) \cdot \left(y \cdot 4\right)\\
\end{array}
\end{array}
if z < 8.20000000000000063e-8Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites86.5%
Taylor expanded in z around 0
Applied rewrites65.7%
if 8.20000000000000063e-8 < z Initial program 90.6%
Applied rewrites50.6%
Applied rewrites70.5%
x_m = (fabs.f64 x)
z_m = (fabs.f64 z)
(FPCore (x_m y z_m t)
:precision binary64
(let* ((t_1 (* (fma (- t z_m) 4.0 (/ x_m y)) y))
(t_2 (* (* y 4.0) (- (* z_m z_m) t))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 2e+223) (- (* x_m x_m) (* t (* -4.0 y))) t_1))))x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m, double t) {
double t_1 = fma((t - z_m), 4.0, (x_m / y)) * y;
double t_2 = (y * 4.0) * ((z_m * z_m) - t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 2e+223) {
tmp = (x_m * x_m) - (t * (-4.0 * y));
} else {
tmp = t_1;
}
return tmp;
}
x_m = abs(x) z_m = abs(z) function code(x_m, y, z_m, t) t_1 = Float64(fma(Float64(t - z_m), 4.0, Float64(x_m / y)) * y) t_2 = Float64(Float64(y * 4.0) * Float64(Float64(z_m * z_m) - t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 2e+223) tmp = Float64(Float64(x_m * x_m) - Float64(t * Float64(-4.0 * y))); else tmp = t_1; end return tmp end
x_m = N[Abs[x], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
code[x$95$m_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(N[(N[(t - z$95$m), $MachinePrecision] * 4.0 + N[(x$95$m / y), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2e+223], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(t * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - z\_m, 4, \frac{x\_m}{y}\right) \cdot y\\
t_2 := \left(y \cdot 4\right) \cdot \left(z\_m \cdot z\_m - t\right)\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+223}:\\
\;\;\;\;x\_m \cdot x\_m - t \cdot \left(-4 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < -inf.0 or 2.00000000000000009e223 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) Initial program 90.6%
Taylor expanded in y around inf
Applied rewrites87.0%
Applied rewrites46.5%
if -inf.0 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < 2.00000000000000009e223Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites86.5%
Taylor expanded in z around 0
Applied rewrites65.7%
x_m = (fabs.f64 x) z_m = (fabs.f64 z) (FPCore (x_m y z_m t) :precision binary64 (if (<= z_m 1.25e+146) (- (* x_m x_m) (* t (* -4.0 y))) (- x_m (* 4.0 (* y z_m)))))
x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.25e+146) {
tmp = (x_m * x_m) - (t * (-4.0 * y));
} else {
tmp = x_m - (4.0 * (y * z_m));
}
return tmp;
}
x_m = private
z_m = 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_m, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 1.25d+146) then
tmp = (x_m * x_m) - (t * ((-4.0d0) * y))
else
tmp = x_m - (4.0d0 * (y * z_m))
end if
code = tmp
end function
x_m = Math.abs(x);
z_m = Math.abs(z);
public static double code(double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.25e+146) {
tmp = (x_m * x_m) - (t * (-4.0 * y));
} else {
tmp = x_m - (4.0 * (y * z_m));
}
return tmp;
}
x_m = math.fabs(x) z_m = math.fabs(z) def code(x_m, y, z_m, t): tmp = 0 if z_m <= 1.25e+146: tmp = (x_m * x_m) - (t * (-4.0 * y)) else: tmp = x_m - (4.0 * (y * z_m)) return tmp
x_m = abs(x) z_m = abs(z) function code(x_m, y, z_m, t) tmp = 0.0 if (z_m <= 1.25e+146) tmp = Float64(Float64(x_m * x_m) - Float64(t * Float64(-4.0 * y))); else tmp = Float64(x_m - Float64(4.0 * Float64(y * z_m))); end return tmp end
x_m = abs(x); z_m = abs(z); function tmp_2 = code(x_m, y, z_m, t) tmp = 0.0; if (z_m <= 1.25e+146) tmp = (x_m * x_m) - (t * (-4.0 * y)); else tmp = x_m - (4.0 * (y * z_m)); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] code[x$95$m_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 1.25e+146], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(t * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m - N[(4.0 * N[(y * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 1.25 \cdot 10^{+146}:\\
\;\;\;\;x\_m \cdot x\_m - t \cdot \left(-4 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m - 4 \cdot \left(y \cdot z\_m\right)\\
\end{array}
\end{array}
if z < 1.25e146Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites86.5%
Taylor expanded in z around 0
Applied rewrites65.7%
if 1.25e146 < z Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites86.5%
Applied rewrites44.0%
Taylor expanded in z around inf
Applied rewrites16.5%
x_m = (fabs.f64 x) z_m = (fabs.f64 z) (FPCore (x_m y z_m t) :precision binary64 (if (<= z_m 1.25e+146) (- (* x_m x_m) (* -4.0 (* t y))) (- x_m (* 4.0 (* y z_m)))))
x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.25e+146) {
tmp = (x_m * x_m) - (-4.0 * (t * y));
} else {
tmp = x_m - (4.0 * (y * z_m));
}
return tmp;
}
x_m = private
z_m = 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_m, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 1.25d+146) then
tmp = (x_m * x_m) - ((-4.0d0) * (t * y))
else
tmp = x_m - (4.0d0 * (y * z_m))
end if
code = tmp
end function
x_m = Math.abs(x);
z_m = Math.abs(z);
public static double code(double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.25e+146) {
tmp = (x_m * x_m) - (-4.0 * (t * y));
} else {
tmp = x_m - (4.0 * (y * z_m));
}
return tmp;
}
x_m = math.fabs(x) z_m = math.fabs(z) def code(x_m, y, z_m, t): tmp = 0 if z_m <= 1.25e+146: tmp = (x_m * x_m) - (-4.0 * (t * y)) else: tmp = x_m - (4.0 * (y * z_m)) return tmp
x_m = abs(x) z_m = abs(z) function code(x_m, y, z_m, t) tmp = 0.0 if (z_m <= 1.25e+146) tmp = Float64(Float64(x_m * x_m) - Float64(-4.0 * Float64(t * y))); else tmp = Float64(x_m - Float64(4.0 * Float64(y * z_m))); end return tmp end
x_m = abs(x); z_m = abs(z); function tmp_2 = code(x_m, y, z_m, t) tmp = 0.0; if (z_m <= 1.25e+146) tmp = (x_m * x_m) - (-4.0 * (t * y)); else tmp = x_m - (4.0 * (y * z_m)); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] code[x$95$m_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 1.25e+146], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(-4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m - N[(4.0 * N[(y * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 1.25 \cdot 10^{+146}:\\
\;\;\;\;x\_m \cdot x\_m - -4 \cdot \left(t \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x\_m - 4 \cdot \left(y \cdot z\_m\right)\\
\end{array}
\end{array}
if z < 1.25e146Initial program 90.6%
Taylor expanded in z around 0
Applied rewrites65.7%
if 1.25e146 < z Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites86.5%
Applied rewrites44.0%
Taylor expanded in z around inf
Applied rewrites16.5%
x_m = (fabs.f64 x) z_m = (fabs.f64 z) (FPCore (x_m y z_m t) :precision binary64 (if (<= x_m 6e+27) (* (* y 4.0) t) (- (* x_m x_m) (* -4.0 (* y z_m)))))
x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m, double t) {
double tmp;
if (x_m <= 6e+27) {
tmp = (y * 4.0) * t;
} else {
tmp = (x_m * x_m) - (-4.0 * (y * z_m));
}
return tmp;
}
x_m = private
z_m = 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_m, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (x_m <= 6d+27) then
tmp = (y * 4.0d0) * t
else
tmp = (x_m * x_m) - ((-4.0d0) * (y * z_m))
end if
code = tmp
end function
x_m = Math.abs(x);
z_m = Math.abs(z);
public static double code(double x_m, double y, double z_m, double t) {
double tmp;
if (x_m <= 6e+27) {
tmp = (y * 4.0) * t;
} else {
tmp = (x_m * x_m) - (-4.0 * (y * z_m));
}
return tmp;
}
x_m = math.fabs(x) z_m = math.fabs(z) def code(x_m, y, z_m, t): tmp = 0 if x_m <= 6e+27: tmp = (y * 4.0) * t else: tmp = (x_m * x_m) - (-4.0 * (y * z_m)) return tmp
x_m = abs(x) z_m = abs(z) function code(x_m, y, z_m, t) tmp = 0.0 if (x_m <= 6e+27) tmp = Float64(Float64(y * 4.0) * t); else tmp = Float64(Float64(x_m * x_m) - Float64(-4.0 * Float64(y * z_m))); end return tmp end
x_m = abs(x); z_m = abs(z); function tmp_2 = code(x_m, y, z_m, t) tmp = 0.0; if (x_m <= 6e+27) tmp = (y * 4.0) * t; else tmp = (x_m * x_m) - (-4.0 * (y * z_m)); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] code[x$95$m_, y_, z$95$m_, t_] := If[LessEqual[x$95$m, 6e+27], N[(N[(y * 4.0), $MachinePrecision] * t), $MachinePrecision], N[(N[(x$95$m * x$95$m), $MachinePrecision] - N[(-4.0 * N[(y * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 6 \cdot 10^{+27}:\\
\;\;\;\;\left(y \cdot 4\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\_m \cdot x\_m - -4 \cdot \left(y \cdot z\_m\right)\\
\end{array}
\end{array}
if x < 5.99999999999999953e27Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites32.1%
Applied rewrites32.1%
if 5.99999999999999953e27 < x Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites86.5%
Applied rewrites58.9%
Taylor expanded in z around inf
Applied rewrites37.7%
x_m = (fabs.f64 x) z_m = (fabs.f64 z) (FPCore (x_m y z_m t) :precision binary64 (if (<= z_m 2.45e+89) (* (* y 4.0) t) (- x_m (* 4.0 (* y z_m)))))
x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 2.45e+89) {
tmp = (y * 4.0) * t;
} else {
tmp = x_m - (4.0 * (y * z_m));
}
return tmp;
}
x_m = private
z_m = 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_m, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 2.45d+89) then
tmp = (y * 4.0d0) * t
else
tmp = x_m - (4.0d0 * (y * z_m))
end if
code = tmp
end function
x_m = Math.abs(x);
z_m = Math.abs(z);
public static double code(double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 2.45e+89) {
tmp = (y * 4.0) * t;
} else {
tmp = x_m - (4.0 * (y * z_m));
}
return tmp;
}
x_m = math.fabs(x) z_m = math.fabs(z) def code(x_m, y, z_m, t): tmp = 0 if z_m <= 2.45e+89: tmp = (y * 4.0) * t else: tmp = x_m - (4.0 * (y * z_m)) return tmp
x_m = abs(x) z_m = abs(z) function code(x_m, y, z_m, t) tmp = 0.0 if (z_m <= 2.45e+89) tmp = Float64(Float64(y * 4.0) * t); else tmp = Float64(x_m - Float64(4.0 * Float64(y * z_m))); end return tmp end
x_m = abs(x); z_m = abs(z); function tmp_2 = code(x_m, y, z_m, t) tmp = 0.0; if (z_m <= 2.45e+89) tmp = (y * 4.0) * t; else tmp = x_m - (4.0 * (y * z_m)); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] code[x$95$m_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 2.45e+89], N[(N[(y * 4.0), $MachinePrecision] * t), $MachinePrecision], N[(x$95$m - N[(4.0 * N[(y * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 2.45 \cdot 10^{+89}:\\
\;\;\;\;\left(y \cdot 4\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\_m - 4 \cdot \left(y \cdot z\_m\right)\\
\end{array}
\end{array}
if z < 2.44999999999999998e89Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites32.1%
Applied rewrites32.1%
if 2.44999999999999998e89 < z Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites86.5%
Applied rewrites44.0%
Taylor expanded in z around inf
Applied rewrites16.5%
x_m = (fabs.f64 x) z_m = (fabs.f64 z) (FPCore (x_m y z_m t) :precision binary64 (if (<= z_m 2.45e+89) (* (* y 4.0) t) (* -4.0 (* y z_m))))
x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 2.45e+89) {
tmp = (y * 4.0) * t;
} else {
tmp = -4.0 * (y * z_m);
}
return tmp;
}
x_m = private
z_m = 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_m, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 2.45d+89) then
tmp = (y * 4.0d0) * t
else
tmp = (-4.0d0) * (y * z_m)
end if
code = tmp
end function
x_m = Math.abs(x);
z_m = Math.abs(z);
public static double code(double x_m, double y, double z_m, double t) {
double tmp;
if (z_m <= 2.45e+89) {
tmp = (y * 4.0) * t;
} else {
tmp = -4.0 * (y * z_m);
}
return tmp;
}
x_m = math.fabs(x) z_m = math.fabs(z) def code(x_m, y, z_m, t): tmp = 0 if z_m <= 2.45e+89: tmp = (y * 4.0) * t else: tmp = -4.0 * (y * z_m) return tmp
x_m = abs(x) z_m = abs(z) function code(x_m, y, z_m, t) tmp = 0.0 if (z_m <= 2.45e+89) tmp = Float64(Float64(y * 4.0) * t); else tmp = Float64(-4.0 * Float64(y * z_m)); end return tmp end
x_m = abs(x); z_m = abs(z); function tmp_2 = code(x_m, y, z_m, t) tmp = 0.0; if (z_m <= 2.45e+89) tmp = (y * 4.0) * t; else tmp = -4.0 * (y * z_m); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] code[x$95$m_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 2.45e+89], N[(N[(y * 4.0), $MachinePrecision] * t), $MachinePrecision], N[(-4.0 * N[(y * z$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 2.45 \cdot 10^{+89}:\\
\;\;\;\;\left(y \cdot 4\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(y \cdot z\_m\right)\\
\end{array}
\end{array}
if z < 2.44999999999999998e89Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites32.1%
Applied rewrites32.1%
if 2.44999999999999998e89 < z Initial program 90.6%
Applied rewrites50.6%
Applied rewrites70.5%
Taylor expanded in z around inf
Applied rewrites15.8%
x_m = (fabs.f64 x) z_m = (fabs.f64 z) (FPCore (x_m y z_m t) :precision binary64 (* (* y 4.0) t))
x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m, double t) {
return (y * 4.0) * t;
}
x_m = private
z_m = 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_m, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = (y * 4.0d0) * t
end function
x_m = Math.abs(x);
z_m = Math.abs(z);
public static double code(double x_m, double y, double z_m, double t) {
return (y * 4.0) * t;
}
x_m = math.fabs(x) z_m = math.fabs(z) def code(x_m, y, z_m, t): return (y * 4.0) * t
x_m = abs(x) z_m = abs(z) function code(x_m, y, z_m, t) return Float64(Float64(y * 4.0) * t) end
x_m = abs(x); z_m = abs(z); function tmp = code(x_m, y, z_m, t) tmp = (y * 4.0) * t; end
x_m = N[Abs[x], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] code[x$95$m_, y_, z$95$m_, t_] := N[(N[(y * 4.0), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|
\\
\left(y \cdot 4\right) \cdot t
\end{array}
Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites32.1%
Applied rewrites32.1%
x_m = (fabs.f64 x) z_m = (fabs.f64 z) (FPCore (x_m y z_m t) :precision binary64 (* 4.0 (* t y)))
x_m = fabs(x);
z_m = fabs(z);
double code(double x_m, double y, double z_m, double t) {
return 4.0 * (t * y);
}
x_m = private
z_m = 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_m, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = 4.0d0 * (t * y)
end function
x_m = Math.abs(x);
z_m = Math.abs(z);
public static double code(double x_m, double y, double z_m, double t) {
return 4.0 * (t * y);
}
x_m = math.fabs(x) z_m = math.fabs(z) def code(x_m, y, z_m, t): return 4.0 * (t * y)
x_m = abs(x) z_m = abs(z) function code(x_m, y, z_m, t) return Float64(4.0 * Float64(t * y)) end
x_m = abs(x); z_m = abs(z); function tmp = code(x_m, y, z_m, t) tmp = 4.0 * (t * y); end
x_m = N[Abs[x], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] code[x$95$m_, y_, z$95$m_, t_] := N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
z_m = \left|z\right|
\\
4 \cdot \left(t \cdot y\right)
\end{array}
Initial program 90.6%
Taylor expanded in t around inf
Applied rewrites32.1%
herbie shell --seed 2025159
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
(- (* x x) (* (* y 4.0) (- (* z z) t))))