
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (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 * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot \left(y - z\right)}{t - z}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (* x (- y z)) (- t z)))
double code(double x, double y, double z, double t) {
return (x * (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 * (y - z)) / (t - z)
end function
public static double code(double x, double y, double z, double t) {
return (x * (y - z)) / (t - z);
}
def code(x, y, z, t): return (x * (y - z)) / (t - z)
function code(x, y, z, t) return Float64(Float64(x * Float64(y - z)) / Float64(t - z)) end
function tmp = code(x, y, z, t) tmp = (x * (y - z)) / (t - z); end
code[x_, y_, z_, t_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]
\frac{x \cdot \left(y - z\right)}{t - z}
(FPCore (x y z t) :precision binary64 (* (/ (- z y) (- z t)) x))
double code(double x, double y, double z, double t) {
return ((z - y) / (z - t)) * x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((z - y) / (z - t)) * x
end function
public static double code(double x, double y, double z, double t) {
return ((z - y) / (z - t)) * x;
}
def code(x, y, z, t): return ((z - y) / (z - t)) * x
function code(x, y, z, t) return Float64(Float64(Float64(z - y) / Float64(z - t)) * x) end
function tmp = code(x, y, z, t) tmp = ((z - y) / (z - t)) * x; end
code[x_, y_, z_, t_] := N[(N[(N[(z - y), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]
\frac{z - y}{z - t} \cdot x
Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ (fabs x) (- z t)) (- z y)))
(t_2 (/ (* (fabs x) (- y z)) (- t z))))
(*
(copysign 1.0 x)
(if (<= t_2 0.0)
t_1
(if (<= t_2 2e-137) (* (/ z (- z t)) (fabs x)) t_1)))))double code(double x, double y, double z, double t) {
double t_1 = (fabs(x) / (z - t)) * (z - y);
double t_2 = (fabs(x) * (y - z)) / (t - z);
double tmp;
if (t_2 <= 0.0) {
tmp = t_1;
} else if (t_2 <= 2e-137) {
tmp = (z / (z - t)) * fabs(x);
} else {
tmp = t_1;
}
return copysign(1.0, x) * tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (Math.abs(x) / (z - t)) * (z - y);
double t_2 = (Math.abs(x) * (y - z)) / (t - z);
double tmp;
if (t_2 <= 0.0) {
tmp = t_1;
} else if (t_2 <= 2e-137) {
tmp = (z / (z - t)) * Math.abs(x);
} else {
tmp = t_1;
}
return Math.copySign(1.0, x) * tmp;
}
def code(x, y, z, t): t_1 = (math.fabs(x) / (z - t)) * (z - y) t_2 = (math.fabs(x) * (y - z)) / (t - z) tmp = 0 if t_2 <= 0.0: tmp = t_1 elif t_2 <= 2e-137: tmp = (z / (z - t)) * math.fabs(x) else: tmp = t_1 return math.copysign(1.0, x) * tmp
function code(x, y, z, t) t_1 = Float64(Float64(abs(x) / Float64(z - t)) * Float64(z - y)) t_2 = Float64(Float64(abs(x) * Float64(y - z)) / Float64(t - z)) tmp = 0.0 if (t_2 <= 0.0) tmp = t_1; elseif (t_2 <= 2e-137) tmp = Float64(Float64(z / Float64(z - t)) * abs(x)); else tmp = t_1; end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(x, y, z, t) t_1 = (abs(x) / (z - t)) * (z - y); t_2 = (abs(x) * (y - z)) / (t - z); tmp = 0.0; if (t_2 <= 0.0) tmp = t_1; elseif (t_2 <= 2e-137) tmp = (z / (z - t)) * abs(x); else tmp = t_1; end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Abs[x], $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Abs[x], $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$2, 0.0], t$95$1, If[LessEqual[t$95$2, 2e-137], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \frac{\left|x\right|}{z - t} \cdot \left(z - y\right)\\
t_2 := \frac{\left|x\right| \cdot \left(y - z\right)}{t - z}\\
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-137}:\\
\;\;\;\;\frac{z}{z - t} \cdot \left|x\right|\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -0.0 or 2e-137 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 84.2%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6484.6%
Applied rewrites84.6%
if -0.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 2e-137Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in y around 0
Applied rewrites54.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -5.8e+37)
(* (- 1.0 (/ y z)) x)
(if (<= z -3.5e-36)
(* (/ (- y z) t) x)
(if (<= z 6e-12) (/ (* x y) (- t z)) (* (/ z (- z t)) x)))))double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+37) {
tmp = (1.0 - (y / z)) * x;
} else if (z <= -3.5e-36) {
tmp = ((y - z) / t) * x;
} else if (z <= 6e-12) {
tmp = (x * y) / (t - z);
} else {
tmp = (z / (z - t)) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-5.8d+37)) then
tmp = (1.0d0 - (y / z)) * x
else if (z <= (-3.5d-36)) then
tmp = ((y - z) / t) * x
else if (z <= 6d-12) then
tmp = (x * y) / (t - z)
else
tmp = (z / (z - t)) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+37) {
tmp = (1.0 - (y / z)) * x;
} else if (z <= -3.5e-36) {
tmp = ((y - z) / t) * x;
} else if (z <= 6e-12) {
tmp = (x * y) / (t - z);
} else {
tmp = (z / (z - t)) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.8e+37: tmp = (1.0 - (y / z)) * x elif z <= -3.5e-36: tmp = ((y - z) / t) * x elif z <= 6e-12: tmp = (x * y) / (t - z) else: tmp = (z / (z - t)) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.8e+37) tmp = Float64(Float64(1.0 - Float64(y / z)) * x); elseif (z <= -3.5e-36) tmp = Float64(Float64(Float64(y - z) / t) * x); elseif (z <= 6e-12) tmp = Float64(Float64(x * y) / Float64(t - z)); else tmp = Float64(Float64(z / Float64(z - t)) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.8e+37) tmp = (1.0 - (y / z)) * x; elseif (z <= -3.5e-36) tmp = ((y - z) / t) * x; elseif (z <= 6e-12) tmp = (x * y) / (t - z); else tmp = (z / (z - t)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.8e+37], N[(N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -3.5e-36], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 6e-12], N[(N[(x * y), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+37}:\\
\;\;\;\;\left(1 - \frac{y}{z}\right) \cdot x\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{-36}:\\
\;\;\;\;\frac{y - z}{t} \cdot x\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-12}:\\
\;\;\;\;\frac{x \cdot y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\end{array}
if z < -5.7999999999999996e37Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6452.7%
Applied rewrites52.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
*-inversesN/A
lower--.f64N/A
lower-/.f6452.7%
Applied rewrites52.7%
if -5.7999999999999996e37 < z < -3.5e-36Initial program 84.2%
Taylor expanded in z around 0
Applied rewrites47.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.1%
Applied rewrites50.1%
if -3.5e-36 < z < 6.0000000000000003e-12Initial program 84.2%
Taylor expanded in y around inf
lower-*.f6449.8%
Applied rewrites49.8%
if 6.0000000000000003e-12 < z Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in y around 0
Applied rewrites54.2%
(FPCore (x y z t) :precision binary64 (if (<= z -5.8e+37) (* (- 1.0 (/ y z)) x) (if (<= z 3.85e-13) (* (/ (- y z) t) x) (* (/ z (- z t)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+37) {
tmp = (1.0 - (y / z)) * x;
} else if (z <= 3.85e-13) {
tmp = ((y - z) / t) * x;
} else {
tmp = (z / (z - t)) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-5.8d+37)) then
tmp = (1.0d0 - (y / z)) * x
else if (z <= 3.85d-13) then
tmp = ((y - z) / t) * x
else
tmp = (z / (z - t)) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+37) {
tmp = (1.0 - (y / z)) * x;
} else if (z <= 3.85e-13) {
tmp = ((y - z) / t) * x;
} else {
tmp = (z / (z - t)) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.8e+37: tmp = (1.0 - (y / z)) * x elif z <= 3.85e-13: tmp = ((y - z) / t) * x else: tmp = (z / (z - t)) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.8e+37) tmp = Float64(Float64(1.0 - Float64(y / z)) * x); elseif (z <= 3.85e-13) tmp = Float64(Float64(Float64(y - z) / t) * x); else tmp = Float64(Float64(z / Float64(z - t)) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.8e+37) tmp = (1.0 - (y / z)) * x; elseif (z <= 3.85e-13) tmp = ((y - z) / t) * x; else tmp = (z / (z - t)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.8e+37], N[(N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 3.85e-13], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * x), $MachinePrecision], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+37}:\\
\;\;\;\;\left(1 - \frac{y}{z}\right) \cdot x\\
\mathbf{elif}\;z \leq 3.85 \cdot 10^{-13}:\\
\;\;\;\;\frac{y - z}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\end{array}
if z < -5.7999999999999996e37Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6452.7%
Applied rewrites52.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
*-inversesN/A
lower--.f64N/A
lower-/.f6452.7%
Applied rewrites52.7%
if -5.7999999999999996e37 < z < 3.8499999999999998e-13Initial program 84.2%
Taylor expanded in z around 0
Applied rewrites47.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.1%
Applied rewrites50.1%
if 3.8499999999999998e-13 < z Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in y around 0
Applied rewrites54.2%
(FPCore (x y z t) :precision binary64 (if (<= z -2e+37) (* (- 1.0 (/ y z)) x) (if (<= z 2e-24) (* (/ x t) (- y z)) (* (/ z (- z t)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2e+37) {
tmp = (1.0 - (y / z)) * x;
} else if (z <= 2e-24) {
tmp = (x / t) * (y - z);
} else {
tmp = (z / (z - t)) * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2d+37)) then
tmp = (1.0d0 - (y / z)) * x
else if (z <= 2d-24) then
tmp = (x / t) * (y - z)
else
tmp = (z / (z - t)) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2e+37) {
tmp = (1.0 - (y / z)) * x;
} else if (z <= 2e-24) {
tmp = (x / t) * (y - z);
} else {
tmp = (z / (z - t)) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2e+37: tmp = (1.0 - (y / z)) * x elif z <= 2e-24: tmp = (x / t) * (y - z) else: tmp = (z / (z - t)) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2e+37) tmp = Float64(Float64(1.0 - Float64(y / z)) * x); elseif (z <= 2e-24) tmp = Float64(Float64(x / t) * Float64(y - z)); else tmp = Float64(Float64(z / Float64(z - t)) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2e+37) tmp = (1.0 - (y / z)) * x; elseif (z <= 2e-24) tmp = (x / t) * (y - z); else tmp = (z / (z - t)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2e+37], N[(N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 2e-24], N[(N[(x / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+37}:\\
\;\;\;\;\left(1 - \frac{y}{z}\right) \cdot x\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-24}:\\
\;\;\;\;\frac{x}{t} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\end{array}
if z < -1.9999999999999999e37Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6452.7%
Applied rewrites52.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
*-inversesN/A
lower--.f64N/A
lower-/.f6452.7%
Applied rewrites52.7%
if -1.9999999999999999e37 < z < 1.9999999999999998e-24Initial program 84.2%
Taylor expanded in z around 0
Applied rewrites47.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6447.2%
Applied rewrites47.2%
if 1.9999999999999998e-24 < z Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in y around 0
Applied rewrites54.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- 1.0 (/ y z)) x))) (if (<= z -2e+37) t_1 (if (<= z 1.8e+126) (* (/ x t) (- y z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (1.0 - (y / z)) * x;
double tmp;
if (z <= -2e+37) {
tmp = t_1;
} else if (z <= 1.8e+126) {
tmp = (x / t) * (y - z);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (1.0d0 - (y / z)) * x
if (z <= (-2d+37)) then
tmp = t_1
else if (z <= 1.8d+126) then
tmp = (x / t) * (y - z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (1.0 - (y / z)) * x;
double tmp;
if (z <= -2e+37) {
tmp = t_1;
} else if (z <= 1.8e+126) {
tmp = (x / t) * (y - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (1.0 - (y / z)) * x tmp = 0 if z <= -2e+37: tmp = t_1 elif z <= 1.8e+126: tmp = (x / t) * (y - z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(1.0 - Float64(y / z)) * x) tmp = 0.0 if (z <= -2e+37) tmp = t_1; elseif (z <= 1.8e+126) tmp = Float64(Float64(x / t) * Float64(y - z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (1.0 - (y / z)) * x; tmp = 0.0; if (z <= -2e+37) tmp = t_1; elseif (z <= 1.8e+126) tmp = (x / t) * (y - z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -2e+37], t$95$1, If[LessEqual[z, 1.8e+126], N[(N[(x / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(1 - \frac{y}{z}\right) \cdot x\\
\mathbf{if}\;z \leq -2 \cdot 10^{+37}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+126}:\\
\;\;\;\;\frac{x}{t} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1.9999999999999999e37 or 1.8e126 < z Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6452.7%
Applied rewrites52.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
*-inversesN/A
lower--.f64N/A
lower-/.f6452.7%
Applied rewrites52.7%
if -1.9999999999999999e37 < z < 1.8e126Initial program 84.2%
Taylor expanded in z around 0
Applied rewrites47.1%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6447.2%
Applied rewrites47.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- 1.0 (/ y z)) x))) (if (<= z -5.5e-52) t_1 (if (<= z 6.2e+31) (/ (* x y) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (1.0 - (y / z)) * x;
double tmp;
if (z <= -5.5e-52) {
tmp = t_1;
} else if (z <= 6.2e+31) {
tmp = (x * y) / t;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (1.0d0 - (y / z)) * x
if (z <= (-5.5d-52)) then
tmp = t_1
else if (z <= 6.2d+31) then
tmp = (x * y) / t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (1.0 - (y / z)) * x;
double tmp;
if (z <= -5.5e-52) {
tmp = t_1;
} else if (z <= 6.2e+31) {
tmp = (x * y) / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (1.0 - (y / z)) * x tmp = 0 if z <= -5.5e-52: tmp = t_1 elif z <= 6.2e+31: tmp = (x * y) / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(1.0 - Float64(y / z)) * x) tmp = 0.0 if (z <= -5.5e-52) tmp = t_1; elseif (z <= 6.2e+31) tmp = Float64(Float64(x * y) / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (1.0 - (y / z)) * x; tmp = 0.0; if (z <= -5.5e-52) tmp = t_1; elseif (z <= 6.2e+31) tmp = (x * y) / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(1.0 - N[(y / z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -5.5e-52], t$95$1, If[LessEqual[z, 6.2e+31], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \left(1 - \frac{y}{z}\right) \cdot x\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{-52}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+31}:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -5.5e-52 or 6.2000000000000004e31 < z Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6452.7%
Applied rewrites52.7%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
*-inversesN/A
lower--.f64N/A
lower-/.f6452.7%
Applied rewrites52.7%
if -5.5e-52 < z < 6.2000000000000004e31Initial program 84.2%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6436.8%
Applied rewrites36.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -1.15e+238)
(* 1.0 x)
(if (<= z -5.5e-52)
(* (/ x z) (- z y))
(if (<= z 8.5e+32) (/ (* x y) t) (* 1.0 x)))))double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.15e+238) {
tmp = 1.0 * x;
} else if (z <= -5.5e-52) {
tmp = (x / z) * (z - y);
} else if (z <= 8.5e+32) {
tmp = (x * y) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.15d+238)) then
tmp = 1.0d0 * x
else if (z <= (-5.5d-52)) then
tmp = (x / z) * (z - y)
else if (z <= 8.5d+32) then
tmp = (x * y) / t
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.15e+238) {
tmp = 1.0 * x;
} else if (z <= -5.5e-52) {
tmp = (x / z) * (z - y);
} else if (z <= 8.5e+32) {
tmp = (x * y) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.15e+238: tmp = 1.0 * x elif z <= -5.5e-52: tmp = (x / z) * (z - y) elif z <= 8.5e+32: tmp = (x * y) / t else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.15e+238) tmp = Float64(1.0 * x); elseif (z <= -5.5e-52) tmp = Float64(Float64(x / z) * Float64(z - y)); elseif (z <= 8.5e+32) tmp = Float64(Float64(x * y) / t); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.15e+238) tmp = 1.0 * x; elseif (z <= -5.5e-52) tmp = (x / z) * (z - y); elseif (z <= 8.5e+32) tmp = (x * y) / t; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.15e+238], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, -5.5e-52], N[(N[(x / z), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e+32], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+238}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-52}:\\
\;\;\;\;\frac{x}{z} \cdot \left(z - y\right)\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+32}:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -1.15e238 or 8.4999999999999998e32 < z Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in z around inf
Applied rewrites34.6%
if -1.15e238 < z < -5.5e-52Initial program 84.2%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lower--.f6484.6%
Applied rewrites84.6%
Taylor expanded in z around inf
lower-/.f6444.1%
Applied rewrites44.1%
if -5.5e-52 < z < 8.4999999999999998e32Initial program 84.2%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6436.8%
Applied rewrites36.8%
(FPCore (x y z t)
:precision binary64
(if (<= z -3.3e+211)
(* 1.0 x)
(if (<= z -5.5e-52)
(/ (* x (- z y)) z)
(if (<= z 8.5e+32) (/ (* x y) t) (* 1.0 x)))))double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.3e+211) {
tmp = 1.0 * x;
} else if (z <= -5.5e-52) {
tmp = (x * (z - y)) / z;
} else if (z <= 8.5e+32) {
tmp = (x * y) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-3.3d+211)) then
tmp = 1.0d0 * x
else if (z <= (-5.5d-52)) then
tmp = (x * (z - y)) / z
else if (z <= 8.5d+32) then
tmp = (x * y) / t
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.3e+211) {
tmp = 1.0 * x;
} else if (z <= -5.5e-52) {
tmp = (x * (z - y)) / z;
} else if (z <= 8.5e+32) {
tmp = (x * y) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.3e+211: tmp = 1.0 * x elif z <= -5.5e-52: tmp = (x * (z - y)) / z elif z <= 8.5e+32: tmp = (x * y) / t else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.3e+211) tmp = Float64(1.0 * x); elseif (z <= -5.5e-52) tmp = Float64(Float64(x * Float64(z - y)) / z); elseif (z <= 8.5e+32) tmp = Float64(Float64(x * y) / t); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.3e+211) tmp = 1.0 * x; elseif (z <= -5.5e-52) tmp = (x * (z - y)) / z; elseif (z <= 8.5e+32) tmp = (x * y) / t; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.3e+211], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, -5.5e-52], N[(N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 8.5e+32], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+211}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-52}:\\
\;\;\;\;\frac{x \cdot \left(z - y\right)}{z}\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+32}:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -3.2999999999999998e211 or 8.4999999999999998e32 < z Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in z around inf
Applied rewrites34.6%
if -3.2999999999999998e211 < z < -5.5e-52Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6445.1%
Applied rewrites45.1%
if -5.5e-52 < z < 8.4999999999999998e32Initial program 84.2%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6436.8%
Applied rewrites36.8%
(FPCore (x y z t) :precision binary64 (if (<= z -1.32e+38) (* 1.0 x) (if (<= z 8.5e+32) (/ (* x y) t) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.32e+38) {
tmp = 1.0 * x;
} else if (z <= 8.5e+32) {
tmp = (x * y) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.32d+38)) then
tmp = 1.0d0 * x
else if (z <= 8.5d+32) then
tmp = (x * y) / t
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.32e+38) {
tmp = 1.0 * x;
} else if (z <= 8.5e+32) {
tmp = (x * y) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.32e+38: tmp = 1.0 * x elif z <= 8.5e+32: tmp = (x * y) / t else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.32e+38) tmp = Float64(1.0 * x); elseif (z <= 8.5e+32) tmp = Float64(Float64(x * y) / t); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.32e+38) tmp = 1.0 * x; elseif (z <= 8.5e+32) tmp = (x * y) / t; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.32e+38], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 8.5e+32], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{+38}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+32}:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -1.32e38 or 8.4999999999999998e32 < z Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in z around inf
Applied rewrites34.6%
if -1.32e38 < z < 8.4999999999999998e32Initial program 84.2%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6436.8%
Applied rewrites36.8%
(FPCore (x y z t) :precision binary64 (if (<= z -1.32e+38) (* 1.0 x) (if (<= z 8e-15) (* (/ x t) y) (* 1.0 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.32e+38) {
tmp = 1.0 * x;
} else if (z <= 8e-15) {
tmp = (x / t) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.32d+38)) then
tmp = 1.0d0 * x
else if (z <= 8d-15) then
tmp = (x / t) * y
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.32e+38) {
tmp = 1.0 * x;
} else if (z <= 8e-15) {
tmp = (x / t) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.32e+38: tmp = 1.0 * x elif z <= 8e-15: tmp = (x / t) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.32e+38) tmp = Float64(1.0 * x); elseif (z <= 8e-15) tmp = Float64(Float64(x / t) * y); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.32e+38) tmp = 1.0 * x; elseif (z <= 8e-15) tmp = (x / t) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.32e+38], N[(1.0 * x), $MachinePrecision], If[LessEqual[z, 8e-15], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{+38}:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-15}:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -1.32e38 or 8.0000000000000006e-15 < z Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in z around inf
Applied rewrites34.6%
if -1.32e38 < z < 8.0000000000000006e-15Initial program 84.2%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6436.8%
Applied rewrites36.8%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6436.9%
Applied rewrites36.9%
(FPCore (x y z t) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t) {
return 1.0 * x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t) {
return 1.0 * x;
}
def code(x, y, z, t): return 1.0 * x
function code(x, y, z, t) return Float64(1.0 * x) end
function tmp = code(x, y, z, t) tmp = 1.0 * x; end
code[x_, y_, z_, t_] := N[(1.0 * x), $MachinePrecision]
1 \cdot x
Initial program 84.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
frac-2negN/A
lift--.f64N/A
sub-negate-revN/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.1%
Applied rewrites97.1%
Taylor expanded in z around inf
Applied rewrites34.6%
herbie shell --seed 2025258
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
(/ (* x (- y z)) (- t z)))