
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / y) * 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (- (/ (+ x 4) y) (* (/ x y) z)))))
(if (<=
t_0
7339195571168229/36695977855841144185773134324833391052745039826692497979801421430190766017415756929120296849762010984873984)
(fabs (+ (/ (- 4 (* z x)) y) (/ x y)))
(if (<=
t_0
3999999999999999831443609401385136528614207512386057135410071092916132616022289914504946148287614500592330451563947454856809828080168025678726105499863496711154494173799977940229033050646983792107070529102452199587840315845272602181673858644271966678327153142116021922822752784275414552936448)
t_0
(fabs (/ (- (- (* z x) 4) x) y))))))double code(double x, double y, double z) {
double t_0 = fabs((((x + 4.0) / y) - ((x / y) * z)));
double tmp;
if (t_0 <= 2e-91) {
tmp = fabs((((4.0 - (z * x)) / y) + (x / y)));
} else if (t_0 <= 4e+291) {
tmp = t_0;
} else {
tmp = fabs(((((z * x) - 4.0) - x) / y));
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((((x + 4.0d0) / y) - ((x / y) * z)))
if (t_0 <= 2d-91) then
tmp = abs((((4.0d0 - (z * x)) / y) + (x / y)))
else if (t_0 <= 4d+291) then
tmp = t_0
else
tmp = abs(((((z * x) - 4.0d0) - x) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((((x + 4.0) / y) - ((x / y) * z)));
double tmp;
if (t_0 <= 2e-91) {
tmp = Math.abs((((4.0 - (z * x)) / y) + (x / y)));
} else if (t_0 <= 4e+291) {
tmp = t_0;
} else {
tmp = Math.abs(((((z * x) - 4.0) - x) / y));
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((((x + 4.0) / y) - ((x / y) * z))) tmp = 0 if t_0 <= 2e-91: tmp = math.fabs((((4.0 - (z * x)) / y) + (x / y))) elif t_0 <= 4e+291: tmp = t_0 else: tmp = math.fabs(((((z * x) - 4.0) - x) / y)) return tmp
function code(x, y, z) t_0 = abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) tmp = 0.0 if (t_0 <= 2e-91) tmp = abs(Float64(Float64(Float64(4.0 - Float64(z * x)) / y) + Float64(x / y))); elseif (t_0 <= 4e+291) tmp = t_0; else tmp = abs(Float64(Float64(Float64(Float64(z * x) - 4.0) - x) / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((((x + 4.0) / y) - ((x / y) * z))); tmp = 0.0; if (t_0 <= 2e-91) tmp = abs((((4.0 - (z * x)) / y) + (x / y))); elseif (t_0 <= 4e+291) tmp = t_0; else tmp = abs(((((z * x) - 4.0) - x) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(N[(x + 4), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 7339195571168229/36695977855841144185773134324833391052745039826692497979801421430190766017415756929120296849762010984873984], N[Abs[N[(N[(N[(4 - N[(z * x), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$0, 3999999999999999831443609401385136528614207512386057135410071092916132616022289914504946148287614500592330451563947454856809828080168025678726105499863496711154494173799977940229033050646983792107070529102452199587840315845272602181673858644271966678327153142116021922822752784275414552936448], t$95$0, N[Abs[N[(N[(N[(N[(z * x), $MachinePrecision] - 4), $MachinePrecision] - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|\\
\mathbf{if}\;t\_0 \leq \frac{7339195571168229}{36695977855841144185773134324833391052745039826692497979801421430190766017415756929120296849762010984873984}:\\
\;\;\;\;\left|\frac{4 - z \cdot x}{y} + \frac{x}{y}\right|\\
\mathbf{elif}\;t\_0 \leq 3999999999999999831443609401385136528614207512386057135410071092916132616022289914504946148287614500592330451563947454856809828080168025678726105499863496711154494173799977940229033050646983792107070529102452199587840315845272602181673858644271966678327153142116021922822752784275414552936448:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{\left(z \cdot x - 4\right) - x}{y}\right|\\
\end{array}
if (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 2e-91Initial program 92.2%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift-/.f64N/A
lift-+.f64N/A
div-addN/A
lift-/.f64N/A
associate-+l+N/A
+-commutativeN/A
lower-+.f64N/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6492.8%
Applied rewrites92.8%
if 2e-91 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) < 3.9999999999999998e291Initial program 92.2%
if 3.9999999999999998e291 < (fabs.f64 (-.f64 (/.f64 (+.f64 x #s(literal 4 binary64)) y) (*.f64 (/.f64 x y) z))) Initial program 92.2%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (134-z0z1z2z3z4 (/ 1 y) 4 1 z x))))
(if (<= z -4999999999999999965699095179735106473829597184)
t_0
(if (<=
z
699999999999999962599239418951134825273498349517073521493650464426374089253398435122312280289223336609586768632125540303233709625062010957121507716759552)
(fabs (/ (- (* x (- z 1)) 4) y))
t_0))))\begin{array}{l}
t_0 := \left|\mathsf{134\_z0z1z2z3z4}\left(\left(\frac{1}{y}\right), 4, 1, z, x\right)\right|\\
\mathbf{if}\;z \leq -4999999999999999965699095179735106473829597184:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 699999999999999962599239418951134825273498349517073521493650464426374089253398435122312280289223336609586768632125540303233709625062010957121507716759552:\\
\;\;\;\;\left|\frac{x \cdot \left(z - 1\right) - 4}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -5e45 or 6.9999999999999996e152 < z Initial program 92.2%
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites76.9%
if -5e45 < z < 6.9999999999999996e152Initial program 92.2%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower--.f6496.4%
Applied rewrites96.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* x (- (/ 1 y) (/ z y))))))
(if (<= x -100000000000000004764729344)
t_0
(if (<=
x
499999999999999988524756632622668314223421359962075003064997987365996726090394955651630647240755773440)
(fabs (/ (- (* x (- z 1)) 4) y))
t_0))))double code(double x, double y, double z) {
double t_0 = fabs((x * ((1.0 / y) - (z / y))));
double tmp;
if (x <= -1e+26) {
tmp = t_0;
} else if (x <= 5e+101) {
tmp = fabs((((x * (z - 1.0)) - 4.0) / y));
} else {
tmp = t_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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((x * ((1.0d0 / y) - (z / y))))
if (x <= (-1d+26)) then
tmp = t_0
else if (x <= 5d+101) then
tmp = abs((((x * (z - 1.0d0)) - 4.0d0) / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((x * ((1.0 / y) - (z / y))));
double tmp;
if (x <= -1e+26) {
tmp = t_0;
} else if (x <= 5e+101) {
tmp = Math.abs((((x * (z - 1.0)) - 4.0) / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((x * ((1.0 / y) - (z / y)))) tmp = 0 if x <= -1e+26: tmp = t_0 elif x <= 5e+101: tmp = math.fabs((((x * (z - 1.0)) - 4.0) / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(x * Float64(Float64(1.0 / y) - Float64(z / y)))) tmp = 0.0 if (x <= -1e+26) tmp = t_0; elseif (x <= 5e+101) tmp = abs(Float64(Float64(Float64(x * Float64(z - 1.0)) - 4.0) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((x * ((1.0 / y) - (z / y)))); tmp = 0.0; if (x <= -1e+26) tmp = t_0; elseif (x <= 5e+101) tmp = abs((((x * (z - 1.0)) - 4.0) / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x * N[(N[(1 / y), $MachinePrecision] - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -100000000000000004764729344], t$95$0, If[LessEqual[x, 499999999999999988524756632622668314223421359962075003064997987365996726090394955651630647240755773440], N[Abs[N[(N[(N[(x * N[(z - 1), $MachinePrecision]), $MachinePrecision] - 4), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left|x \cdot \left(\frac{1}{y} - \frac{z}{y}\right)\right|\\
\mathbf{if}\;x \leq -100000000000000004764729344:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 499999999999999988524756632622668314223421359962075003064997987365996726090394955651630647240755773440:\\
\;\;\;\;\left|\frac{x \cdot \left(z - 1\right) - 4}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -1e26 or 4.9999999999999999e101 < x Initial program 92.2%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6461.5%
Applied rewrites61.5%
if -1e26 < x < 4.9999999999999999e101Initial program 92.2%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower--.f6496.4%
Applied rewrites96.4%
(FPCore (x y z) :precision binary64 (fabs (134-z0z1z2z3z4 (/ 1 y) (- x -4) 1 z x)))
\left|\mathsf{134\_z0z1z2z3z4}\left(\left(\frac{1}{y}\right), \left(x - -4\right), 1, z, x\right)\right|
Initial program 92.2%
Applied rewrites99.8%
(FPCore (x y z)
:precision binary64
(if (<=
z
-5000000000000000282377055102604207074203131909915291873502825820777282819837890985946098807947299914898840846737681810482829903223034619386525800728016398897098919701520311599092821190412956384597997941526508766362009243481475645440)
(fabs (* (- x) (/ z y)))
(fabs (/ (- (* x (- z 1)) 4) y))))double code(double x, double y, double z) {
double tmp;
if (z <= -5e+231) {
tmp = fabs((-x * (z / y)));
} else {
tmp = fabs((((x * (z - 1.0)) - 4.0) / y));
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-5d+231)) then
tmp = abs((-x * (z / y)))
else
tmp = abs((((x * (z - 1.0d0)) - 4.0d0) / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -5e+231) {
tmp = Math.abs((-x * (z / y)));
} else {
tmp = Math.abs((((x * (z - 1.0)) - 4.0) / y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5e+231: tmp = math.fabs((-x * (z / y))) else: tmp = math.fabs((((x * (z - 1.0)) - 4.0) / y)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5e+231) tmp = abs(Float64(Float64(-x) * Float64(z / y))); else tmp = abs(Float64(Float64(Float64(x * Float64(z - 1.0)) - 4.0) / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5e+231) tmp = abs((-x * (z / y))); else tmp = abs((((x * (z - 1.0)) - 4.0) / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5000000000000000282377055102604207074203131909915291873502825820777282819837890985946098807947299914898840846737681810482829903223034619386525800728016398897098919701520311599092821190412956384597997941526508766362009243481475645440], N[Abs[N[((-x) * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(N[(x * N[(z - 1), $MachinePrecision]), $MachinePrecision] - 4), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z \leq -5000000000000000282377055102604207074203131909915291873502825820777282819837890985946098807947299914898840846737681810482829903223034619386525800728016398897098919701520311599092821190412956384597997941526508766362009243481475645440:\\
\;\;\;\;\left|\left(-x\right) \cdot \frac{z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x \cdot \left(z - 1\right) - 4}{y}\right|\\
\end{array}
if z < -5.0000000000000003e231Initial program 92.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6437.1%
Applied rewrites37.1%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
associate-*l/N/A
associate-/l*N/A
lift-/.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6439.0%
Applied rewrites39.0%
if -5.0000000000000003e231 < z Initial program 92.2%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower--.f6496.4%
Applied rewrites96.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ (* x (- z 1)) y))))
(if (<= x -212)
t_0
(if (<= x 11/2) (fabs (/ (- (* x z) 4) y)) t_0))))double code(double x, double y, double z) {
double t_0 = fabs(((x * (z - 1.0)) / y));
double tmp;
if (x <= -212.0) {
tmp = t_0;
} else if (x <= 5.5) {
tmp = fabs((((x * z) - 4.0) / y));
} else {
tmp = t_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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs(((x * (z - 1.0d0)) / y))
if (x <= (-212.0d0)) then
tmp = t_0
else if (x <= 5.5d0) then
tmp = abs((((x * z) - 4.0d0) / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs(((x * (z - 1.0)) / y));
double tmp;
if (x <= -212.0) {
tmp = t_0;
} else if (x <= 5.5) {
tmp = Math.abs((((x * z) - 4.0) / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs(((x * (z - 1.0)) / y)) tmp = 0 if x <= -212.0: tmp = t_0 elif x <= 5.5: tmp = math.fabs((((x * z) - 4.0) / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(Float64(x * Float64(z - 1.0)) / y)) tmp = 0.0 if (x <= -212.0) tmp = t_0; elseif (x <= 5.5) tmp = abs(Float64(Float64(Float64(x * z) - 4.0) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs(((x * (z - 1.0)) / y)); tmp = 0.0; if (x <= -212.0) tmp = t_0; elseif (x <= 5.5) tmp = abs((((x * z) - 4.0) / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(x * N[(z - 1), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -212], t$95$0, If[LessEqual[x, 11/2], N[Abs[N[(N[(N[(x * z), $MachinePrecision] - 4), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left|\frac{x \cdot \left(z - 1\right)}{y}\right|\\
\mathbf{if}\;x \leq -212:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq \frac{11}{2}:\\
\;\;\;\;\left|\frac{x \cdot z - 4}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -212 or 5.5 < x Initial program 92.2%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f6459.6%
Applied rewrites59.6%
if -212 < x < 5.5Initial program 92.2%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
Taylor expanded in x around 0
lower--.f64N/A
lower-*.f64N/A
lower--.f6496.4%
Applied rewrites96.4%
Taylor expanded in z around inf
lower-*.f6473.5%
Applied rewrites73.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* (- x) (/ z y)))))
(if (<=
z
-28999999999999998464120220974988138453039504620863880001971619371869304592430947864765457768030427676672)
t_0
(if (<=
z
1349999999999999906355496506828360125520427059234156687607193436946432)
(fabs (/ (- -4 x) y))
t_0))))double code(double x, double y, double z) {
double t_0 = fabs((-x * (z / y)));
double tmp;
if (z <= -2.9e+103) {
tmp = t_0;
} else if (z <= 1.35e+69) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = t_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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((-x * (z / y)))
if (z <= (-2.9d+103)) then
tmp = t_0
else if (z <= 1.35d+69) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((-x * (z / y)));
double tmp;
if (z <= -2.9e+103) {
tmp = t_0;
} else if (z <= 1.35e+69) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((-x * (z / y))) tmp = 0 if z <= -2.9e+103: tmp = t_0 elif z <= 1.35e+69: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(Float64(-x) * Float64(z / y))) tmp = 0.0 if (z <= -2.9e+103) tmp = t_0; elseif (z <= 1.35e+69) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((-x * (z / y))); tmp = 0.0; if (z <= -2.9e+103) tmp = t_0; elseif (z <= 1.35e+69) tmp = abs(((-4.0 - x) / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[((-x) * N[(z / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -28999999999999998464120220974988138453039504620863880001971619371869304592430947864765457768030427676672], t$95$0, If[LessEqual[z, 1349999999999999906355496506828360125520427059234156687607193436946432], N[Abs[N[(N[(-4 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left|\left(-x\right) \cdot \frac{z}{y}\right|\\
\mathbf{if}\;z \leq -28999999999999998464120220974988138453039504620863880001971619371869304592430947864765457768030427676672:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1349999999999999906355496506828360125520427059234156687607193436946432:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -2.8999999999999998e103 or 1.3499999999999999e69 < z Initial program 92.2%
Taylor expanded in z around inf
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6437.1%
Applied rewrites37.1%
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
associate-*l/N/A
associate-/l*N/A
lift-/.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6439.0%
Applied rewrites39.0%
if -2.8999999999999998e103 < z < 1.3499999999999999e69Initial program 92.2%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
Taylor expanded in x around 0
Applied rewrites70.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (/ (* x z) y))))
(if (<=
z
-28999999999999998464120220974988138453039504620863880001971619371869304592430947864765457768030427676672)
t_0
(if (<=
z
1349999999999999906355496506828360125520427059234156687607193436946432)
(fabs (/ (- -4 x) y))
t_0))))double code(double x, double y, double z) {
double t_0 = fabs(((x * z) / y));
double tmp;
if (z <= -2.9e+103) {
tmp = t_0;
} else if (z <= 1.35e+69) {
tmp = fabs(((-4.0 - x) / y));
} else {
tmp = t_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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs(((x * z) / y))
if (z <= (-2.9d+103)) then
tmp = t_0
else if (z <= 1.35d+69) then
tmp = abs((((-4.0d0) - x) / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs(((x * z) / y));
double tmp;
if (z <= -2.9e+103) {
tmp = t_0;
} else if (z <= 1.35e+69) {
tmp = Math.abs(((-4.0 - x) / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs(((x * z) / y)) tmp = 0 if z <= -2.9e+103: tmp = t_0 elif z <= 1.35e+69: tmp = math.fabs(((-4.0 - x) / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(Float64(x * z) / y)) tmp = 0.0 if (z <= -2.9e+103) tmp = t_0; elseif (z <= 1.35e+69) tmp = abs(Float64(Float64(-4.0 - x) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs(((x * z) / y)); tmp = 0.0; if (z <= -2.9e+103) tmp = t_0; elseif (z <= 1.35e+69) tmp = abs(((-4.0 - x) / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(x * z), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[z, -28999999999999998464120220974988138453039504620863880001971619371869304592430947864765457768030427676672], t$95$0, If[LessEqual[z, 1349999999999999906355496506828360125520427059234156687607193436946432], N[Abs[N[(N[(-4 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left|\frac{x \cdot z}{y}\right|\\
\mathbf{if}\;z \leq -28999999999999998464120220974988138453039504620863880001971619371869304592430947864765457768030427676672:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1349999999999999906355496506828360125520427059234156687607193436946432:\\
\;\;\;\;\left|\frac{-4 - x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z < -2.8999999999999998e103 or 1.3499999999999999e69 < z Initial program 92.2%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f6459.6%
Applied rewrites59.6%
Taylor expanded in z around inf
lower-*.f6437.1%
Applied rewrites37.1%
if -2.8999999999999998e103 < z < 1.3499999999999999e69Initial program 92.2%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
Taylor expanded in x around 0
Applied rewrites70.4%
(FPCore (x y z) :precision binary64 (fabs (/ (- -4 x) y)))
double code(double x, double y, double z) {
return fabs(((-4.0 - x) / 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((((-4.0d0) - x) / y))
end function
public static double code(double x, double y, double z) {
return Math.abs(((-4.0 - x) / y));
}
def code(x, y, z): return math.fabs(((-4.0 - x) / y))
function code(x, y, z) return abs(Float64(Float64(-4.0 - x) / y)) end
function tmp = code(x, y, z) tmp = abs(((-4.0 - x) / y)); end
code[x_, y_, z_] := N[Abs[N[(N[(-4 - x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision]
\left|\frac{-4 - x}{y}\right|
Initial program 92.2%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
Taylor expanded in x around 0
Applied rewrites70.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fabs (/ x y)))) (if (<= x -245) t_0 (if (<= x 11/2) (fabs (/ -4 y)) t_0))))
double code(double x, double y, double z) {
double t_0 = fabs((x / y));
double tmp;
if (x <= -245.0) {
tmp = t_0;
} else if (x <= 5.5) {
tmp = fabs((-4.0 / y));
} else {
tmp = t_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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = abs((x / y))
if (x <= (-245.0d0)) then
tmp = t_0
else if (x <= 5.5d0) then
tmp = abs(((-4.0d0) / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((x / y));
double tmp;
if (x <= -245.0) {
tmp = t_0;
} else if (x <= 5.5) {
tmp = Math.abs((-4.0 / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((x / y)) tmp = 0 if x <= -245.0: tmp = t_0 elif x <= 5.5: tmp = math.fabs((-4.0 / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(x / y)) tmp = 0.0 if (x <= -245.0) tmp = t_0; elseif (x <= 5.5) tmp = abs(Float64(-4.0 / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((x / y)); tmp = 0.0; if (x <= -245.0) tmp = t_0; elseif (x <= 5.5) tmp = abs((-4.0 / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -245], t$95$0, If[LessEqual[x, 11/2], N[Abs[N[(-4 / y), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -245:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq \frac{11}{2}:\\
\;\;\;\;\left|\frac{-4}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if x < -245 or 5.5 < x Initial program 92.2%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6461.5%
Applied rewrites61.5%
Taylor expanded in z around 0
lower-/.f6434.1%
Applied rewrites34.1%
if -245 < x < 5.5Initial program 92.2%
lift-fabs.f64N/A
lift--.f64N/A
fabs-subN/A
lower-fabs.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-/.f64N/A
sub-divN/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6496.4%
Applied rewrites96.4%
Taylor expanded in x around 0
lower-/.f6440.6%
Applied rewrites40.6%
(FPCore (x y z) :precision binary64 (fabs (/ x y)))
double code(double x, double y, double z) {
return fabs((x / 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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((x / y))
end function
public static double code(double x, double y, double z) {
return Math.abs((x / y));
}
def code(x, y, z): return math.fabs((x / y))
function code(x, y, z) return abs(Float64(x / y)) end
function tmp = code(x, y, z) tmp = abs((x / y)); end
code[x_, y_, z_] := N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]
\left|\frac{x}{y}\right|
Initial program 92.2%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6461.5%
Applied rewrites61.5%
Taylor expanded in z around 0
lower-/.f6434.1%
Applied rewrites34.1%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4) y) (* (/ x y) z))))