
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x - y) / (z - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\frac{x - y}{z - y} \cdot t
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x - y) / (z - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\frac{x - y}{z - y} \cdot t
(FPCore (x y z t) :precision binary64 (134-z0z1z2z3z4 (/ -1 (- z y)) y t x t))
\mathsf{134\_z0z1z2z3z4}\left(\left(\frac{-1}{z - y}\right), y, t, x, t\right)
Initial program 96.8%
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift--.f64N/A
sub-negate-revN/A
sub-flipN/A
distribute-rgt-inN/A
fp-cancel-sub-signN/A
lower-134-z0z1z2z3z4N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f6499.7%
Applied rewrites99.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x y) (- z y))) (t_2 (* (/ x (- z y)) t)))
(if (<= t_1 -500000000)
t_2
(if (<= t_1 2076918743413931/20769187434139310514121985316880384)
(* (/ (- x y) z) t)
(if (<= t_1 10) (* (/ y (- y z)) t) t_2)))))double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (x / (z - y)) * t;
double tmp;
if (t_1 <= -500000000.0) {
tmp = t_2;
} else if (t_1 <= 1e-19) {
tmp = ((x - y) / z) * t;
} else if (t_1 <= 10.0) {
tmp = (y / (y - z)) * t;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (x - y) / (z - y)
t_2 = (x / (z - y)) * t
if (t_1 <= (-500000000.0d0)) then
tmp = t_2
else if (t_1 <= 1d-19) then
tmp = ((x - y) / z) * t
else if (t_1 <= 10.0d0) then
tmp = (y / (y - z)) * t
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (x / (z - y)) * t;
double tmp;
if (t_1 <= -500000000.0) {
tmp = t_2;
} else if (t_1 <= 1e-19) {
tmp = ((x - y) / z) * t;
} else if (t_1 <= 10.0) {
tmp = (y / (y - z)) * t;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - y) / (z - y) t_2 = (x / (z - y)) * t tmp = 0 if t_1 <= -500000000.0: tmp = t_2 elif t_1 <= 1e-19: tmp = ((x - y) / z) * t elif t_1 <= 10.0: tmp = (y / (y - z)) * t else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - y) / Float64(z - y)) t_2 = Float64(Float64(x / Float64(z - y)) * t) tmp = 0.0 if (t_1 <= -500000000.0) tmp = t_2; elseif (t_1 <= 1e-19) tmp = Float64(Float64(Float64(x - y) / z) * t); elseif (t_1 <= 10.0) tmp = Float64(Float64(y / Float64(y - z)) * t); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - y) / (z - y); t_2 = (x / (z - y)) * t; tmp = 0.0; if (t_1 <= -500000000.0) tmp = t_2; elseif (t_1 <= 1e-19) tmp = ((x - y) / z) * t; elseif (t_1 <= 10.0) tmp = (y / (y - z)) * t; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -500000000], t$95$2, If[LessEqual[t$95$1, 2076918743413931/20769187434139310514121985316880384], N[(N[(N[(x - y), $MachinePrecision] / z), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 10], N[(N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
t_2 := \frac{x}{z - y} \cdot t\\
\mathbf{if}\;t\_1 \leq -500000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \frac{2076918743413931}{20769187434139310514121985316880384}:\\
\;\;\;\;\frac{x - y}{z} \cdot t\\
\mathbf{elif}\;t\_1 \leq 10:\\
\;\;\;\;\frac{y}{y - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < -5e8 or 10 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 96.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f6453.1%
Applied rewrites53.1%
if -5e8 < (/.f64 (-.f64 x y) (-.f64 z y)) < 9.9999999999999998e-20Initial program 96.8%
Taylor expanded in y around 0
Applied rewrites50.6%
if 9.9999999999999998e-20 < (/.f64 (-.f64 x y) (-.f64 z y)) < 10Initial program 96.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.6%
Applied rewrites84.6%
Taylor expanded in x around 0
Applied rewrites45.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
mult-flip-revN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6454.1%
Applied rewrites54.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x y) (- z y))) (t_2 (* (/ x (- z y)) t)))
(if (<=
t_1
-348449143727041/174224571863520493293247799005065324265472)
t_2
(if (<= t_1 2076918743413931/20769187434139310514121985316880384)
(/ (* t (- x y)) z)
(if (<= t_1 10) (* (/ y (- y z)) t) t_2)))))double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (x / (z - y)) * t;
double tmp;
if (t_1 <= -2e-27) {
tmp = t_2;
} else if (t_1 <= 1e-19) {
tmp = (t * (x - y)) / z;
} else if (t_1 <= 10.0) {
tmp = (y / (y - z)) * t;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (x - y) / (z - y)
t_2 = (x / (z - y)) * t
if (t_1 <= (-2d-27)) then
tmp = t_2
else if (t_1 <= 1d-19) then
tmp = (t * (x - y)) / z
else if (t_1 <= 10.0d0) then
tmp = (y / (y - z)) * t
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (x / (z - y)) * t;
double tmp;
if (t_1 <= -2e-27) {
tmp = t_2;
} else if (t_1 <= 1e-19) {
tmp = (t * (x - y)) / z;
} else if (t_1 <= 10.0) {
tmp = (y / (y - z)) * t;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - y) / (z - y) t_2 = (x / (z - y)) * t tmp = 0 if t_1 <= -2e-27: tmp = t_2 elif t_1 <= 1e-19: tmp = (t * (x - y)) / z elif t_1 <= 10.0: tmp = (y / (y - z)) * t else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - y) / Float64(z - y)) t_2 = Float64(Float64(x / Float64(z - y)) * t) tmp = 0.0 if (t_1 <= -2e-27) tmp = t_2; elseif (t_1 <= 1e-19) tmp = Float64(Float64(t * Float64(x - y)) / z); elseif (t_1 <= 10.0) tmp = Float64(Float64(y / Float64(y - z)) * t); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - y) / (z - y); t_2 = (x / (z - y)) * t; tmp = 0.0; if (t_1 <= -2e-27) tmp = t_2; elseif (t_1 <= 1e-19) tmp = (t * (x - y)) / z; elseif (t_1 <= 10.0) tmp = (y / (y - z)) * t; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -348449143727041/174224571863520493293247799005065324265472], t$95$2, If[LessEqual[t$95$1, 2076918743413931/20769187434139310514121985316880384], N[(N[(t * N[(x - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 10], N[(N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
t_2 := \frac{x}{z - y} \cdot t\\
\mathbf{if}\;t\_1 \leq \frac{-348449143727041}{174224571863520493293247799005065324265472}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \frac{2076918743413931}{20769187434139310514121985316880384}:\\
\;\;\;\;\frac{t \cdot \left(x - y\right)}{z}\\
\mathbf{elif}\;t\_1 \leq 10:\\
\;\;\;\;\frac{y}{y - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < -2.0000000000000001e-27 or 10 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 96.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f6453.1%
Applied rewrites53.1%
if -2.0000000000000001e-27 < (/.f64 (-.f64 x y) (-.f64 z y)) < 9.9999999999999998e-20Initial program 96.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6447.9%
Applied rewrites47.9%
if 9.9999999999999998e-20 < (/.f64 (-.f64 x y) (-.f64 z y)) < 10Initial program 96.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.6%
Applied rewrites84.6%
Taylor expanded in x around 0
Applied rewrites45.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
mult-flip-revN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6454.1%
Applied rewrites54.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x y) (- z y))))
(if (<= t_1 2028240960365167/5070602400912917605986812821504)
(* (/ t (- z y)) (- x y))
(if (<= t_1 10) (* (/ y (- y z)) t) (* (/ x (- z y)) t)))))double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double tmp;
if (t_1 <= 4e-16) {
tmp = (t / (z - y)) * (x - y);
} else if (t_1 <= 10.0) {
tmp = (y / (y - z)) * t;
} else {
tmp = (x / (z - y)) * t;
}
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 - y) / (z - y)
if (t_1 <= 4d-16) then
tmp = (t / (z - y)) * (x - y)
else if (t_1 <= 10.0d0) then
tmp = (y / (y - z)) * t
else
tmp = (x / (z - y)) * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double tmp;
if (t_1 <= 4e-16) {
tmp = (t / (z - y)) * (x - y);
} else if (t_1 <= 10.0) {
tmp = (y / (y - z)) * t;
} else {
tmp = (x / (z - y)) * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - y) / (z - y) tmp = 0 if t_1 <= 4e-16: tmp = (t / (z - y)) * (x - y) elif t_1 <= 10.0: tmp = (y / (y - z)) * t else: tmp = (x / (z - y)) * t return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - y) / Float64(z - y)) tmp = 0.0 if (t_1 <= 4e-16) tmp = Float64(Float64(t / Float64(z - y)) * Float64(x - y)); elseif (t_1 <= 10.0) tmp = Float64(Float64(y / Float64(y - z)) * t); else tmp = Float64(Float64(x / Float64(z - y)) * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - y) / (z - y); tmp = 0.0; if (t_1 <= 4e-16) tmp = (t / (z - y)) * (x - y); elseif (t_1 <= 10.0) tmp = (y / (y - z)) * t; else tmp = (x / (z - y)) * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2028240960365167/5070602400912917605986812821504], N[(N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 10], N[(N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
\mathbf{if}\;t\_1 \leq \frac{2028240960365167}{5070602400912917605986812821504}:\\
\;\;\;\;\frac{t}{z - y} \cdot \left(x - y\right)\\
\mathbf{elif}\;t\_1 \leq 10:\\
\;\;\;\;\frac{y}{y - z} \cdot t\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z - y} \cdot t\\
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < 3.9999999999999999e-16Initial program 96.8%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
mult-flipN/A
lower-/.f6484.8%
Applied rewrites84.8%
if 3.9999999999999999e-16 < (/.f64 (-.f64 x y) (-.f64 z y)) < 10Initial program 96.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.6%
Applied rewrites84.6%
Taylor expanded in x around 0
Applied rewrites45.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
mult-flip-revN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6454.1%
Applied rewrites54.1%
if 10 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 96.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f6453.1%
Applied rewrites53.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x y) (- z y))) (t_2 (* (/ x (- z y)) t)))
(if (<=
t_1
-348449143727041/174224571863520493293247799005065324265472)
t_2
(if (<= t_1 4722366482869645/4722366482869645213696)
(/ (* t (- x y)) z)
(if (<= t_1 10) t t_2)))))double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (x / (z - y)) * t;
double tmp;
if (t_1 <= -2e-27) {
tmp = t_2;
} else if (t_1 <= 1e-6) {
tmp = (t * (x - y)) / z;
} else if (t_1 <= 10.0) {
tmp = t;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (x - y) / (z - y)
t_2 = (x / (z - y)) * t
if (t_1 <= (-2d-27)) then
tmp = t_2
else if (t_1 <= 1d-6) then
tmp = (t * (x - y)) / z
else if (t_1 <= 10.0d0) then
tmp = t
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (x / (z - y)) * t;
double tmp;
if (t_1 <= -2e-27) {
tmp = t_2;
} else if (t_1 <= 1e-6) {
tmp = (t * (x - y)) / z;
} else if (t_1 <= 10.0) {
tmp = t;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - y) / (z - y) t_2 = (x / (z - y)) * t tmp = 0 if t_1 <= -2e-27: tmp = t_2 elif t_1 <= 1e-6: tmp = (t * (x - y)) / z elif t_1 <= 10.0: tmp = t else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - y) / Float64(z - y)) t_2 = Float64(Float64(x / Float64(z - y)) * t) tmp = 0.0 if (t_1 <= -2e-27) tmp = t_2; elseif (t_1 <= 1e-6) tmp = Float64(Float64(t * Float64(x - y)) / z); elseif (t_1 <= 10.0) tmp = t; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - y) / (z - y); t_2 = (x / (z - y)) * t; tmp = 0.0; if (t_1 <= -2e-27) tmp = t_2; elseif (t_1 <= 1e-6) tmp = (t * (x - y)) / z; elseif (t_1 <= 10.0) tmp = t; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, -348449143727041/174224571863520493293247799005065324265472], t$95$2, If[LessEqual[t$95$1, 4722366482869645/4722366482869645213696], N[(N[(t * N[(x - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 10], t, t$95$2]]]]]
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
t_2 := \frac{x}{z - y} \cdot t\\
\mathbf{if}\;t\_1 \leq \frac{-348449143727041}{174224571863520493293247799005065324265472}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \frac{4722366482869645}{4722366482869645213696}:\\
\;\;\;\;\frac{t \cdot \left(x - y\right)}{z}\\
\mathbf{elif}\;t\_1 \leq 10:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < -2.0000000000000001e-27 or 10 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 96.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower--.f6453.1%
Applied rewrites53.1%
if -2.0000000000000001e-27 < (/.f64 (-.f64 x y) (-.f64 z y)) < 9.9999999999999995e-7Initial program 96.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6447.9%
Applied rewrites47.9%
if 9.9999999999999995e-7 < (/.f64 (-.f64 x y) (-.f64 z y)) < 10Initial program 96.8%
Taylor expanded in y around inf
Applied rewrites35.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x y) (- z y))) (t_2 (* (/ t (- z y)) x)))
(if (<=
t_1
-348449143727041/174224571863520493293247799005065324265472)
t_2
(if (<= t_1 4722366482869645/4722366482869645213696)
(/ (* t (- x y)) z)
(if (<= t_1 50) t t_2)))))double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (t / (z - y)) * x;
double tmp;
if (t_1 <= -2e-27) {
tmp = t_2;
} else if (t_1 <= 1e-6) {
tmp = (t * (x - y)) / z;
} else if (t_1 <= 50.0) {
tmp = t;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (x - y) / (z - y)
t_2 = (t / (z - y)) * x
if (t_1 <= (-2d-27)) then
tmp = t_2
else if (t_1 <= 1d-6) then
tmp = (t * (x - y)) / z
else if (t_1 <= 50.0d0) then
tmp = t
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (t / (z - y)) * x;
double tmp;
if (t_1 <= -2e-27) {
tmp = t_2;
} else if (t_1 <= 1e-6) {
tmp = (t * (x - y)) / z;
} else if (t_1 <= 50.0) {
tmp = t;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - y) / (z - y) t_2 = (t / (z - y)) * x tmp = 0 if t_1 <= -2e-27: tmp = t_2 elif t_1 <= 1e-6: tmp = (t * (x - y)) / z elif t_1 <= 50.0: tmp = t else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - y) / Float64(z - y)) t_2 = Float64(Float64(t / Float64(z - y)) * x) tmp = 0.0 if (t_1 <= -2e-27) tmp = t_2; elseif (t_1 <= 1e-6) tmp = Float64(Float64(t * Float64(x - y)) / z); elseif (t_1 <= 50.0) tmp = t; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - y) / (z - y); t_2 = (t / (z - y)) * x; tmp = 0.0; if (t_1 <= -2e-27) tmp = t_2; elseif (t_1 <= 1e-6) tmp = (t * (x - y)) / z; elseif (t_1 <= 50.0) tmp = t; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$1, -348449143727041/174224571863520493293247799005065324265472], t$95$2, If[LessEqual[t$95$1, 4722366482869645/4722366482869645213696], N[(N[(t * N[(x - y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t$95$1, 50], t, t$95$2]]]]]
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
t_2 := \frac{t}{z - y} \cdot x\\
\mathbf{if}\;t\_1 \leq \frac{-348449143727041}{174224571863520493293247799005065324265472}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \frac{4722366482869645}{4722366482869645213696}:\\
\;\;\;\;\frac{t \cdot \left(x - y\right)}{z}\\
\mathbf{elif}\;t\_1 \leq 50:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < -2.0000000000000001e-27 or 50 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 96.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6450.3%
Applied rewrites50.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.4%
Applied rewrites50.4%
if -2.0000000000000001e-27 < (/.f64 (-.f64 x y) (-.f64 z y)) < 9.9999999999999995e-7Initial program 96.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6447.9%
Applied rewrites47.9%
if 9.9999999999999995e-7 < (/.f64 (-.f64 x y) (-.f64 z y)) < 50Initial program 96.8%
Taylor expanded in y around inf
Applied rewrites35.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x y) (- z y))) (t_2 (* (/ t (- z y)) x)))
(if (<= t_1 2076918743413931/20769187434139310514121985316880384)
t_2
(if (<= t_1 50) t t_2))))double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (t / (z - y)) * x;
double tmp;
if (t_1 <= 1e-19) {
tmp = t_2;
} else if (t_1 <= 50.0) {
tmp = t;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (x - y) / (z - y)
t_2 = (t / (z - y)) * x
if (t_1 <= 1d-19) then
tmp = t_2
else if (t_1 <= 50.0d0) then
tmp = t
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (t / (z - y)) * x;
double tmp;
if (t_1 <= 1e-19) {
tmp = t_2;
} else if (t_1 <= 50.0) {
tmp = t;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - y) / (z - y) t_2 = (t / (z - y)) * x tmp = 0 if t_1 <= 1e-19: tmp = t_2 elif t_1 <= 50.0: tmp = t else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - y) / Float64(z - y)) t_2 = Float64(Float64(t / Float64(z - y)) * x) tmp = 0.0 if (t_1 <= 1e-19) tmp = t_2; elseif (t_1 <= 50.0) tmp = t; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - y) / (z - y); t_2 = (t / (z - y)) * x; tmp = 0.0; if (t_1 <= 1e-19) tmp = t_2; elseif (t_1 <= 50.0) tmp = t; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$1, 2076918743413931/20769187434139310514121985316880384], t$95$2, If[LessEqual[t$95$1, 50], t, t$95$2]]]]
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
t_2 := \frac{t}{z - y} \cdot x\\
\mathbf{if}\;t\_1 \leq \frac{2076918743413931}{20769187434139310514121985316880384}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 50:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < 9.9999999999999998e-20 or 50 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 96.8%
Taylor expanded in x around inf
lower-/.f64N/A
lower-*.f64N/A
lower--.f6450.3%
Applied rewrites50.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6450.4%
Applied rewrites50.4%
if 9.9999999999999998e-20 < (/.f64 (-.f64 x y) (-.f64 z y)) < 50Initial program 96.8%
Taylor expanded in y around inf
Applied rewrites35.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x y) (- z y))) (t_2 (* (/ x z) t)))
(if (<= t_1 2076918743413931/20769187434139310514121985316880384)
t_2
(if (<= t_1 10) t t_2))))double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (x / z) * t;
double tmp;
if (t_1 <= 1e-19) {
tmp = t_2;
} else if (t_1 <= 10.0) {
tmp = t;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (x - y) / (z - y)
t_2 = (x / z) * t
if (t_1 <= 1d-19) then
tmp = t_2
else if (t_1 <= 10.0d0) then
tmp = t
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (x / z) * t;
double tmp;
if (t_1 <= 1e-19) {
tmp = t_2;
} else if (t_1 <= 10.0) {
tmp = t;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - y) / (z - y) t_2 = (x / z) * t tmp = 0 if t_1 <= 1e-19: tmp = t_2 elif t_1 <= 10.0: tmp = t else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - y) / Float64(z - y)) t_2 = Float64(Float64(x / z) * t) tmp = 0.0 if (t_1 <= 1e-19) tmp = t_2; elseif (t_1 <= 10.0) tmp = t; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - y) / (z - y); t_2 = (x / z) * t; tmp = 0.0; if (t_1 <= 1e-19) tmp = t_2; elseif (t_1 <= 10.0) tmp = t; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, 2076918743413931/20769187434139310514121985316880384], t$95$2, If[LessEqual[t$95$1, 10], t, t$95$2]]]]
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
t_2 := \frac{x}{z} \cdot t\\
\mathbf{if}\;t\_1 \leq \frac{2076918743413931}{20769187434139310514121985316880384}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < 9.9999999999999998e-20 or 10 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 96.8%
Taylor expanded in y around 0
Applied rewrites50.6%
Taylor expanded in y around 0
lower-/.f6440.2%
Applied rewrites40.2%
if 9.9999999999999998e-20 < (/.f64 (-.f64 x y) (-.f64 z y)) < 10Initial program 96.8%
Taylor expanded in y around inf
Applied rewrites35.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x y) (- z y))))
(if (<= t_1 2076918743413931/20769187434139310514121985316880384)
(* (/ t z) x)
(if (<= t_1 10) t (/ (* t x) z)))))double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double tmp;
if (t_1 <= 1e-19) {
tmp = (t / z) * x;
} else if (t_1 <= 10.0) {
tmp = t;
} else {
tmp = (t * x) / z;
}
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 - y) / (z - y)
if (t_1 <= 1d-19) then
tmp = (t / z) * x
else if (t_1 <= 10.0d0) then
tmp = t
else
tmp = (t * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double tmp;
if (t_1 <= 1e-19) {
tmp = (t / z) * x;
} else if (t_1 <= 10.0) {
tmp = t;
} else {
tmp = (t * x) / z;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - y) / (z - y) tmp = 0 if t_1 <= 1e-19: tmp = (t / z) * x elif t_1 <= 10.0: tmp = t else: tmp = (t * x) / z return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - y) / Float64(z - y)) tmp = 0.0 if (t_1 <= 1e-19) tmp = Float64(Float64(t / z) * x); elseif (t_1 <= 10.0) tmp = t; else tmp = Float64(Float64(t * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - y) / (z - y); tmp = 0.0; if (t_1 <= 1e-19) tmp = (t / z) * x; elseif (t_1 <= 10.0) tmp = t; else tmp = (t * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2076918743413931/20769187434139310514121985316880384], N[(N[(t / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$1, 10], t, N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
\mathbf{if}\;t\_1 \leq \frac{2076918743413931}{20769187434139310514121985316880384}:\\
\;\;\;\;\frac{t}{z} \cdot x\\
\mathbf{elif}\;t\_1 \leq 10:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < 9.9999999999999998e-20Initial program 96.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f6438.2%
Applied rewrites38.2%
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.2%
Applied rewrites38.2%
if 9.9999999999999998e-20 < (/.f64 (-.f64 x y) (-.f64 z y)) < 10Initial program 96.8%
Taylor expanded in y around inf
Applied rewrites35.1%
if 10 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 96.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f6438.2%
Applied rewrites38.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x y) (- z y))) (t_2 (* (/ t z) x)))
(if (<= t_1 2076918743413931/20769187434139310514121985316880384)
t_2
(if (<= t_1 50) t t_2))))double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (t / z) * x;
double tmp;
if (t_1 <= 1e-19) {
tmp = t_2;
} else if (t_1 <= 50.0) {
tmp = t;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (x - y) / (z - y)
t_2 = (t / z) * x
if (t_1 <= 1d-19) then
tmp = t_2
else if (t_1 <= 50.0d0) then
tmp = t
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double t_2 = (t / z) * x;
double tmp;
if (t_1 <= 1e-19) {
tmp = t_2;
} else if (t_1 <= 50.0) {
tmp = t;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - y) / (z - y) t_2 = (t / z) * x tmp = 0 if t_1 <= 1e-19: tmp = t_2 elif t_1 <= 50.0: tmp = t else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - y) / Float64(z - y)) t_2 = Float64(Float64(t / z) * x) tmp = 0.0 if (t_1 <= 1e-19) tmp = t_2; elseif (t_1 <= 50.0) tmp = t; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - y) / (z - y); t_2 = (t / z) * x; tmp = 0.0; if (t_1 <= 1e-19) tmp = t_2; elseif (t_1 <= 50.0) tmp = t; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$1, 2076918743413931/20769187434139310514121985316880384], t$95$2, If[LessEqual[t$95$1, 50], t, t$95$2]]]]
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
t_2 := \frac{t}{z} \cdot x\\
\mathbf{if}\;t\_1 \leq \frac{2076918743413931}{20769187434139310514121985316880384}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 50:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < 9.9999999999999998e-20 or 50 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 96.8%
Taylor expanded in y around 0
lower-/.f64N/A
lower-*.f6438.2%
Applied rewrites38.2%
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.2%
Applied rewrites38.2%
if 9.9999999999999998e-20 < (/.f64 (-.f64 x y) (-.f64 z y)) < 50Initial program 96.8%
Taylor expanded in y around inf
Applied rewrites35.1%
(FPCore (x y z t)
:precision binary64
(*
(copysign 1 t)
(if (<=
(* (/ (- x y) (- z y)) (fabs t))
5265614583427859/105312291668557186697918027683670432318895095400549111254310977536)
(/ (* (fabs t) y) y)
(* (/ (fabs t) y) y))))double code(double x, double y, double z, double t) {
double tmp;
if ((((x - y) / (z - y)) * fabs(t)) <= 5e-50) {
tmp = (fabs(t) * y) / y;
} else {
tmp = (fabs(t) / y) * y;
}
return copysign(1.0, t) * tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((((x - y) / (z - y)) * Math.abs(t)) <= 5e-50) {
tmp = (Math.abs(t) * y) / y;
} else {
tmp = (Math.abs(t) / y) * y;
}
return Math.copySign(1.0, t) * tmp;
}
def code(x, y, z, t): tmp = 0 if (((x - y) / (z - y)) * math.fabs(t)) <= 5e-50: tmp = (math.fabs(t) * y) / y else: tmp = (math.fabs(t) / y) * y return math.copysign(1.0, t) * tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(Float64(x - y) / Float64(z - y)) * abs(t)) <= 5e-50) tmp = Float64(Float64(abs(t) * y) / y); else tmp = Float64(Float64(abs(t) / y) * y); end return Float64(copysign(1.0, t) * tmp) end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((((x - y) / (z - y)) * abs(t)) <= 5e-50) tmp = (abs(t) * y) / y; else tmp = (abs(t) / y) * y; end tmp_2 = (sign(t) * abs(1.0)) * tmp; end
code[x_, y_, z_, t_] := N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[t]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * N[Abs[t], $MachinePrecision]), $MachinePrecision], 5265614583427859/105312291668557186697918027683670432318895095400549111254310977536], N[(N[(N[Abs[t], $MachinePrecision] * y), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[Abs[t], $MachinePrecision] / y), $MachinePrecision] * y), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, t\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} \cdot \left|t\right| \leq \frac{5265614583427859}{105312291668557186697918027683670432318895095400549111254310977536}:\\
\;\;\;\;\frac{\left|t\right| \cdot y}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|t\right|}{y} \cdot y\\
\end{array}
if (*.f64 (/.f64 (-.f64 x y) (-.f64 z y)) t) < 4.9999999999999997e-50Initial program 96.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.6%
Applied rewrites84.6%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6445.1%
Applied rewrites45.1%
Taylor expanded in x around 0
Applied rewrites31.0%
if 4.9999999999999997e-50 < (*.f64 (/.f64 (-.f64 x y) (-.f64 z y)) t) Initial program 96.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.6%
Applied rewrites84.6%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6445.1%
Applied rewrites45.1%
Taylor expanded in x around 0
Applied rewrites31.0%
lift--.f64N/A
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
metadata-evalN/A
mult-flip-revN/A
associate-*l/N/A
distribute-frac-neg2N/A
distribute-frac-negN/A
sub-negate-revN/A
lift--.f6431.0%
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-/.f6429.5%
Applied rewrites29.5%
(FPCore (x y z t)
:precision binary64
(if (<=
(/ (- x y) (- z y))
1942668892225729/1942668892225729070919461906823518906642406839052139521251812409738904285205208498176)
(/ (* t y) y)
t))double code(double x, double y, double z, double t) {
double tmp;
if (((x - y) / (z - y)) <= 1e-69) {
tmp = (t * y) / y;
} else {
tmp = t;
}
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 (((x - y) / (z - y)) <= 1d-69) then
tmp = (t * y) / y
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x - y) / (z - y)) <= 1e-69) {
tmp = (t * y) / y;
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x - y) / (z - y)) <= 1e-69: tmp = (t * y) / y else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(x - y) / Float64(z - y)) <= 1e-69) tmp = Float64(Float64(t * y) / y); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x - y) / (z - y)) <= 1e-69) tmp = (t * y) / y; else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], 1942668892225729/1942668892225729070919461906823518906642406839052139521251812409738904285205208498176], N[(N[(t * y), $MachinePrecision] / y), $MachinePrecision], t]
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} \leq \frac{1942668892225729}{1942668892225729070919461906823518906642406839052139521251812409738904285205208498176}:\\
\;\;\;\;\frac{t \cdot y}{y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < 9.9999999999999996e-70Initial program 96.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
frac-2neg-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f6484.6%
Applied rewrites84.6%
Taylor expanded in z around 0
lower-/.f64N/A
lower-*.f64N/A
lower--.f6445.1%
Applied rewrites45.1%
Taylor expanded in x around 0
Applied rewrites31.0%
if 9.9999999999999996e-70 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 96.8%
Taylor expanded in y around inf
Applied rewrites35.1%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
t
Initial program 96.8%
Taylor expanded in y around inf
Applied rewrites35.1%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
:precision binary64
(* (/ (- x y) (- z y)) t))