
(FPCore (x y z t) :precision binary64 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * 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 * y)) + ((z * z) / (t * t))
end function
public static double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
def code(x, y, z, t): return ((x * x) / (y * y)) + ((z * z) / (t * t))
function code(x, y, z, t) return Float64(Float64(Float64(x * x) / Float64(y * y)) + Float64(Float64(z * z) / Float64(t * t))) end
function tmp = code(x, y, z, t) tmp = ((x * x) / (y * y)) + ((z * z) / (t * t)); end
code[x_, y_, z_, t_] := N[(N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\end{array}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * 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 * y)) + ((z * z) / (t * t))
end function
public static double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
def code(x, y, z, t): return ((x * x) / (y * y)) + ((z * z) / (t * t))
function code(x, y, z, t) return Float64(Float64(Float64(x * x) / Float64(y * y)) + Float64(Float64(z * z) / Float64(t * t))) end
function tmp = code(x, y, z, t) tmp = ((x * x) / (y * y)) + ((z * z) / (t * t)); end
code[x_, y_, z_, t_] := N[(N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\end{array}
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= z_m 3e-157) (fma (/ z_m t) (/ z_m t) (/ (* (/ x y) x) y)) (fma (/ z_m t) (/ z_m t) (* (/ (/ x y) y) x))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 3e-157) {
tmp = fma((z_m / t), (z_m / t), (((x / y) * x) / y));
} else {
tmp = fma((z_m / t), (z_m / t), (((x / y) / y) * x));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 3e-157) tmp = fma(Float64(z_m / t), Float64(z_m / t), Float64(Float64(Float64(x / y) * x) / y)); else tmp = fma(Float64(z_m / t), Float64(z_m / t), Float64(Float64(Float64(x / y) / y) * x)); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 3e-157], N[(N[(z$95$m / t), $MachinePrecision] * N[(z$95$m / t), $MachinePrecision] + N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(z$95$m / t), $MachinePrecision] * N[(z$95$m / t), $MachinePrecision] + N[(N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 3 \cdot 10^{-157}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z\_m}{t}, \frac{z\_m}{t}, \frac{\frac{x}{y} \cdot x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z\_m}{t}, \frac{z\_m}{t}, \frac{\frac{x}{y}}{y} \cdot x\right)\\
\end{array}
\end{array}
if z < 3e-157Initial program 65.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
pow2N/A
pow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6489.2
Applied rewrites89.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
lift-/.f6496.7
Applied rewrites96.7%
if 3e-157 < z Initial program 65.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
pow2N/A
pow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6489.2
Applied rewrites89.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (/ (* x x) (* y y)) 1e+196) (fma (/ z_m t) (/ z_m t) (* (/ x (* y y)) x)) (fma (/ x y) (/ x y) (* (/ z_m (* t t)) z_m))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (((x * x) / (y * y)) <= 1e+196) {
tmp = fma((z_m / t), (z_m / t), ((x / (y * y)) * x));
} else {
tmp = fma((x / y), (x / y), ((z_m / (t * t)) * z_m));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(Float64(x * x) / Float64(y * y)) <= 1e+196) tmp = fma(Float64(z_m / t), Float64(z_m / t), Float64(Float64(x / Float64(y * y)) * x)); else tmp = fma(Float64(x / y), Float64(x / y), Float64(Float64(z_m / Float64(t * t)) * z_m)); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision], 1e+196], N[(N[(z$95$m / t), $MachinePrecision] * N[(z$95$m / t), $MachinePrecision] + N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision] + N[(N[(z$95$m / N[(t * t), $MachinePrecision]), $MachinePrecision] * z$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq 10^{+196}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z\_m}{t}, \frac{z\_m}{t}, \frac{x}{y \cdot y} \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \frac{z\_m}{t \cdot t} \cdot z\_m\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < 9.9999999999999995e195Initial program 65.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
pow2N/A
pow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6489.2
Applied rewrites89.2%
if 9.9999999999999995e195 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 65.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
pow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6488.8
Applied rewrites88.8%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (fma (/ z_m t) (/ z_m t) (* (/ (/ x y) y) x)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
return fma((z_m / t), (z_m / t), (((x / y) / y) * x));
}
z_m = abs(z) function code(x, y, z_m, t) return fma(Float64(z_m / t), Float64(z_m / t), Float64(Float64(Float64(x / y) / y) * x)) end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := N[(N[(z$95$m / t), $MachinePrecision] * N[(z$95$m / t), $MachinePrecision] + N[(N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
\mathsf{fma}\left(\frac{z\_m}{t}, \frac{z\_m}{t}, \frac{\frac{x}{y}}{y} \cdot x\right)
\end{array}
Initial program 65.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
pow2N/A
pow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6489.2
Applied rewrites89.2%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6496.5
Applied rewrites96.5%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (/ (* x x) (* y y)) 1e-224) (* (/ z_m t) (* (/ 1.0 t) z_m)) (fma (/ x y) (/ x y) (* (/ z_m (* t t)) z_m))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (((x * x) / (y * y)) <= 1e-224) {
tmp = (z_m / t) * ((1.0 / t) * z_m);
} else {
tmp = fma((x / y), (x / y), ((z_m / (t * t)) * z_m));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(Float64(x * x) / Float64(y * y)) <= 1e-224) tmp = Float64(Float64(z_m / t) * Float64(Float64(1.0 / t) * z_m)); else tmp = fma(Float64(x / y), Float64(x / y), Float64(Float64(z_m / Float64(t * t)) * z_m)); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision], 1e-224], N[(N[(z$95$m / t), $MachinePrecision] * N[(N[(1.0 / t), $MachinePrecision] * z$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision] + N[(N[(z$95$m / N[(t * t), $MachinePrecision]), $MachinePrecision] * z$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot x}{y \cdot y} \leq 10^{-224}:\\
\;\;\;\;\frac{z\_m}{t} \cdot \left(\frac{1}{t} \cdot z\_m\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y}, \frac{x}{y}, \frac{z\_m}{t \cdot t} \cdot z\_m\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < 1e-224Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
associate-*l/N/A
associate-*r/N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6459.1
Applied rewrites59.1%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
frac-timesN/A
distribute-rgt-neg-inN/A
pow2N/A
mul-1-negN/A
*-commutativeN/A
frac-timesN/A
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6459.1
lift-/.f64N/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6459.1
Applied rewrites59.1%
if 1e-224 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 65.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
pow2N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6488.8
Applied rewrites88.8%
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(let* ((t_1 (/ (* x x) (* y y))))
(if (<= t_1 1e-224)
(* (/ z_m t) (* (/ 1.0 t) z_m))
(if (<= t_1 INFINITY)
(fma (/ z_m (* t t)) z_m (* (/ x (* y y)) x))
(* (/ (/ z_m t) t) z_m)))))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double t_1 = (x * x) / (y * y);
double tmp;
if (t_1 <= 1e-224) {
tmp = (z_m / t) * ((1.0 / t) * z_m);
} else if (t_1 <= ((double) INFINITY)) {
tmp = fma((z_m / (t * t)), z_m, ((x / (y * y)) * x));
} else {
tmp = ((z_m / t) / t) * z_m;
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) t_1 = Float64(Float64(x * x) / Float64(y * y)) tmp = 0.0 if (t_1 <= 1e-224) tmp = Float64(Float64(z_m / t) * Float64(Float64(1.0 / t) * z_m)); elseif (t_1 <= Inf) tmp = fma(Float64(z_m / Float64(t * t)), z_m, Float64(Float64(x / Float64(y * y)) * x)); else tmp = Float64(Float64(Float64(z_m / t) / t) * z_m); end return tmp end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-224], N[(N[(z$95$m / t), $MachinePrecision] * N[(N[(1.0 / t), $MachinePrecision] * z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(z$95$m / N[(t * t), $MachinePrecision]), $MachinePrecision] * z$95$m + N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z$95$m / t), $MachinePrecision] / t), $MachinePrecision] * z$95$m), $MachinePrecision]]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y \cdot y}\\
\mathbf{if}\;t\_1 \leq 10^{-224}:\\
\;\;\;\;\frac{z\_m}{t} \cdot \left(\frac{1}{t} \cdot z\_m\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{z\_m}{t \cdot t}, z\_m, \frac{x}{y \cdot y} \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{z\_m}{t}}{t} \cdot z\_m\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < 1e-224Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
associate-*l/N/A
associate-*r/N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6459.1
Applied rewrites59.1%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
frac-timesN/A
distribute-rgt-neg-inN/A
pow2N/A
mul-1-negN/A
*-commutativeN/A
frac-timesN/A
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6459.1
lift-/.f64N/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6459.1
Applied rewrites59.1%
if 1e-224 < (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0Initial program 65.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
pow2N/A
pow2N/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6479.6
Applied rewrites79.6%
if +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-/.f6457.0
Applied rewrites57.0%
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(let* ((t_1 (/ (* x x) (* y y))))
(if (<= t_1 1e-38)
(* (/ z_m t) (* (/ 1.0 t) z_m))
(if (<= t_1 INFINITY)
(/ (* (* (/ x y) x) t) (* t y))
(* (/ (/ z_m t) t) z_m)))))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double t_1 = (x * x) / (y * y);
double tmp;
if (t_1 <= 1e-38) {
tmp = (z_m / t) * ((1.0 / t) * z_m);
} else if (t_1 <= ((double) INFINITY)) {
tmp = (((x / y) * x) * t) / (t * y);
} else {
tmp = ((z_m / t) / t) * z_m;
}
return tmp;
}
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double t_1 = (x * x) / (y * y);
double tmp;
if (t_1 <= 1e-38) {
tmp = (z_m / t) * ((1.0 / t) * z_m);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (((x / y) * x) * t) / (t * y);
} else {
tmp = ((z_m / t) / t) * z_m;
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): t_1 = (x * x) / (y * y) tmp = 0 if t_1 <= 1e-38: tmp = (z_m / t) * ((1.0 / t) * z_m) elif t_1 <= math.inf: tmp = (((x / y) * x) * t) / (t * y) else: tmp = ((z_m / t) / t) * z_m return tmp
z_m = abs(z) function code(x, y, z_m, t) t_1 = Float64(Float64(x * x) / Float64(y * y)) tmp = 0.0 if (t_1 <= 1e-38) tmp = Float64(Float64(z_m / t) * Float64(Float64(1.0 / t) * z_m)); elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(Float64(x / y) * x) * t) / Float64(t * y)); else tmp = Float64(Float64(Float64(z_m / t) / t) * z_m); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) t_1 = (x * x) / (y * y); tmp = 0.0; if (t_1 <= 1e-38) tmp = (z_m / t) * ((1.0 / t) * z_m); elseif (t_1 <= Inf) tmp = (((x / y) * x) * t) / (t * y); else tmp = ((z_m / t) / t) * z_m; end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-38], N[(N[(z$95$m / t), $MachinePrecision] * N[(N[(1.0 / t), $MachinePrecision] * z$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] * t), $MachinePrecision] / N[(t * y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z$95$m / t), $MachinePrecision] / t), $MachinePrecision] * z$95$m), $MachinePrecision]]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y \cdot y}\\
\mathbf{if}\;t\_1 \leq 10^{-38}:\\
\;\;\;\;\frac{z\_m}{t} \cdot \left(\frac{1}{t} \cdot z\_m\right)\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\left(\frac{x}{y} \cdot x\right) \cdot t}{t \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{z\_m}{t}}{t} \cdot z\_m\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < 9.9999999999999996e-39Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
associate-*l/N/A
associate-*r/N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6459.1
Applied rewrites59.1%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
frac-timesN/A
distribute-rgt-neg-inN/A
pow2N/A
mul-1-negN/A
*-commutativeN/A
frac-timesN/A
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6459.1
lift-/.f64N/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6459.1
Applied rewrites59.1%
if 9.9999999999999996e-39 < (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0Initial program 65.8%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-/r*N/A
pow2N/A
associate-/r*N/A
frac-addN/A
lower-/.f64N/A
Applied rewrites81.2%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6447.7
Applied rewrites47.7%
Taylor expanded in x around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f6451.6
Applied rewrites51.6%
if +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lift-/.f6457.0
Applied rewrites57.0%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= y 6e-222) (/ (/ (* z_m z_m) t) t) (* (/ z_m t) (* (/ 1.0 t) z_m))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (y <= 6e-222) {
tmp = ((z_m * z_m) / t) / t;
} else {
tmp = (z_m / t) * ((1.0 / t) * z_m);
}
return tmp;
}
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, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 6d-222) then
tmp = ((z_m * z_m) / t) / t
else
tmp = (z_m / t) * ((1.0d0 / t) * z_m)
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double tmp;
if (y <= 6e-222) {
tmp = ((z_m * z_m) / t) / t;
} else {
tmp = (z_m / t) * ((1.0 / t) * z_m);
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if y <= 6e-222: tmp = ((z_m * z_m) / t) / t else: tmp = (z_m / t) * ((1.0 / t) * z_m) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (y <= 6e-222) tmp = Float64(Float64(Float64(z_m * z_m) / t) / t); else tmp = Float64(Float64(z_m / t) * Float64(Float64(1.0 / t) * z_m)); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if (y <= 6e-222) tmp = ((z_m * z_m) / t) / t; else tmp = (z_m / t) * ((1.0 / t) * z_m); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[y, 6e-222], N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] / t), $MachinePrecision] / t), $MachinePrecision], N[(N[(z$95$m / t), $MachinePrecision] * N[(N[(1.0 / t), $MachinePrecision] * z$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{-222}:\\
\;\;\;\;\frac{\frac{z\_m \cdot z\_m}{t}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{z\_m}{t} \cdot \left(\frac{1}{t} \cdot z\_m\right)\\
\end{array}
\end{array}
if y < 6.00000000000000059e-222Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*l/N/A
pow2N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lift-/.f6457.4
Applied rewrites57.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lift-*.f6453.2
Applied rewrites53.2%
if 6.00000000000000059e-222 < y Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
associate-*l/N/A
associate-*r/N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6459.1
Applied rewrites59.1%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
lift-neg.f64N/A
frac-timesN/A
distribute-rgt-neg-inN/A
pow2N/A
mul-1-negN/A
*-commutativeN/A
frac-timesN/A
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6459.1
lift-/.f64N/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6459.1
Applied rewrites59.1%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= y 6e-222) (/ (/ (* z_m z_m) t) t) (* (/ z_m t) (/ z_m t))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (y <= 6e-222) {
tmp = ((z_m * z_m) / t) / t;
} else {
tmp = (z_m / t) * (z_m / t);
}
return tmp;
}
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, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (y <= 6d-222) then
tmp = ((z_m * z_m) / t) / t
else
tmp = (z_m / t) * (z_m / t)
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double tmp;
if (y <= 6e-222) {
tmp = ((z_m * z_m) / t) / t;
} else {
tmp = (z_m / t) * (z_m / t);
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if y <= 6e-222: tmp = ((z_m * z_m) / t) / t else: tmp = (z_m / t) * (z_m / t) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (y <= 6e-222) tmp = Float64(Float64(Float64(z_m * z_m) / t) / t); else tmp = Float64(Float64(z_m / t) * Float64(z_m / t)); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if (y <= 6e-222) tmp = ((z_m * z_m) / t) / t; else tmp = (z_m / t) * (z_m / t); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[y, 6e-222], N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] / t), $MachinePrecision] / t), $MachinePrecision], N[(N[(z$95$m / t), $MachinePrecision] * N[(z$95$m / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6 \cdot 10^{-222}:\\
\;\;\;\;\frac{\frac{z\_m \cdot z\_m}{t}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{z\_m}{t} \cdot \frac{z\_m}{t}\\
\end{array}
\end{array}
if y < 6.00000000000000059e-222Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-*l/N/A
pow2N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lift-/.f6457.4
Applied rewrites57.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lift-*.f6453.2
Applied rewrites53.2%
if 6.00000000000000059e-222 < y Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
associate-*l/N/A
associate-*r/N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6459.1
Applied rewrites59.1%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (* (/ z_m t) (/ z_m t)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
return (z_m / t) * (z_m / t);
}
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, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = (z_m / t) * (z_m / t)
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
return (z_m / t) * (z_m / t);
}
z_m = math.fabs(z) def code(x, y, z_m, t): return (z_m / t) * (z_m / t)
z_m = abs(z) function code(x, y, z_m, t) return Float64(Float64(z_m / t) * Float64(z_m / t)) end
z_m = abs(z); function tmp = code(x, y, z_m, t) tmp = (z_m / t) * (z_m / t); end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := N[(N[(z$95$m / t), $MachinePrecision] * N[(z$95$m / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
\frac{z\_m}{t} \cdot \frac{z\_m}{t}
\end{array}
Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6452.1
Applied rewrites52.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/r*N/A
associate-*l/N/A
associate-*r/N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6459.1
Applied rewrites59.1%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (* (/ z_m (* t t)) z_m))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
return (z_m / (t * t)) * z_m;
}
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, y, z_m, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = (z_m / (t * t)) * z_m
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
return (z_m / (t * t)) * z_m;
}
z_m = math.fabs(z) def code(x, y, z_m, t): return (z_m / (t * t)) * z_m
z_m = abs(z) function code(x, y, z_m, t) return Float64(Float64(z_m / Float64(t * t)) * z_m) end
z_m = abs(z); function tmp = code(x, y, z_m, t) tmp = (z_m / (t * t)) * z_m; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := N[(N[(z$95$m / N[(t * t), $MachinePrecision]), $MachinePrecision] * z$95$m), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
\frac{z\_m}{t \cdot t} \cdot z\_m
\end{array}
Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lift-*.f6452.1
Applied rewrites52.1%
herbie shell --seed 2025131
(FPCore (x y z t)
:name "Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1"
:precision binary64
(+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))