
(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 15 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 (134-z0z1z2z3z4 (/ -1 (- z t)) y x z x))
\mathsf{134\_z0z1z2z3z4}\left(\left(\frac{-1}{z - t}\right), y, x, z, x\right)
Initial program 84.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift-*.f64N/A
lift--.f64N/A
distribute-rgt-out--N/A
lower-134-z0z1z2z3z4N/A
frac-2negN/A
metadata-evalN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6499.7%
Applied rewrites99.7%
(FPCore (x y z t) :precision binary64 (/ x (/ (- t z) (- y z))))
double code(double x, double y, double z, double t) {
return x / ((t - z) / (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, 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 / ((t - z) / (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x / ((t - z) / (y - z));
}
def code(x, y, z, t): return x / ((t - z) / (y - z))
function code(x, y, z, t) return Float64(x / Float64(Float64(t - z) / Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x / ((t - z) / (y - z)); end
code[x_, y_, z_, t_] := N[(x / N[(N[(t - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x}{\frac{t - z}{y - z}}
Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
lift-/.f64N/A
mult-flipN/A
metadata-evalN/A
associate-*r/N/A
div-flipN/A
metadata-evalN/A
metadata-evalN/A
*-rgt-identityN/A
lower-unsound-/.f64N/A
metadata-evalN/A
lower-unsound-/.f6496.7%
Applied rewrites96.7%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6497.0%
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
(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.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ (fabs x) (- z t)) (- z y)))
(t_2 (* (fabs x) (- y z)))
(t_3 (/ t_2 (- t z))))
(*
(copysign 1 x)
(if (<=
t_3
-4789048565205903/11972621413014756705924586149611790497021399392059392)
t_1
(if (<=
t_3
-10120113/202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784)
(/ t_2 t)
(if (<=
t_3
1723641332219371/344728266443874206170545512964432112225507069317819522056079337263512430464013488758041250121488036739611555846958495676040441511948045769973944468809441663382665538511073745187088876036706973599091474545756168257536)
(* (/ 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);
double t_3 = t_2 / (t - z);
double tmp;
if (t_3 <= -4e-37) {
tmp = t_1;
} else if (t_3 <= -5e-317) {
tmp = t_2 / t;
} else if (t_3 <= 5e-201) {
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);
double t_3 = t_2 / (t - z);
double tmp;
if (t_3 <= -4e-37) {
tmp = t_1;
} else if (t_3 <= -5e-317) {
tmp = t_2 / t;
} else if (t_3 <= 5e-201) {
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_3 = t_2 / (t - z) tmp = 0 if t_3 <= -4e-37: tmp = t_1 elif t_3 <= -5e-317: tmp = t_2 / t elif t_3 <= 5e-201: 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(abs(x) * Float64(y - z)) t_3 = Float64(t_2 / Float64(t - z)) tmp = 0.0 if (t_3 <= -4e-37) tmp = t_1; elseif (t_3 <= -5e-317) tmp = Float64(t_2 / t); elseif (t_3 <= 5e-201) 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_3 = t_2 / (t - z); tmp = 0.0; if (t_3 <= -4e-37) tmp = t_1; elseif (t_3 <= -5e-317) tmp = t_2 / t; elseif (t_3 <= 5e-201) 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[Abs[x], $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[(t - z), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, -4789048565205903/11972621413014756705924586149611790497021399392059392], t$95$1, If[LessEqual[t$95$3, -10120113/202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784], N[(t$95$2 / t), $MachinePrecision], If[LessEqual[t$95$3, 1723641332219371/344728266443874206170545512964432112225507069317819522056079337263512430464013488758041250121488036739611555846958495676040441511948045769973944468809441663382665538511073745187088876036706973599091474545756168257536], 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 := \left|x\right| \cdot \left(y - z\right)\\
t_3 := \frac{t\_2}{t - z}\\
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq \frac{-4789048565205903}{11972621413014756705924586149611790497021399392059392}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_3 \leq \frac{-10120113}{202402253307310618352495346718917307049556649764142118356901358027430339567995346891960383701437124495187077864316811911389808737385793476867013399940738509921517424276566361364466907742093216341239767678472745068562007483424692698618103355649159556340810056512358769552333414615230502532186327508646006263307707741093494784}:\\
\;\;\;\;\frac{t\_2}{t}\\
\mathbf{elif}\;t\_3 \leq \frac{1723641332219371}{344728266443874206170545512964432112225507069317819522056079337263512430464013488758041250121488036739611555846958495676040441511948045769973944468809441663382665538511073745187088876036706973599091474545756168257536}:\\
\;\;\;\;\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)) < -4.0000000000000003e-37 or 4.9999999999999999e-201 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 84.1%
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--.f6485.1%
Applied rewrites85.1%
if -4.0000000000000003e-37 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -5.0000001653313951e-317Initial program 84.1%
Taylor expanded in z around 0
Applied rewrites48.1%
if -5.0000001653313951e-317 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 4.9999999999999999e-201Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in y around 0
Applied rewrites54.3%
(FPCore (x y z t) :precision binary64 (if (<= z -170000000000000) (* (/ (- z y) z) x) (if (<= z 7900) (/ (* x y) (- t z)) (* (/ z (- z t)) x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.7e+14) {
tmp = ((z - y) / z) * x;
} else if (z <= 7900.0) {
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 <= (-1.7d+14)) then
tmp = ((z - y) / z) * x
else if (z <= 7900.0d0) 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 <= -1.7e+14) {
tmp = ((z - y) / z) * x;
} else if (z <= 7900.0) {
tmp = (x * y) / (t - z);
} else {
tmp = (z / (z - t)) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.7e+14: tmp = ((z - y) / z) * x elif z <= 7900.0: tmp = (x * y) / (t - z) else: tmp = (z / (z - t)) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.7e+14) tmp = Float64(Float64(Float64(z - y) / z) * x); elseif (z <= 7900.0) 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 <= -1.7e+14) tmp = ((z - y) / z) * x; elseif (z <= 7900.0) tmp = (x * y) / (t - z); else tmp = (z / (z - t)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -170000000000000], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 7900], 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 -170000000000000:\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\mathbf{elif}\;z \leq 7900:\\
\;\;\;\;\frac{x \cdot y}{t - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\end{array}
if z < -1.7e14Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6452.1%
Applied rewrites52.1%
if -1.7e14 < z < 7900Initial program 84.1%
Taylor expanded in y around inf
lower-*.f6450.2%
Applied rewrites50.2%
if 7900 < z Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in y around 0
Applied rewrites54.3%
(FPCore (x y z t)
:precision binary64
(if (<=
z
-7307508186654515/5846006549323611672814739330865132078623730171904)
(* (/ (- z y) z) x)
(if (<= z 7900) (* (/ x t) (- y z)) (* (/ z (- z t)) x))))double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.25e-33) {
tmp = ((z - y) / z) * x;
} else if (z <= 7900.0) {
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 <= (-1.25d-33)) then
tmp = ((z - y) / z) * x
else if (z <= 7900.0d0) 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 <= -1.25e-33) {
tmp = ((z - y) / z) * x;
} else if (z <= 7900.0) {
tmp = (x / t) * (y - z);
} else {
tmp = (z / (z - t)) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.25e-33: tmp = ((z - y) / z) * x elif z <= 7900.0: tmp = (x / t) * (y - z) else: tmp = (z / (z - t)) * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.25e-33) tmp = Float64(Float64(Float64(z - y) / z) * x); elseif (z <= 7900.0) 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 <= -1.25e-33) tmp = ((z - y) / z) * x; elseif (z <= 7900.0) tmp = (x / t) * (y - z); else tmp = (z / (z - t)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7307508186654515/5846006549323611672814739330865132078623730171904], N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 7900], 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 \frac{-7307508186654515}{5846006549323611672814739330865132078623730171904}:\\
\;\;\;\;\frac{z - y}{z} \cdot x\\
\mathbf{elif}\;z \leq 7900:\\
\;\;\;\;\frac{x}{t} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{z - t} \cdot x\\
\end{array}
if z < -1.2500000000000001e-33Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6452.1%
Applied rewrites52.1%
if -1.2500000000000001e-33 < z < 7900Initial program 84.1%
Taylor expanded in z around 0
Applied rewrites48.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-/.f6448.0%
Applied rewrites48.0%
if 7900 < z Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in y around 0
Applied rewrites54.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ (- z y) z) x)))
(if (<=
z
-7307508186654515/5846006549323611672814739330865132078623730171904)
t_1
(if (<=
z
8410448953938583/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072)
(* (/ x t) (- y z))
t_1))))double code(double x, double y, double z, double t) {
double t_1 = ((z - y) / z) * x;
double tmp;
if (z <= -1.25e-33) {
tmp = t_1;
} else if (z <= 3.15e-80) {
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 = ((z - y) / z) * x
if (z <= (-1.25d-33)) then
tmp = t_1
else if (z <= 3.15d-80) 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 = ((z - y) / z) * x;
double tmp;
if (z <= -1.25e-33) {
tmp = t_1;
} else if (z <= 3.15e-80) {
tmp = (x / t) * (y - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((z - y) / z) * x tmp = 0 if z <= -1.25e-33: tmp = t_1 elif z <= 3.15e-80: tmp = (x / t) * (y - z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(z - y) / z) * x) tmp = 0.0 if (z <= -1.25e-33) tmp = t_1; elseif (z <= 3.15e-80) 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 = ((z - y) / z) * x; tmp = 0.0; if (z <= -1.25e-33) tmp = t_1; elseif (z <= 3.15e-80) 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[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -7307508186654515/5846006549323611672814739330865132078623730171904], t$95$1, If[LessEqual[z, 8410448953938583/266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072], N[(N[(x / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{z - y}{z} \cdot x\\
\mathbf{if}\;z \leq \frac{-7307508186654515}{5846006549323611672814739330865132078623730171904}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq \frac{8410448953938583}{266998379490113760299377713271194014325338065294581596243380200977777465722580068752870260867072}:\\
\;\;\;\;\frac{x}{t} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1.2500000000000001e-33 or 3.1499999999999998e-80 < z Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6452.1%
Applied rewrites52.1%
if -1.2500000000000001e-33 < z < 3.1499999999999998e-80Initial program 84.1%
Taylor expanded in z around 0
Applied rewrites48.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-/.f6448.0%
Applied rewrites48.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ (- z y) z) x)))
(if (<=
z
-1908785286492599/3291009114642412084309938365114701009965471731267159726697218048)
t_1
(if (<=
z
6541460297507787/133499189745056880149688856635597007162669032647290798121690100488888732861290034376435130433536)
(* (/ y t) x)
t_1))))double code(double x, double y, double z, double t) {
double t_1 = ((z - y) / z) * x;
double tmp;
if (z <= -5.8e-49) {
tmp = t_1;
} else if (z <= 4.9e-80) {
tmp = (y / t) * x;
} 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 = ((z - y) / z) * x
if (z <= (-5.8d-49)) then
tmp = t_1
else if (z <= 4.9d-80) then
tmp = (y / t) * x
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 = ((z - y) / z) * x;
double tmp;
if (z <= -5.8e-49) {
tmp = t_1;
} else if (z <= 4.9e-80) {
tmp = (y / t) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((z - y) / z) * x tmp = 0 if z <= -5.8e-49: tmp = t_1 elif z <= 4.9e-80: tmp = (y / t) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(z - y) / z) * x) tmp = 0.0 if (z <= -5.8e-49) tmp = t_1; elseif (z <= 4.9e-80) tmp = Float64(Float64(y / t) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((z - y) / z) * x; tmp = 0.0; if (z <= -5.8e-49) tmp = t_1; elseif (z <= 4.9e-80) tmp = (y / t) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -1908785286492599/3291009114642412084309938365114701009965471731267159726697218048], t$95$1, If[LessEqual[z, 6541460297507787/133499189745056880149688856635597007162669032647290798121690100488888732861290034376435130433536], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{z - y}{z} \cdot x\\
\mathbf{if}\;z \leq \frac{-1908785286492599}{3291009114642412084309938365114701009965471731267159726697218048}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq \frac{6541460297507787}{133499189745056880149688856635597007162669032647290798121690100488888732861290034376435130433536}:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -5.8e-49 or 4.8999999999999999e-80 < z Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower--.f6452.1%
Applied rewrites52.1%
if -5.8e-49 < z < 4.8999999999999999e-80Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in z around 0
lower-/.f6439.8%
Applied rewrites39.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x z) (- z y))))
(if (<=
z
-1908785286492599/3291009114642412084309938365114701009965471731267159726697218048)
t_1
(if (<=
z
1303703024854071/65185151242703554760590262029100101153646988597309960020356494379340201592426774597868716032)
(* (/ y t) x)
(if (<=
z
131999999999999995732829479729182984521565270605199181502927434978217495256815980946532544045455904183345115229288130516329082472407919079866539633304170532212076911079670051795518382896419281944207949824)
t_1
(* 1 x))))))double code(double x, double y, double z, double t) {
double t_1 = (x / z) * (z - y);
double tmp;
if (z <= -5.8e-49) {
tmp = t_1;
} else if (z <= 2e-77) {
tmp = (y / t) * x;
} else if (z <= 1.32e+203) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (x / z) * (z - y)
if (z <= (-5.8d-49)) then
tmp = t_1
else if (z <= 2d-77) then
tmp = (y / t) * x
else if (z <= 1.32d+203) then
tmp = t_1
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / z) * (z - y);
double tmp;
if (z <= -5.8e-49) {
tmp = t_1;
} else if (z <= 2e-77) {
tmp = (y / t) * x;
} else if (z <= 1.32e+203) {
tmp = t_1;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) * (z - y) tmp = 0 if z <= -5.8e-49: tmp = t_1 elif z <= 2e-77: tmp = (y / t) * x elif z <= 1.32e+203: tmp = t_1 else: tmp = 1.0 * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * Float64(z - y)) tmp = 0.0 if (z <= -5.8e-49) tmp = t_1; elseif (z <= 2e-77) tmp = Float64(Float64(y / t) * x); elseif (z <= 1.32e+203) tmp = t_1; else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) * (z - y); tmp = 0.0; if (z <= -5.8e-49) tmp = t_1; elseif (z <= 2e-77) tmp = (y / t) * x; elseif (z <= 1.32e+203) tmp = t_1; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1908785286492599/3291009114642412084309938365114701009965471731267159726697218048], t$95$1, If[LessEqual[z, 1303703024854071/65185151242703554760590262029100101153646988597309960020356494379340201592426774597868716032], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 131999999999999995732829479729182984521565270605199181502927434978217495256815980946532544045455904183345115229288130516329082472407919079866539633304170532212076911079670051795518382896419281944207949824], t$95$1, N[(1 * x), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{x}{z} \cdot \left(z - y\right)\\
\mathbf{if}\;z \leq \frac{-1908785286492599}{3291009114642412084309938365114701009965471731267159726697218048}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq \frac{1303703024854071}{65185151242703554760590262029100101153646988597309960020356494379340201592426774597868716032}:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\mathbf{elif}\;z \leq 131999999999999995732829479729182984521565270605199181502927434978217495256815980946532544045455904183345115229288130516329082472407919079866539633304170532212076911079670051795518382896419281944207949824:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -5.8e-49 or 1.9999999999999999e-77 < z < 1.32e203Initial program 84.1%
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--.f6485.1%
Applied rewrites85.1%
Taylor expanded in z around inf
lower-/.f6443.7%
Applied rewrites43.7%
if -5.8e-49 < z < 1.9999999999999999e-77Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in z around 0
lower-/.f6439.8%
Applied rewrites39.8%
if 1.32e203 < z Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in z around inf
Applied rewrites35.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x (- z y)) z)))
(if (<=
z
-33000000000000000128627334195332913561487311083386831082578898524556797239641395735025241395650988617910201006107670862092741819808675183300109028226172391299965865348819598937095355363042052000230728717746894673689659463271481709677622386218762240)
(* 1 x)
(if (<=
z
-1908785286492599/3291009114642412084309938365114701009965471731267159726697218048)
t_1
(if (<=
z
1303703024854071/65185151242703554760590262029100101153646988597309960020356494379340201592426774597868716032)
(* (/ y t) x)
(if (<=
z
299999999999999996630732362518988342952803379488649768992510454652087783547085600533328090838002069535557761603666926736444477839227214370924576161583627871744229584898717153533619263940649277593806176256)
t_1
(* 1 x)))))))double code(double x, double y, double z, double t) {
double t_1 = (x * (z - y)) / z;
double tmp;
if (z <= -3.3e+247) {
tmp = 1.0 * x;
} else if (z <= -5.8e-49) {
tmp = t_1;
} else if (z <= 2e-77) {
tmp = (y / t) * x;
} else if (z <= 3e+203) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (x * (z - y)) / z
if (z <= (-3.3d+247)) then
tmp = 1.0d0 * x
else if (z <= (-5.8d-49)) then
tmp = t_1
else if (z <= 2d-77) then
tmp = (y / t) * x
else if (z <= 3d+203) then
tmp = t_1
else
tmp = 1.0d0 * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * (z - y)) / z;
double tmp;
if (z <= -3.3e+247) {
tmp = 1.0 * x;
} else if (z <= -5.8e-49) {
tmp = t_1;
} else if (z <= 2e-77) {
tmp = (y / t) * x;
} else if (z <= 3e+203) {
tmp = t_1;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * (z - y)) / z tmp = 0 if z <= -3.3e+247: tmp = 1.0 * x elif z <= -5.8e-49: tmp = t_1 elif z <= 2e-77: tmp = (y / t) * x elif z <= 3e+203: tmp = t_1 else: tmp = 1.0 * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * Float64(z - y)) / z) tmp = 0.0 if (z <= -3.3e+247) tmp = Float64(1.0 * x); elseif (z <= -5.8e-49) tmp = t_1; elseif (z <= 2e-77) tmp = Float64(Float64(y / t) * x); elseif (z <= 3e+203) tmp = t_1; else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * (z - y)) / z; tmp = 0.0; if (z <= -3.3e+247) tmp = 1.0 * x; elseif (z <= -5.8e-49) tmp = t_1; elseif (z <= 2e-77) tmp = (y / t) * x; elseif (z <= 3e+203) tmp = t_1; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[z, -33000000000000000128627334195332913561487311083386831082578898524556797239641395735025241395650988617910201006107670862092741819808675183300109028226172391299965865348819598937095355363042052000230728717746894673689659463271481709677622386218762240], N[(1 * x), $MachinePrecision], If[LessEqual[z, -1908785286492599/3291009114642412084309938365114701009965471731267159726697218048], t$95$1, If[LessEqual[z, 1303703024854071/65185151242703554760590262029100101153646988597309960020356494379340201592426774597868716032], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 299999999999999996630732362518988342952803379488649768992510454652087783547085600533328090838002069535557761603666926736444477839227214370924576161583627871744229584898717153533619263940649277593806176256], t$95$1, N[(1 * x), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \frac{x \cdot \left(z - y\right)}{z}\\
\mathbf{if}\;z \leq -33000000000000000128627334195332913561487311083386831082578898524556797239641395735025241395650988617910201006107670862092741819808675183300109028226172391299965865348819598937095355363042052000230728717746894673689659463271481709677622386218762240:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq \frac{-1908785286492599}{3291009114642412084309938365114701009965471731267159726697218048}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq \frac{1303703024854071}{65185151242703554760590262029100101153646988597309960020356494379340201592426774597868716032}:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\mathbf{elif}\;z \leq 299999999999999996630732362518988342952803379488649768992510454652087783547085600533328090838002069535557761603666926736444477839227214370924576161583627871744229584898717153533619263940649277593806176256:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -3.3e247 or 3e203 < z Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in z around inf
Applied rewrites35.4%
if -3.3e247 < z < -5.8e-49 or 1.9999999999999999e-77 < z < 3e203Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6444.4%
Applied rewrites44.4%
if -5.8e-49 < z < 1.9999999999999999e-77Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in z around 0
lower-/.f6439.8%
Applied rewrites39.8%
(FPCore (x y z t) :precision binary64 (if (<= z -42000000000000000000) (* 1 x) (if (<= z 480000) (* (/ y t) x) (* 1 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.2e+19) {
tmp = 1.0 * x;
} else if (z <= 480000.0) {
tmp = (y / t) * x;
} 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 <= (-4.2d+19)) then
tmp = 1.0d0 * x
else if (z <= 480000.0d0) then
tmp = (y / t) * x
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 <= -4.2e+19) {
tmp = 1.0 * x;
} else if (z <= 480000.0) {
tmp = (y / t) * x;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.2e+19: tmp = 1.0 * x elif z <= 480000.0: tmp = (y / t) * x else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.2e+19) tmp = Float64(1.0 * x); elseif (z <= 480000.0) tmp = Float64(Float64(y / t) * x); else tmp = Float64(1.0 * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.2e+19) tmp = 1.0 * x; elseif (z <= 480000.0) tmp = (y / t) * x; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -42000000000000000000], N[(1 * x), $MachinePrecision], If[LessEqual[z, 480000], N[(N[(y / t), $MachinePrecision] * x), $MachinePrecision], N[(1 * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -42000000000000000000:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 480000:\\
\;\;\;\;\frac{y}{t} \cdot x\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -4.2e19 or 4.8e5 < z Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in z around inf
Applied rewrites35.4%
if -4.2e19 < z < 4.8e5Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in z around 0
lower-/.f6439.8%
Applied rewrites39.8%
(FPCore (x y z t) :precision binary64 (if (<= z -2050000000000000000) (* 1 x) (if (<= z 480000) (/ (* x y) t) (* 1 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.05e+18) {
tmp = 1.0 * x;
} else if (z <= 480000.0) {
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 <= (-2.05d+18)) then
tmp = 1.0d0 * x
else if (z <= 480000.0d0) 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 <= -2.05e+18) {
tmp = 1.0 * x;
} else if (z <= 480000.0) {
tmp = (x * y) / t;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.05e+18: tmp = 1.0 * x elif z <= 480000.0: tmp = (x * y) / t else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.05e+18) tmp = Float64(1.0 * x); elseif (z <= 480000.0) 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 <= -2.05e+18) tmp = 1.0 * x; elseif (z <= 480000.0) tmp = (x * y) / t; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2050000000000000000], N[(1 * x), $MachinePrecision], If[LessEqual[z, 480000], N[(N[(x * y), $MachinePrecision] / t), $MachinePrecision], N[(1 * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -2050000000000000000:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 480000:\\
\;\;\;\;\frac{x \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -2.05e18 or 4.8e5 < z Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in z around inf
Applied rewrites35.4%
if -2.05e18 < z < 4.8e5Initial program 84.1%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6438.1%
Applied rewrites38.1%
(FPCore (x y z t) :precision binary64 (if (<= z -42000000000000000000) (* 1 x) (if (<= z 480000) (* (/ x t) y) (* 1 x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.2e+19) {
tmp = 1.0 * x;
} else if (z <= 480000.0) {
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 <= (-4.2d+19)) then
tmp = 1.0d0 * x
else if (z <= 480000.0d0) 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 <= -4.2e+19) {
tmp = 1.0 * x;
} else if (z <= 480000.0) {
tmp = (x / t) * y;
} else {
tmp = 1.0 * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.2e+19: tmp = 1.0 * x elif z <= 480000.0: tmp = (x / t) * y else: tmp = 1.0 * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.2e+19) tmp = Float64(1.0 * x); elseif (z <= 480000.0) 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 <= -4.2e+19) tmp = 1.0 * x; elseif (z <= 480000.0) tmp = (x / t) * y; else tmp = 1.0 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -42000000000000000000], N[(1 * x), $MachinePrecision], If[LessEqual[z, 480000], N[(N[(x / t), $MachinePrecision] * y), $MachinePrecision], N[(1 * x), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -42000000000000000000:\\
\;\;\;\;1 \cdot x\\
\mathbf{elif}\;z \leq 480000:\\
\;\;\;\;\frac{x}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot x\\
\end{array}
if z < -4.2e19 or 4.8e5 < z Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in z around inf
Applied rewrites35.4%
if -4.2e19 < z < 4.8e5Initial program 84.1%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f6438.1%
Applied rewrites38.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-/.f6438.1%
Applied rewrites38.1%
(FPCore (x y z t) :precision binary64 (* (copysign 1 x) (if (<= (/ (* (fabs x) (- y z)) (- t z)) 0) (/ (* (fabs x) z) z) (* 1 (fabs x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((fabs(x) * (y - z)) / (t - z)) <= 0.0) {
tmp = (fabs(x) * z) / z;
} else {
tmp = 1.0 * fabs(x);
}
return copysign(1.0, x) * tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (((Math.abs(x) * (y - z)) / (t - z)) <= 0.0) {
tmp = (Math.abs(x) * z) / z;
} else {
tmp = 1.0 * Math.abs(x);
}
return Math.copySign(1.0, x) * tmp;
}
def code(x, y, z, t): tmp = 0 if ((math.fabs(x) * (y - z)) / (t - z)) <= 0.0: tmp = (math.fabs(x) * z) / z else: tmp = 1.0 * math.fabs(x) return math.copysign(1.0, x) * tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(abs(x) * Float64(y - z)) / Float64(t - z)) <= 0.0) tmp = Float64(Float64(abs(x) * z) / z); else tmp = Float64(1.0 * abs(x)); end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((abs(x) * (y - z)) / (t - z)) <= 0.0) tmp = (abs(x) * z) / z; else tmp = 1.0 * abs(x); end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[x_, y_, z_, t_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Abs[x], $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], 0], N[(N[(N[Abs[x], $MachinePrecision] * z), $MachinePrecision] / z), $MachinePrecision], N[(1 * N[Abs[x], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\left|x\right| \cdot \left(y - z\right)}{t - z} \leq 0:\\
\;\;\;\;\frac{\left|x\right| \cdot z}{z}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left|x\right|\\
\end{array}
if (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < -0.0Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6444.4%
Applied rewrites44.4%
Taylor expanded in y around 0
lower-*.f6430.6%
Applied rewrites30.6%
if -0.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in z around inf
Applied rewrites35.4%
(FPCore (x y z t) :precision binary64 (* 1 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 * x), $MachinePrecision]
1 \cdot x
Initial program 84.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
distribute-frac-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower--.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6497.0%
Applied rewrites97.0%
Taylor expanded in z around inf
Applied rewrites35.4%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
:precision binary64
(/ (* x (- y z)) (- t z)))