
(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * 2.0d0) / ((y * z) - (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
def code(x, y, z, t): return (x * 2.0) / ((y * z) - (t * z))
function code(x, y, z, t) return Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x * 2.0) / ((y * z) - (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\end{array}
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * 2.0d0) / ((y * z) - (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x * 2.0) / ((y * z) - (t * z));
}
def code(x, y, z, t): return (x * 2.0) / ((y * z) - (t * z))
function code(x, y, z, t) return Float64(Float64(x * 2.0) / Float64(Float64(y * z) - Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x * 2.0) / ((y * z) - (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y * z), $MachinePrecision] - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\end{array}
z_m = (fabs.f64 z) NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. (FPCore (x y z_m t) :precision binary64 (if (<= (- (* y z_m) (* t z_m)) -5e+306) (* (/ 2.0 (- y t)) (/ x z_m)) (/ (* x 2.0) (* (- y t) z_m))))
z_m = fabs(z);
assert(x < y && y < z_m && z_m < t);
double code(double x, double y, double z_m, double t) {
double tmp;
if (((y * z_m) - (t * z_m)) <= -5e+306) {
tmp = (2.0 / (y - t)) * (x / z_m);
} else {
tmp = (x * 2.0) / ((y - t) * z_m);
}
return tmp;
}
z_m = private
NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function.
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 * z_m) - (t * z_m)) <= (-5d+306)) then
tmp = (2.0d0 / (y - t)) * (x / z_m)
else
tmp = (x * 2.0d0) / ((y - t) * z_m)
end if
code = tmp
end function
z_m = Math.abs(z);
assert x < y && y < z_m && z_m < t;
public static double code(double x, double y, double z_m, double t) {
double tmp;
if (((y * z_m) - (t * z_m)) <= -5e+306) {
tmp = (2.0 / (y - t)) * (x / z_m);
} else {
tmp = (x * 2.0) / ((y - t) * z_m);
}
return tmp;
}
z_m = math.fabs(z) [x, y, z_m, t] = sort([x, y, z_m, t]) def code(x, y, z_m, t): tmp = 0 if ((y * z_m) - (t * z_m)) <= -5e+306: tmp = (2.0 / (y - t)) * (x / z_m) else: tmp = (x * 2.0) / ((y - t) * z_m) return tmp
z_m = abs(z) x, y, z_m, t = sort([x, y, z_m, t]) function code(x, y, z_m, t) tmp = 0.0 if (Float64(Float64(y * z_m) - Float64(t * z_m)) <= -5e+306) tmp = Float64(Float64(2.0 / Float64(y - t)) * Float64(x / z_m)); else tmp = Float64(Float64(x * 2.0) / Float64(Float64(y - t) * z_m)); end return tmp end
z_m = abs(z);
x, y, z_m, t = num2cell(sort([x, y, z_m, t])){:}
function tmp_2 = code(x, y, z_m, t)
tmp = 0.0;
if (((y * z_m) - (t * z_m)) <= -5e+306)
tmp = (2.0 / (y - t)) * (x / z_m);
else
tmp = (x * 2.0) / ((y - t) * z_m);
end
tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision] NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(N[(y * z$95$m), $MachinePrecision] - N[(t * z$95$m), $MachinePrecision]), $MachinePrecision], -5e+306], N[(N[(2.0 / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(x / z$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y - t), $MachinePrecision] * z$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m, t] = \mathsf{sort}([x, y, z_m, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z\_m - t \cdot z\_m \leq -5 \cdot 10^{+306}:\\
\;\;\;\;\frac{2}{y - t} \cdot \frac{x}{z\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{\left(y - t\right) \cdot z\_m}\\
\end{array}
\end{array}
if (-.f64 (*.f64 y z) (*.f64 t z)) < -4.99999999999999993e306Initial program 58.1%
Applied rewrites60.0%
if -4.99999999999999993e306 < (-.f64 (*.f64 y z) (*.f64 t z)) Initial program 58.1%
Applied rewrites59.7%
z_m = (fabs.f64 z) NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. (FPCore (x y z_m t) :precision binary64 (* (/ x (- y t)) (/ 2.0 z_m)))
z_m = fabs(z);
assert(x < y && y < z_m && z_m < t);
double code(double x, double y, double z_m, double t) {
return (x / (y - t)) * (2.0 / z_m);
}
z_m = private
NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function.
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 = (x / (y - t)) * (2.0d0 / z_m)
end function
z_m = Math.abs(z);
assert x < y && y < z_m && z_m < t;
public static double code(double x, double y, double z_m, double t) {
return (x / (y - t)) * (2.0 / z_m);
}
z_m = math.fabs(z) [x, y, z_m, t] = sort([x, y, z_m, t]) def code(x, y, z_m, t): return (x / (y - t)) * (2.0 / z_m)
z_m = abs(z) x, y, z_m, t = sort([x, y, z_m, t]) function code(x, y, z_m, t) return Float64(Float64(x / Float64(y - t)) * Float64(2.0 / z_m)) end
z_m = abs(z);
x, y, z_m, t = num2cell(sort([x, y, z_m, t])){:}
function tmp = code(x, y, z_m, t)
tmp = (x / (y - t)) * (2.0 / z_m);
end
z_m = N[Abs[z], $MachinePrecision] NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. code[x_, y_, z$95$m_, t_] := N[(N[(x / N[(y - t), $MachinePrecision]), $MachinePrecision] * N[(2.0 / z$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m, t] = \mathsf{sort}([x, y, z_m, t])\\
\\
\frac{x}{y - t} \cdot \frac{2}{z\_m}
\end{array}
Initial program 58.1%
Applied rewrites59.8%
z_m = (fabs.f64 z) NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. (FPCore (x y z_m t) :precision binary64 (if (<= x 8e+169) (/ (* x 2.0) (* (- y t) z_m)) (* 2.0 (/ (/ x y) z_m))))
z_m = fabs(z);
assert(x < y && y < z_m && z_m < t);
double code(double x, double y, double z_m, double t) {
double tmp;
if (x <= 8e+169) {
tmp = (x * 2.0) / ((y - t) * z_m);
} else {
tmp = 2.0 * ((x / y) / z_m);
}
return tmp;
}
z_m = private
NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function.
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 (x <= 8d+169) then
tmp = (x * 2.0d0) / ((y - t) * z_m)
else
tmp = 2.0d0 * ((x / y) / z_m)
end if
code = tmp
end function
z_m = Math.abs(z);
assert x < y && y < z_m && z_m < t;
public static double code(double x, double y, double z_m, double t) {
double tmp;
if (x <= 8e+169) {
tmp = (x * 2.0) / ((y - t) * z_m);
} else {
tmp = 2.0 * ((x / y) / z_m);
}
return tmp;
}
z_m = math.fabs(z) [x, y, z_m, t] = sort([x, y, z_m, t]) def code(x, y, z_m, t): tmp = 0 if x <= 8e+169: tmp = (x * 2.0) / ((y - t) * z_m) else: tmp = 2.0 * ((x / y) / z_m) return tmp
z_m = abs(z) x, y, z_m, t = sort([x, y, z_m, t]) function code(x, y, z_m, t) tmp = 0.0 if (x <= 8e+169) tmp = Float64(Float64(x * 2.0) / Float64(Float64(y - t) * z_m)); else tmp = Float64(2.0 * Float64(Float64(x / y) / z_m)); end return tmp end
z_m = abs(z);
x, y, z_m, t = num2cell(sort([x, y, z_m, t])){:}
function tmp_2 = code(x, y, z_m, t)
tmp = 0.0;
if (x <= 8e+169)
tmp = (x * 2.0) / ((y - t) * z_m);
else
tmp = 2.0 * ((x / y) / z_m);
end
tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision] NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. code[x_, y_, z$95$m_, t_] := If[LessEqual[x, 8e+169], N[(N[(x * 2.0), $MachinePrecision] / N[(N[(y - t), $MachinePrecision] * z$95$m), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m, t] = \mathsf{sort}([x, y, z_m, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8 \cdot 10^{+169}:\\
\;\;\;\;\frac{x \cdot 2}{\left(y - t\right) \cdot z\_m}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{y}}{z\_m}\\
\end{array}
\end{array}
if x < 7.99999999999999947e169Initial program 58.1%
Applied rewrites59.7%
if 7.99999999999999947e169 < x Initial program 58.1%
Taylor expanded in y around inf
Applied rewrites37.6%
Applied rewrites37.6%
z_m = (fabs.f64 z) NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. (FPCore (x y z_m t) :precision binary64 (if (<= x 8e+169) (* (/ 2.0 (* (- y t) z_m)) x) (* 2.0 (/ (/ x y) z_m))))
z_m = fabs(z);
assert(x < y && y < z_m && z_m < t);
double code(double x, double y, double z_m, double t) {
double tmp;
if (x <= 8e+169) {
tmp = (2.0 / ((y - t) * z_m)) * x;
} else {
tmp = 2.0 * ((x / y) / z_m);
}
return tmp;
}
z_m = private
NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function.
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 (x <= 8d+169) then
tmp = (2.0d0 / ((y - t) * z_m)) * x
else
tmp = 2.0d0 * ((x / y) / z_m)
end if
code = tmp
end function
z_m = Math.abs(z);
assert x < y && y < z_m && z_m < t;
public static double code(double x, double y, double z_m, double t) {
double tmp;
if (x <= 8e+169) {
tmp = (2.0 / ((y - t) * z_m)) * x;
} else {
tmp = 2.0 * ((x / y) / z_m);
}
return tmp;
}
z_m = math.fabs(z) [x, y, z_m, t] = sort([x, y, z_m, t]) def code(x, y, z_m, t): tmp = 0 if x <= 8e+169: tmp = (2.0 / ((y - t) * z_m)) * x else: tmp = 2.0 * ((x / y) / z_m) return tmp
z_m = abs(z) x, y, z_m, t = sort([x, y, z_m, t]) function code(x, y, z_m, t) tmp = 0.0 if (x <= 8e+169) tmp = Float64(Float64(2.0 / Float64(Float64(y - t) * z_m)) * x); else tmp = Float64(2.0 * Float64(Float64(x / y) / z_m)); end return tmp end
z_m = abs(z);
x, y, z_m, t = num2cell(sort([x, y, z_m, t])){:}
function tmp_2 = code(x, y, z_m, t)
tmp = 0.0;
if (x <= 8e+169)
tmp = (2.0 / ((y - t) * z_m)) * x;
else
tmp = 2.0 * ((x / y) / z_m);
end
tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision] NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. code[x_, y_, z$95$m_, t_] := If[LessEqual[x, 8e+169], N[(N[(2.0 / N[(N[(y - t), $MachinePrecision] * z$95$m), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], N[(2.0 * N[(N[(x / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m, t] = \mathsf{sort}([x, y, z_m, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8 \cdot 10^{+169}:\\
\;\;\;\;\frac{2}{\left(y - t\right) \cdot z\_m} \cdot x\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{y}}{z\_m}\\
\end{array}
\end{array}
if x < 7.99999999999999947e169Initial program 58.1%
Applied rewrites59.6%
if 7.99999999999999947e169 < x Initial program 58.1%
Taylor expanded in y around inf
Applied rewrites37.6%
Applied rewrites37.6%
z_m = (fabs.f64 z) NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. (FPCore (x y z_m t) :precision binary64 (if (<= t 9.5e-135) (* 2.0 (/ (/ x y) z_m)) (* -2.0 (/ (/ x z_m) t))))
z_m = fabs(z);
assert(x < y && y < z_m && z_m < t);
double code(double x, double y, double z_m, double t) {
double tmp;
if (t <= 9.5e-135) {
tmp = 2.0 * ((x / y) / z_m);
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return tmp;
}
z_m = private
NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function.
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 (t <= 9.5d-135) then
tmp = 2.0d0 * ((x / y) / z_m)
else
tmp = (-2.0d0) * ((x / z_m) / t)
end if
code = tmp
end function
z_m = Math.abs(z);
assert x < y && y < z_m && z_m < t;
public static double code(double x, double y, double z_m, double t) {
double tmp;
if (t <= 9.5e-135) {
tmp = 2.0 * ((x / y) / z_m);
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return tmp;
}
z_m = math.fabs(z) [x, y, z_m, t] = sort([x, y, z_m, t]) def code(x, y, z_m, t): tmp = 0 if t <= 9.5e-135: tmp = 2.0 * ((x / y) / z_m) else: tmp = -2.0 * ((x / z_m) / t) return tmp
z_m = abs(z) x, y, z_m, t = sort([x, y, z_m, t]) function code(x, y, z_m, t) tmp = 0.0 if (t <= 9.5e-135) tmp = Float64(2.0 * Float64(Float64(x / y) / z_m)); else tmp = Float64(-2.0 * Float64(Float64(x / z_m) / t)); end return tmp end
z_m = abs(z);
x, y, z_m, t = num2cell(sort([x, y, z_m, t])){:}
function tmp_2 = code(x, y, z_m, t)
tmp = 0.0;
if (t <= 9.5e-135)
tmp = 2.0 * ((x / y) / z_m);
else
tmp = -2.0 * ((x / z_m) / t);
end
tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision] NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. code[x_, y_, z$95$m_, t_] := If[LessEqual[t, 9.5e-135], N[(2.0 * N[(N[(x / y), $MachinePrecision] / z$95$m), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m, t] = \mathsf{sort}([x, y, z_m, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9.5 \cdot 10^{-135}:\\
\;\;\;\;2 \cdot \frac{\frac{x}{y}}{z\_m}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{z\_m}}{t}\\
\end{array}
\end{array}
if t < 9.50000000000000007e-135Initial program 58.1%
Taylor expanded in y around inf
Applied rewrites37.6%
Applied rewrites37.6%
if 9.50000000000000007e-135 < t Initial program 58.1%
Taylor expanded in y around 0
Applied rewrites37.4%
Applied rewrites39.5%
z_m = (fabs.f64 z) NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. (FPCore (x y z_m t) :precision binary64 (if (<= t 7.2e-135) (* 2.0 (/ x (* y z_m))) (* -2.0 (/ (/ x z_m) t))))
z_m = fabs(z);
assert(x < y && y < z_m && z_m < t);
double code(double x, double y, double z_m, double t) {
double tmp;
if (t <= 7.2e-135) {
tmp = 2.0 * (x / (y * z_m));
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return tmp;
}
z_m = private
NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function.
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 (t <= 7.2d-135) then
tmp = 2.0d0 * (x / (y * z_m))
else
tmp = (-2.0d0) * ((x / z_m) / t)
end if
code = tmp
end function
z_m = Math.abs(z);
assert x < y && y < z_m && z_m < t;
public static double code(double x, double y, double z_m, double t) {
double tmp;
if (t <= 7.2e-135) {
tmp = 2.0 * (x / (y * z_m));
} else {
tmp = -2.0 * ((x / z_m) / t);
}
return tmp;
}
z_m = math.fabs(z) [x, y, z_m, t] = sort([x, y, z_m, t]) def code(x, y, z_m, t): tmp = 0 if t <= 7.2e-135: tmp = 2.0 * (x / (y * z_m)) else: tmp = -2.0 * ((x / z_m) / t) return tmp
z_m = abs(z) x, y, z_m, t = sort([x, y, z_m, t]) function code(x, y, z_m, t) tmp = 0.0 if (t <= 7.2e-135) tmp = Float64(2.0 * Float64(x / Float64(y * z_m))); else tmp = Float64(-2.0 * Float64(Float64(x / z_m) / t)); end return tmp end
z_m = abs(z);
x, y, z_m, t = num2cell(sort([x, y, z_m, t])){:}
function tmp_2 = code(x, y, z_m, t)
tmp = 0.0;
if (t <= 7.2e-135)
tmp = 2.0 * (x / (y * z_m));
else
tmp = -2.0 * ((x / z_m) / t);
end
tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision] NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. code[x_, y_, z$95$m_, t_] := If[LessEqual[t, 7.2e-135], N[(2.0 * N[(x / N[(y * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(x / z$95$m), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m, t] = \mathsf{sort}([x, y, z_m, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 7.2 \cdot 10^{-135}:\\
\;\;\;\;2 \cdot \frac{x}{y \cdot z\_m}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\frac{x}{z\_m}}{t}\\
\end{array}
\end{array}
if t < 7.19999999999999955e-135Initial program 58.1%
Taylor expanded in y around inf
Applied rewrites37.6%
if 7.19999999999999955e-135 < t Initial program 58.1%
Taylor expanded in y around 0
Applied rewrites37.4%
Applied rewrites39.5%
z_m = (fabs.f64 z) NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. (FPCore (x y z_m t) :precision binary64 (if (<= t 7.2e-135) (* 2.0 (/ x (* y z_m))) (* -2.0 (/ x (* t z_m)))))
z_m = fabs(z);
assert(x < y && y < z_m && z_m < t);
double code(double x, double y, double z_m, double t) {
double tmp;
if (t <= 7.2e-135) {
tmp = 2.0 * (x / (y * z_m));
} else {
tmp = -2.0 * (x / (t * z_m));
}
return tmp;
}
z_m = private
NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function.
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 (t <= 7.2d-135) then
tmp = 2.0d0 * (x / (y * z_m))
else
tmp = (-2.0d0) * (x / (t * z_m))
end if
code = tmp
end function
z_m = Math.abs(z);
assert x < y && y < z_m && z_m < t;
public static double code(double x, double y, double z_m, double t) {
double tmp;
if (t <= 7.2e-135) {
tmp = 2.0 * (x / (y * z_m));
} else {
tmp = -2.0 * (x / (t * z_m));
}
return tmp;
}
z_m = math.fabs(z) [x, y, z_m, t] = sort([x, y, z_m, t]) def code(x, y, z_m, t): tmp = 0 if t <= 7.2e-135: tmp = 2.0 * (x / (y * z_m)) else: tmp = -2.0 * (x / (t * z_m)) return tmp
z_m = abs(z) x, y, z_m, t = sort([x, y, z_m, t]) function code(x, y, z_m, t) tmp = 0.0 if (t <= 7.2e-135) tmp = Float64(2.0 * Float64(x / Float64(y * z_m))); else tmp = Float64(-2.0 * Float64(x / Float64(t * z_m))); end return tmp end
z_m = abs(z);
x, y, z_m, t = num2cell(sort([x, y, z_m, t])){:}
function tmp_2 = code(x, y, z_m, t)
tmp = 0.0;
if (t <= 7.2e-135)
tmp = 2.0 * (x / (y * z_m));
else
tmp = -2.0 * (x / (t * z_m));
end
tmp_2 = tmp;
end
z_m = N[Abs[z], $MachinePrecision] NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. code[x_, y_, z$95$m_, t_] := If[LessEqual[t, 7.2e-135], N[(2.0 * N[(x / N[(y * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(x / N[(t * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m, t] = \mathsf{sort}([x, y, z_m, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 7.2 \cdot 10^{-135}:\\
\;\;\;\;2 \cdot \frac{x}{y \cdot z\_m}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{x}{t \cdot z\_m}\\
\end{array}
\end{array}
if t < 7.19999999999999955e-135Initial program 58.1%
Taylor expanded in y around inf
Applied rewrites37.6%
if 7.19999999999999955e-135 < t Initial program 58.1%
Taylor expanded in y around 0
Applied rewrites37.4%
z_m = (fabs.f64 z) NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. (FPCore (x y z_m t) :precision binary64 (* -2.0 (/ x (* t z_m))))
z_m = fabs(z);
assert(x < y && y < z_m && z_m < t);
double code(double x, double y, double z_m, double t) {
return -2.0 * (x / (t * z_m));
}
z_m = private
NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function.
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 = (-2.0d0) * (x / (t * z_m))
end function
z_m = Math.abs(z);
assert x < y && y < z_m && z_m < t;
public static double code(double x, double y, double z_m, double t) {
return -2.0 * (x / (t * z_m));
}
z_m = math.fabs(z) [x, y, z_m, t] = sort([x, y, z_m, t]) def code(x, y, z_m, t): return -2.0 * (x / (t * z_m))
z_m = abs(z) x, y, z_m, t = sort([x, y, z_m, t]) function code(x, y, z_m, t) return Float64(-2.0 * Float64(x / Float64(t * z_m))) end
z_m = abs(z);
x, y, z_m, t = num2cell(sort([x, y, z_m, t])){:}
function tmp = code(x, y, z_m, t)
tmp = -2.0 * (x / (t * z_m));
end
z_m = N[Abs[z], $MachinePrecision] NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. code[x_, y_, z$95$m_, t_] := N[(-2.0 * N[(x / N[(t * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m, t] = \mathsf{sort}([x, y, z_m, t])\\
\\
-2 \cdot \frac{x}{t \cdot z\_m}
\end{array}
Initial program 58.1%
Taylor expanded in y around 0
Applied rewrites37.4%
z_m = (fabs.f64 z) NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. (FPCore (x y z_m t) :precision binary64 2.0)
z_m = fabs(z);
assert(x < y && y < z_m && z_m < t);
double code(double x, double y, double z_m, double t) {
return 2.0;
}
z_m = private
NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function.
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 = 2.0d0
end function
z_m = Math.abs(z);
assert x < y && y < z_m && z_m < t;
public static double code(double x, double y, double z_m, double t) {
return 2.0;
}
z_m = math.fabs(z) [x, y, z_m, t] = sort([x, y, z_m, t]) def code(x, y, z_m, t): return 2.0
z_m = abs(z) x, y, z_m, t = sort([x, y, z_m, t]) function code(x, y, z_m, t) return 2.0 end
z_m = abs(z);
x, y, z_m, t = num2cell(sort([x, y, z_m, t])){:}
function tmp = code(x, y, z_m, t)
tmp = 2.0;
end
z_m = N[Abs[z], $MachinePrecision] NOTE: x, y, z_m, and t should be sorted in increasing order before calling this function. code[x_, y_, z$95$m_, t_] := 2.0
\begin{array}{l}
z_m = \left|z\right|
\\
[x, y, z_m, t] = \mathsf{sort}([x, y, z_m, t])\\
\\
2
\end{array}
Initial program 58.1%
Taylor expanded in y around inf
Applied rewrites37.6%
Applied rewrites3.4%
herbie shell --seed 2025159
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
(/ (* x 2.0) (- (* y z) (* t z))))