
(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}
Sampling outcomes in binary64 precision:
Herbie found 9 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}
(FPCore (x y z t) :precision binary64 (if (<= t 1.3e-21) (fma (* (* -4.0 y) z) z (fma (* (* t y) 4.0) 1.0 (* x x))) (fma (* -4.0 y) (* (fma (/ z t) z -1.0) t) (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.3e-21) {
tmp = fma(((-4.0 * y) * z), z, fma(((t * y) * 4.0), 1.0, (x * x)));
} else {
tmp = fma((-4.0 * y), (fma((z / t), z, -1.0) * t), (x * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 1.3e-21) tmp = fma(Float64(Float64(-4.0 * y) * z), z, fma(Float64(Float64(t * y) * 4.0), 1.0, Float64(x * x))); else tmp = fma(Float64(-4.0 * y), Float64(fma(Float64(z / t), z, -1.0) * t), Float64(x * x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.3e-21], N[(N[(N[(-4.0 * y), $MachinePrecision] * z), $MachinePrecision] * z + N[(N[(N[(t * y), $MachinePrecision] * 4.0), $MachinePrecision] * 1.0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * y), $MachinePrecision] * N[(N[(N[(z / t), $MachinePrecision] * z + -1.0), $MachinePrecision] * t), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.3 \cdot 10^{-21}:\\
\;\;\;\;\mathsf{fma}\left(\left(-4 \cdot y\right) \cdot z, z, \mathsf{fma}\left(\left(t \cdot y\right) \cdot 4, 1, x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4 \cdot y, \mathsf{fma}\left(\frac{z}{t}, z, -1\right) \cdot t, x \cdot x\right)\\
\end{array}
\end{array}
if t < 1.30000000000000009e-21Initial program 90.9%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
sqrt-prodN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow1N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
Applied rewrites43.4%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
pow2N/A
pow-sqrN/A
metadata-evalN/A
lower-pow.f6443.4
Applied rewrites43.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6466.8
Applied rewrites66.8%
Taylor expanded in z around inf
Applied rewrites97.7%
if 1.30000000000000009e-21 < t Initial program 93.5%
Taylor expanded in t around -inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
unpow2N/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6493.5
Applied rewrites93.5%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval97.5
Applied rewrites97.5%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 5e+59)
(fma (* t 4.0) y (* x x))
(if (<= (* z z) 2e+296)
(fma (* (* z z) y) -4.0 (* x x))
(* (* (* z y) z) -4.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+59) {
tmp = fma((t * 4.0), y, (x * x));
} else if ((z * z) <= 2e+296) {
tmp = fma(((z * z) * y), -4.0, (x * x));
} else {
tmp = ((z * y) * z) * -4.0;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+59) tmp = fma(Float64(t * 4.0), y, Float64(x * x)); elseif (Float64(z * z) <= 2e+296) tmp = fma(Float64(Float64(z * z) * y), -4.0, Float64(x * x)); else tmp = Float64(Float64(Float64(z * y) * z) * -4.0); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+59], N[(N[(t * 4.0), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+296], N[(N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision] * -4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * z), $MachinePrecision] * -4.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 4, y, x \cdot x\right)\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+296}:\\
\;\;\;\;\mathsf{fma}\left(\left(z \cdot z\right) \cdot y, -4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot y\right) \cdot z\right) \cdot -4\\
\end{array}
\end{array}
if (*.f64 z z) < 4.9999999999999997e59Initial program 98.4%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-rgt-identityN/A
unpow2N/A
associate-*l*N/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
associate-*l*N/A
unpow2N/A
*-rgt-identityN/A
mul-1-negN/A
*-commutativeN/A
unpow2N/A
sqr-neg-revN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
unpow2N/A
mul-1-negN/A
fp-cancel-sign-subN/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
Applied rewrites91.9%
Applied rewrites93.4%
if 4.9999999999999997e59 < (*.f64 z z) < 1.99999999999999996e296Initial program 95.3%
Taylor expanded in t around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-rgt-identityN/A
unpow2N/A
associate-*l*N/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
associate-*l*N/A
unpow2N/A
*-rgt-identityN/A
mul-1-negN/A
*-commutativeN/A
unpow2N/A
sqr-neg-revN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
unpow2N/A
mul-1-negN/A
fp-cancel-sign-subN/A
*-commutativeN/A
mul-1-negN/A
Applied rewrites81.7%
if 1.99999999999999996e296 < (*.f64 z z) Initial program 73.4%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
sqrt-prodN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow1N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
Applied rewrites36.4%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
pow2N/A
pow-sqrN/A
metadata-evalN/A
lower-pow.f6436.4
Applied rewrites36.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6479.9
Applied rewrites79.9%
Applied rewrites94.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* z z) t))) (if (<= t_1 5e+307) (- (* x x) (* (* y 4.0) t_1)) (* (* (* z y) z) -4.0))))
double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double tmp;
if (t_1 <= 5e+307) {
tmp = (x * x) - ((y * 4.0) * t_1);
} else {
tmp = ((z * y) * z) * -4.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (z * z) - t
if (t_1 <= 5d+307) then
tmp = (x * x) - ((y * 4.0d0) * t_1)
else
tmp = ((z * y) * z) * (-4.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double tmp;
if (t_1 <= 5e+307) {
tmp = (x * x) - ((y * 4.0) * t_1);
} else {
tmp = ((z * y) * z) * -4.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * z) - t tmp = 0 if t_1 <= 5e+307: tmp = (x * x) - ((y * 4.0) * t_1) else: tmp = ((z * y) * z) * -4.0 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * z) - t) tmp = 0.0 if (t_1 <= 5e+307) tmp = Float64(Float64(x * x) - Float64(Float64(y * 4.0) * t_1)); else tmp = Float64(Float64(Float64(z * y) * z) * -4.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * z) - t; tmp = 0.0; if (t_1 <= 5e+307) tmp = (x * x) - ((y * 4.0) * t_1); else tmp = ((z * y) * z) * -4.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+307], N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * z), $MachinePrecision] * -4.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot z - t\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+307}:\\
\;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot y\right) \cdot z\right) \cdot -4\\
\end{array}
\end{array}
if (-.f64 (*.f64 z z) t) < 5e307Initial program 97.4%
if 5e307 < (-.f64 (*.f64 z z) t) Initial program 72.4%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
sqrt-prodN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow1N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
Applied rewrites35.9%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
pow2N/A
pow-sqrN/A
metadata-evalN/A
lower-pow.f6435.9
Applied rewrites35.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6479.2
Applied rewrites79.2%
Applied rewrites93.8%
(FPCore (x y z t) :precision binary64 (if (<= z 4.4e-131) (* (* t 4.0) y) (if (<= z 1.4e+75) (* 1.0 (* x x)) (* (* (* z y) z) -4.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.4e-131) {
tmp = (t * 4.0) * y;
} else if (z <= 1.4e+75) {
tmp = 1.0 * (x * x);
} else {
tmp = ((z * y) * z) * -4.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 4.4d-131) then
tmp = (t * 4.0d0) * y
else if (z <= 1.4d+75) then
tmp = 1.0d0 * (x * x)
else
tmp = ((z * y) * z) * (-4.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.4e-131) {
tmp = (t * 4.0) * y;
} else if (z <= 1.4e+75) {
tmp = 1.0 * (x * x);
} else {
tmp = ((z * y) * z) * -4.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 4.4e-131: tmp = (t * 4.0) * y elif z <= 1.4e+75: tmp = 1.0 * (x * x) else: tmp = ((z * y) * z) * -4.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 4.4e-131) tmp = Float64(Float64(t * 4.0) * y); elseif (z <= 1.4e+75) tmp = Float64(1.0 * Float64(x * x)); else tmp = Float64(Float64(Float64(z * y) * z) * -4.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 4.4e-131) tmp = (t * 4.0) * y; elseif (z <= 1.4e+75) tmp = 1.0 * (x * x); else tmp = ((z * y) * z) * -4.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 4.4e-131], N[(N[(t * 4.0), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 1.4e+75], N[(1.0 * N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * z), $MachinePrecision] * -4.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.4 \cdot 10^{-131}:\\
\;\;\;\;\left(t \cdot 4\right) \cdot y\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+75}:\\
\;\;\;\;1 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot y\right) \cdot z\right) \cdot -4\\
\end{array}
\end{array}
if z < 4.3999999999999999e-131Initial program 92.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6440.6
Applied rewrites40.6%
Applied rewrites40.6%
if 4.3999999999999999e-131 < z < 1.40000000000000006e75Initial program 97.3%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
sqrt-prodN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow1N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
Applied rewrites97.3%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
pow2N/A
pow-sqrN/A
metadata-evalN/A
lower-pow.f6497.2
Applied rewrites97.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6491.8
Applied rewrites91.8%
Taylor expanded in x around inf
Applied rewrites71.2%
if 1.40000000000000006e75 < z Initial program 85.0%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
sqrt-prodN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow1N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
Applied rewrites85.0%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
pow2N/A
pow-sqrN/A
metadata-evalN/A
lower-pow.f6484.9
Applied rewrites84.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6466.5
Applied rewrites66.5%
Applied rewrites73.8%
(FPCore (x y z t) :precision binary64 (if (<= z 4.4e-131) (* (* t 4.0) y) (if (<= z 1.4e+75) (* 1.0 (* x x)) (* (* (* z z) y) -4.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.4e-131) {
tmp = (t * 4.0) * y;
} else if (z <= 1.4e+75) {
tmp = 1.0 * (x * x);
} else {
tmp = ((z * z) * y) * -4.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 4.4d-131) then
tmp = (t * 4.0d0) * y
else if (z <= 1.4d+75) then
tmp = 1.0d0 * (x * x)
else
tmp = ((z * z) * y) * (-4.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.4e-131) {
tmp = (t * 4.0) * y;
} else if (z <= 1.4e+75) {
tmp = 1.0 * (x * x);
} else {
tmp = ((z * z) * y) * -4.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 4.4e-131: tmp = (t * 4.0) * y elif z <= 1.4e+75: tmp = 1.0 * (x * x) else: tmp = ((z * z) * y) * -4.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 4.4e-131) tmp = Float64(Float64(t * 4.0) * y); elseif (z <= 1.4e+75) tmp = Float64(1.0 * Float64(x * x)); else tmp = Float64(Float64(Float64(z * z) * y) * -4.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 4.4e-131) tmp = (t * 4.0) * y; elseif (z <= 1.4e+75) tmp = 1.0 * (x * x); else tmp = ((z * z) * y) * -4.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 4.4e-131], N[(N[(t * 4.0), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 1.4e+75], N[(1.0 * N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision] * -4.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.4 \cdot 10^{-131}:\\
\;\;\;\;\left(t \cdot 4\right) \cdot y\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+75}:\\
\;\;\;\;1 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot z\right) \cdot y\right) \cdot -4\\
\end{array}
\end{array}
if z < 4.3999999999999999e-131Initial program 92.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6440.6
Applied rewrites40.6%
Applied rewrites40.6%
if 4.3999999999999999e-131 < z < 1.40000000000000006e75Initial program 97.3%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
sqrt-prodN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow1N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
Applied rewrites97.3%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
pow2N/A
pow-sqrN/A
metadata-evalN/A
lower-pow.f6497.2
Applied rewrites97.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6491.8
Applied rewrites91.8%
Taylor expanded in x around inf
Applied rewrites71.2%
if 1.40000000000000006e75 < z Initial program 85.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6466.5
Applied rewrites66.5%
(FPCore (x y z t) :precision binary64 (if (<= z 6.8e+137) (fma (* t 4.0) y (* x x)) (* (* (* z y) z) -4.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6.8e+137) {
tmp = fma((t * 4.0), y, (x * x));
} else {
tmp = ((z * y) * z) * -4.0;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 6.8e+137) tmp = fma(Float64(t * 4.0), y, Float64(x * x)); else tmp = Float64(Float64(Float64(z * y) * z) * -4.0); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 6.8e+137], N[(N[(t * 4.0), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * z), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.8 \cdot 10^{+137}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 4, y, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot y\right) \cdot z\right) \cdot -4\\
\end{array}
\end{array}
if z < 6.79999999999999973e137Initial program 93.9%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-rgt-identityN/A
unpow2N/A
associate-*l*N/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
associate-*l*N/A
unpow2N/A
*-rgt-identityN/A
mul-1-negN/A
*-commutativeN/A
unpow2N/A
sqr-neg-revN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
unpow2N/A
mul-1-negN/A
fp-cancel-sign-subN/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
Applied rewrites74.4%
Applied rewrites75.3%
if 6.79999999999999973e137 < z Initial program 77.1%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
sqrt-prodN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow1N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
Applied rewrites77.1%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
pow2N/A
pow-sqrN/A
metadata-evalN/A
lower-pow.f6477.0
Applied rewrites77.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.1
Applied rewrites80.1%
Applied rewrites91.3%
(FPCore (x y z t) :precision binary64 (if (<= x 7.5e-48) (* (* t 4.0) y) (* 1.0 (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 7.5e-48) {
tmp = (t * 4.0) * y;
} else {
tmp = 1.0 * (x * x);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 7.5d-48) then
tmp = (t * 4.0d0) * y
else
tmp = 1.0d0 * (x * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 7.5e-48) {
tmp = (t * 4.0) * y;
} else {
tmp = 1.0 * (x * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 7.5e-48: tmp = (t * 4.0) * y else: tmp = 1.0 * (x * x) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 7.5e-48) tmp = Float64(Float64(t * 4.0) * y); else tmp = Float64(1.0 * Float64(x * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 7.5e-48) tmp = (t * 4.0) * y; else tmp = 1.0 * (x * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 7.5e-48], N[(N[(t * 4.0), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.5 \cdot 10^{-48}:\\
\;\;\;\;\left(t \cdot 4\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < 7.50000000000000042e-48Initial program 91.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6438.8
Applied rewrites38.8%
Applied rewrites38.9%
if 7.50000000000000042e-48 < x Initial program 92.8%
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
sqrt-prodN/A
lower-*.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
sqrt-pow1N/A
pow2N/A
sqr-neg-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow1N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
pow1/2N/A
lower-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-powN/A
Applied rewrites47.7%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
rem-square-sqrtN/A
lift-sqrt.f64N/A
lift-sqrt.f64N/A
pow2N/A
pow-sqrN/A
metadata-evalN/A
lower-pow.f6447.7
Applied rewrites47.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-*r*N/A
unpow2N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6494.2
Applied rewrites94.2%
Taylor expanded in x around inf
Applied rewrites60.7%
(FPCore (x y z t) :precision binary64 (* (* t 4.0) y))
double code(double x, double y, double z, double t) {
return (t * 4.0) * y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (t * 4.0d0) * y
end function
public static double code(double x, double y, double z, double t) {
return (t * 4.0) * y;
}
def code(x, y, z, t): return (t * 4.0) * y
function code(x, y, z, t) return Float64(Float64(t * 4.0) * y) end
function tmp = code(x, y, z, t) tmp = (t * 4.0) * y; end
code[x_, y_, z_, t_] := N[(N[(t * 4.0), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\left(t \cdot 4\right) \cdot y
\end{array}
Initial program 91.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6434.6
Applied rewrites34.6%
Applied rewrites34.6%
(FPCore (x y z t) :precision binary64 (* (- x) x))
double code(double x, double y, double z, double t) {
return -x * x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return -x * x;
}
def code(x, y, z, t): return -x * x
function code(x, y, z, t) return Float64(Float64(-x) * x) end
function tmp = code(x, y, z, t) tmp = -x * x; end
code[x_, y_, z_, t_] := N[((-x) * x), $MachinePrecision]
\begin{array}{l}
\\
\left(-x\right) \cdot x
\end{array}
Initial program 91.7%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-rgt-identityN/A
unpow2N/A
associate-*l*N/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
associate-*l*N/A
unpow2N/A
*-rgt-identityN/A
mul-1-negN/A
*-commutativeN/A
unpow2N/A
sqr-neg-revN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
unpow2N/A
mul-1-negN/A
fp-cancel-sign-subN/A
*-commutativeN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
Applied rewrites68.2%
Applied rewrites69.0%
Applied rewrites16.1%
Taylor expanded in x around -inf
Applied rewrites4.8%
(FPCore (x y z t) :precision binary64 (- (* x x) (* 4.0 (* y (- (* z z) t)))))
double code(double x, double y, double z, double t) {
return (x * x) - (4.0 * (y * ((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) - (4.0d0 * (y * ((z * z) - t)))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - (4.0 * (y * ((z * z) - t)));
}
def code(x, y, z, t): return (x * x) - (4.0 * (y * ((z * z) - t)))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(4.0 * Float64(y * Float64(Float64(z * z) - t)))) end
function tmp = code(x, y, z, t) tmp = (x * x) - (4.0 * (y * ((z * z) - t))); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(4.0 * N[(y * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)
\end{array}
herbie shell --seed 2024354
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:alt
(! :herbie-platform default (- (* x x) (* 4 (* y (- (* z z) t)))))
(- (* x x) (* (* y 4.0) (- (* z z) t))))