
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / 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 - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
x + \frac{y \cdot \left(z - x\right)}{t}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / 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 - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
x + \frac{y \cdot \left(z - x\right)}{t}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* (/ (- z x) t) y)))
(t_2 (+ x (/ (* y (- z x)) t))))
(if (<= t_2 (- INFINITY))
t_1
(if (<=
t_2
1000000000000000007630473539575035660514778335511710750780086664439969510636494954611131549135839186513983455555395220895687860544809584999829725260594873271087399626486606146442550988840016917394626449536395208620267012778077787723395914064607119962069483324573977857832138825282954985472)
t_2
t_1))))double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) / t) * y);
double t_2 = x + ((y * (z - x)) / t);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 1e+288) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) / t) * y);
double t_2 = x + ((y * (z - x)) / t);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 1e+288) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((z - x) / t) * y) t_2 = x + ((y * (z - x)) / t) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 1e+288: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(Float64(z - x) / t) * y)) t_2 = Float64(x + Float64(Float64(y * Float64(z - x)) / t)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 1e+288) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (((z - x) / t) * y); t_2 = x + ((y * (z - x)) / t); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 1e+288) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1000000000000000007630473539575035660514778335511710750780086664439969510636494954611131549135839186513983455555395220895687860544809584999829725260594873271087399626486606146442550988840016917394626449536395208620267012778077787723395914064607119962069483324573977857832138825282954985472], t$95$2, t$95$1]]]]
\begin{array}{l}
t_1 := x + \frac{z - x}{t} \cdot y\\
t_2 := x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 1000000000000000007630473539575035660514778335511710750780086664439969510636494954611131549135839186513983455555395220895687860544809584999829725260594873271087399626486606146442550988840016917394626449536395208620267012778077787723395914064607119962069483324573977857832138825282954985472:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0 or 1e288 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 92.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.3%
Applied rewrites93.3%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 1e288Initial program 92.9%
(FPCore (x y z t) :precision binary64 (- x (* (/ y t) (- x z))))
double code(double x, double y, double z, double t) {
return x - ((y / t) * (x - 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 / t) * (x - z))
end function
public static double code(double x, double y, double z, double t) {
return x - ((y / t) * (x - z));
}
def code(x, y, z, t): return x - ((y / t) * (x - z))
function code(x, y, z, t) return Float64(x - Float64(Float64(y / t) * Float64(x - z))) end
function tmp = code(x, y, z, t) tmp = x - ((y / t) * (x - z)); end
code[x_, y_, z_, t_] := N[(x - N[(N[(y / t), $MachinePrecision] * N[(x - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x - \frac{y}{t} \cdot \left(x - z\right)
Initial program 92.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower--.f6497.8%
Applied rewrites97.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* (/ (- z x) t) y))))
(if (<=
y
-8048257981283417/24388660549343689307668728357759111763660922989570087116087163747073216709529418907189891430183531024686147899385989241370687309994439728955392)
t_1
(if (<=
y
2948408144391829/29484081443918291814387145163970850710288447034503440846689111720668938768688662906922865040450459121417721679927842538279457692421287442441886205089317937841010900992)
(+ x (/ (* y z) t))
t_1))))double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) / t) * y);
double tmp;
if (y <= -3.3e-127) {
tmp = t_1;
} else if (y <= 1e-151) {
tmp = x + ((y * z) / t);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x + (((z - x) / t) * y)
if (y <= (-3.3d-127)) then
tmp = t_1
else if (y <= 1d-151) then
tmp = x + ((y * z) / t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) / t) * y);
double tmp;
if (y <= -3.3e-127) {
tmp = t_1;
} else if (y <= 1e-151) {
tmp = x + ((y * z) / t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((z - x) / t) * y) tmp = 0 if y <= -3.3e-127: tmp = t_1 elif y <= 1e-151: tmp = x + ((y * z) / t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(Float64(z - x) / t) * y)) tmp = 0.0 if (y <= -3.3e-127) tmp = t_1; elseif (y <= 1e-151) tmp = Float64(x + Float64(Float64(y * z) / t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (((z - x) / t) * y); tmp = 0.0; if (y <= -3.3e-127) tmp = t_1; elseif (y <= 1e-151) tmp = x + ((y * z) / t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8048257981283417/24388660549343689307668728357759111763660922989570087116087163747073216709529418907189891430183531024686147899385989241370687309994439728955392], t$95$1, If[LessEqual[y, 2948408144391829/29484081443918291814387145163970850710288447034503440846689111720668938768688662906922865040450459121417721679927842538279457692421287442441886205089317937841010900992], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x + \frac{z - x}{t} \cdot y\\
\mathbf{if}\;y \leq \frac{-8048257981283417}{24388660549343689307668728357759111763660922989570087116087163747073216709529418907189891430183531024686147899385989241370687309994439728955392}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq \frac{2948408144391829}{29484081443918291814387145163970850710288447034503440846689111720668938768688662906922865040450459121417721679927842538279457692421287442441886205089317937841010900992}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -3.2999999999999998e-127 or 9.9999999999999994e-152 < y Initial program 92.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.3%
Applied rewrites93.3%
if -3.2999999999999998e-127 < y < 9.9999999999999994e-152Initial program 92.9%
Taylor expanded in x around 0
Applied rewrites73.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -81999999999999999444117791297653494069860092239413248)
(* (/ y t) (- z x))
(if (<=
y
2599999999999999954962905506906819895542902456088149751785670657918236645203684047229602691118266281430714048500701377979219968)
(+ x (/ (* y z) t))
(* (/ (- z x) t) y))))double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.2e+52) {
tmp = (y / t) * (z - x);
} else if (y <= 2.6e+126) {
tmp = x + ((y * z) / t);
} else {
tmp = ((z - x) / t) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 (y <= (-8.2d+52)) then
tmp = (y / t) * (z - x)
else if (y <= 2.6d+126) then
tmp = x + ((y * z) / t)
else
tmp = ((z - x) / t) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.2e+52) {
tmp = (y / t) * (z - x);
} else if (y <= 2.6e+126) {
tmp = x + ((y * z) / t);
} else {
tmp = ((z - x) / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.2e+52: tmp = (y / t) * (z - x) elif y <= 2.6e+126: tmp = x + ((y * z) / t) else: tmp = ((z - x) / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.2e+52) tmp = Float64(Float64(y / t) * Float64(z - x)); elseif (y <= 2.6e+126) tmp = Float64(x + Float64(Float64(y * z) / t)); else tmp = Float64(Float64(Float64(z - x) / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.2e+52) tmp = (y / t) * (z - x); elseif (y <= 2.6e+126) tmp = x + ((y * z) / t); else tmp = ((z - x) / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -81999999999999999444117791297653494069860092239413248], N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2599999999999999954962905506906819895542902456088149751785670657918236645203684047229602691118266281430714048500701377979219968], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y \leq -81999999999999999444117791297653494069860092239413248:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right)\\
\mathbf{elif}\;y \leq 2599999999999999954962905506906819895542902456088149751785670657918236645203684047229602691118266281430714048500701377979219968:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{z - x}{t} \cdot y\\
\end{array}
if y < -8.1999999999999999e52Initial program 92.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6456.3%
Applied rewrites56.3%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f6457.8%
Applied rewrites57.8%
frac-2neg57.8%
add-to-fraction57.8%
lift--.f64N/A
distribute-rgt-neg-outN/A
lift--.f6457.8%
sub-negate-rev57.8%
fp-cancel-sign-sub-inv57.8%
sub-to-fraction57.8%
associate-*l/57.8%
frac-2neg57.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6460.2%
Applied rewrites60.2%
if -8.1999999999999999e52 < y < 2.6e126Initial program 92.9%
Taylor expanded in x around 0
Applied rewrites73.5%
if 2.6e126 < y Initial program 92.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6456.3%
Applied rewrites56.3%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f6457.8%
Applied rewrites57.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1 (/ y t)))))
(if (<=
x
-21499999999999998147276722000525200649264102916181455464280636586050489869271641210244186683797596901525258015604736)
t_1
(if (<= x 8800000000000000) (+ x (* z (/ y t))) t_1))))double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -2.15e+115) {
tmp = t_1;
} else if (x <= 8.8e+15) {
tmp = x + (z * (y / t));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (y / t))
if (x <= (-2.15d+115)) then
tmp = t_1
else if (x <= 8.8d+15) then
tmp = x + (z * (y / t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -2.15e+115) {
tmp = t_1;
} else if (x <= 8.8e+15) {
tmp = x + (z * (y / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) tmp = 0 if x <= -2.15e+115: tmp = t_1 elif x <= 8.8e+15: tmp = x + (z * (y / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / t))) tmp = 0.0 if (x <= -2.15e+115) tmp = t_1; elseif (x <= 8.8e+15) tmp = Float64(x + Float64(z * Float64(y / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / t)); tmp = 0.0; if (x <= -2.15e+115) tmp = t_1; elseif (x <= 8.8e+15) tmp = x + (z * (y / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -21499999999999998147276722000525200649264102916181455464280636586050489869271641210244186683797596901525258015604736], t$95$1, If[LessEqual[x, 8800000000000000], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{if}\;x \leq -21499999999999998147276722000525200649264102916181455464280636586050489869271641210244186683797596901525258015604736:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 8800000000000000:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if x < -2.1499999999999998e115 or 8.8e15 < x Initial program 92.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower--.f6497.8%
Applied rewrites97.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6466.0%
Applied rewrites66.0%
if -2.1499999999999998e115 < x < 8.8e15Initial program 92.9%
Taylor expanded in x around 0
Applied rewrites73.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
lower-*.f6477.4%
Applied rewrites77.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ y t) (- z x))))
(if (<=
z
-110000000000000000836380884533692889214012072090085205846122981705594305889423590684622848)
t_1
(if (<= z 1350000000000000000000) (* x (- 1 (/ y t))) t_1))))double code(double x, double y, double z, double t) {
double t_1 = (y / t) * (z - x);
double tmp;
if (z <= -1.1e+89) {
tmp = t_1;
} else if (z <= 1.35e+21) {
tmp = x * (1.0 - (y / t));
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (y / t) * (z - x)
if (z <= (-1.1d+89)) then
tmp = t_1
else if (z <= 1.35d+21) then
tmp = x * (1.0d0 - (y / t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y / t) * (z - x);
double tmp;
if (z <= -1.1e+89) {
tmp = t_1;
} else if (z <= 1.35e+21) {
tmp = x * (1.0 - (y / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / t) * (z - x) tmp = 0 if z <= -1.1e+89: tmp = t_1 elif z <= 1.35e+21: tmp = x * (1.0 - (y / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / t) * Float64(z - x)) tmp = 0.0 if (z <= -1.1e+89) tmp = t_1; elseif (z <= 1.35e+21) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / t) * (z - x); tmp = 0.0; if (z <= -1.1e+89) tmp = t_1; elseif (z <= 1.35e+21) tmp = x * (1.0 - (y / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / t), $MachinePrecision] * N[(z - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -110000000000000000836380884533692889214012072090085205846122981705594305889423590684622848], t$95$1, If[LessEqual[z, 1350000000000000000000], N[(x * N[(1 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{y}{t} \cdot \left(z - x\right)\\
\mathbf{if}\;z \leq -110000000000000000836380884533692889214012072090085205846122981705594305889423590684622848:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1350000000000000000000:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if z < -1.1e89 or 1.35e21 < z Initial program 92.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6456.3%
Applied rewrites56.3%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f6457.8%
Applied rewrites57.8%
frac-2neg57.8%
add-to-fraction57.8%
lift--.f64N/A
distribute-rgt-neg-outN/A
lift--.f6457.8%
sub-negate-rev57.8%
fp-cancel-sign-sub-inv57.8%
sub-to-fraction57.8%
associate-*l/57.8%
frac-2neg57.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6460.2%
Applied rewrites60.2%
if -1.1e89 < z < 1.35e21Initial program 92.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower--.f6497.8%
Applied rewrites97.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6466.0%
Applied rewrites66.0%
(FPCore (x y z t)
:precision binary64
(if (<=
z
-274999999999999998126975107413708384815629263519276795901247533628514870651670854573542161701642402491262753141904895633260544)
(* (/ y t) z)
(if (<= z 1400000000000000029874101805689864192)
(* x (- 1 (/ y t)))
(* (/ (- z x) t) y))))double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.75e+125) {
tmp = (y / t) * z;
} else if (z <= 1.4e+36) {
tmp = x * (1.0 - (y / t));
} else {
tmp = ((z - x) / t) * y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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.75d+125)) then
tmp = (y / t) * z
else if (z <= 1.4d+36) then
tmp = x * (1.0d0 - (y / t))
else
tmp = ((z - x) / t) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.75e+125) {
tmp = (y / t) * z;
} else if (z <= 1.4e+36) {
tmp = x * (1.0 - (y / t));
} else {
tmp = ((z - x) / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.75e+125: tmp = (y / t) * z elif z <= 1.4e+36: tmp = x * (1.0 - (y / t)) else: tmp = ((z - x) / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.75e+125) tmp = Float64(Float64(y / t) * z); elseif (z <= 1.4e+36) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(Float64(Float64(z - x) / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.75e+125) tmp = (y / t) * z; elseif (z <= 1.4e+36) tmp = x * (1.0 - (y / t)); else tmp = ((z - x) / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -274999999999999998126975107413708384815629263519276795901247533628514870651670854573542161701642402491262753141904895633260544], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[z, 1400000000000000029874101805689864192], N[(x * N[(1 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision] * y), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;z \leq -274999999999999998126975107413708384815629263519276795901247533628514870651670854573542161701642402491262753141904895633260544:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{elif}\;z \leq 1400000000000000029874101805689864192:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z - x}{t} \cdot y\\
\end{array}
if z < -2.75e125Initial program 92.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower--.f6497.8%
Applied rewrites97.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6437.1%
Applied rewrites37.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
associate-/r/N/A
div-flip-revN/A
lift-/.f64N/A
lower-*.f6440.6%
Applied rewrites40.6%
if -2.75e125 < z < 1.4e36Initial program 92.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower--.f6497.8%
Applied rewrites97.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6466.0%
Applied rewrites66.0%
if 1.4e36 < z Initial program 92.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6456.3%
Applied rewrites56.3%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f6457.8%
Applied rewrites57.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ (- z x) t) y)))
(if (<=
y
-4979986173918495/118571099379011784113736688648896417641748464297615937576404566024103044751294464)
t_1
(if (<=
y
2698025344585293/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968)
(* x 1)
t_1))))double code(double x, double y, double z, double t) {
double t_1 = ((z - x) / t) * y;
double tmp;
if (y <= -4.2e-65) {
tmp = t_1;
} else if (y <= 2.9e-122) {
tmp = x * 1.0;
} 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 - x) / t) * y
if (y <= (-4.2d-65)) then
tmp = t_1
else if (y <= 2.9d-122) then
tmp = x * 1.0d0
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 - x) / t) * y;
double tmp;
if (y <= -4.2e-65) {
tmp = t_1;
} else if (y <= 2.9e-122) {
tmp = x * 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((z - x) / t) * y tmp = 0 if y <= -4.2e-65: tmp = t_1 elif y <= 2.9e-122: tmp = x * 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(z - x) / t) * y) tmp = 0.0 if (y <= -4.2e-65) tmp = t_1; elseif (y <= 2.9e-122) tmp = Float64(x * 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((z - x) / t) * y; tmp = 0.0; if (y <= -4.2e-65) tmp = t_1; elseif (y <= 2.9e-122) tmp = x * 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -4979986173918495/118571099379011784113736688648896417641748464297615937576404566024103044751294464], t$95$1, If[LessEqual[y, 2698025344585293/93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968], N[(x * 1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
t_1 := \frac{z - x}{t} \cdot y\\
\mathbf{if}\;y \leq \frac{-4979986173918495}{118571099379011784113736688648896417641748464297615937576404566024103044751294464}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq \frac{2698025344585293}{93035356709837681990313447409664580397266094167976711716030745495121828878514934185752454491361736391777602765602070775492429008462675968}:\\
\;\;\;\;x \cdot 1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y < -4.2000000000000001e-65 or 2.9000000000000002e-122 < y Initial program 92.9%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6456.3%
Applied rewrites56.3%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
sub-divN/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f6457.8%
Applied rewrites57.8%
if -4.2000000000000001e-65 < y < 2.9000000000000002e-122Initial program 92.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower--.f6497.8%
Applied rewrites97.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6466.0%
Applied rewrites66.0%
Taylor expanded in y around 0
Applied rewrites39.4%
(FPCore (x y z t)
:precision binary64
(if (<= t -104999999999999997626664616076826096398720561053696)
(* x 1)
(if (<= t 3412647653636267/4611686018427387904)
(* (/ y t) z)
(* x 1))))double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.05e+50) {
tmp = x * 1.0;
} else if (t <= 0.00074) {
tmp = (y / t) * z;
} else {
tmp = x * 1.0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, 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 (t <= (-1.05d+50)) then
tmp = x * 1.0d0
else if (t <= 0.00074d0) then
tmp = (y / t) * z
else
tmp = x * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.05e+50) {
tmp = x * 1.0;
} else if (t <= 0.00074) {
tmp = (y / t) * z;
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.05e+50: tmp = x * 1.0 elif t <= 0.00074: tmp = (y / t) * z else: tmp = x * 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.05e+50) tmp = Float64(x * 1.0); elseif (t <= 0.00074) tmp = Float64(Float64(y / t) * z); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.05e+50) tmp = x * 1.0; elseif (t <= 0.00074) tmp = (y / t) * z; else tmp = x * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -104999999999999997626664616076826096398720561053696], N[(x * 1), $MachinePrecision], If[LessEqual[t, 3412647653636267/4611686018427387904], N[(N[(y / t), $MachinePrecision] * z), $MachinePrecision], N[(x * 1), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;t \leq -104999999999999997626664616076826096398720561053696:\\
\;\;\;\;x \cdot 1\\
\mathbf{elif}\;t \leq \frac{3412647653636267}{4611686018427387904}:\\
\;\;\;\;\frac{y}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\end{array}
if t < -1.05e50 or 7.3999999999999999e-4 < t Initial program 92.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower--.f6497.8%
Applied rewrites97.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6466.0%
Applied rewrites66.0%
Taylor expanded in y around 0
Applied rewrites39.4%
if -1.05e50 < t < 7.3999999999999999e-4Initial program 92.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower--.f6497.8%
Applied rewrites97.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6437.1%
Applied rewrites37.1%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
associate-/r/N/A
div-flip-revN/A
lift-/.f64N/A
lower-*.f6440.6%
Applied rewrites40.6%
(FPCore (x y z t) :precision binary64 (* x 1))
double code(double x, double y, double z, double t) {
return x * 1.0;
}
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 * 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return x * 1.0;
}
def code(x, y, z, t): return x * 1.0
function code(x, y, z, t) return Float64(x * 1.0) end
function tmp = code(x, y, z, t) tmp = x * 1.0; end
code[x_, y_, z_, t_] := N[(x * 1), $MachinePrecision]
x \cdot 1
Initial program 92.9%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negate-revN/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower--.f6497.8%
Applied rewrites97.8%
Taylor expanded in x around inf
lower-*.f64N/A
lower--.f64N/A
lower-/.f6466.0%
Applied rewrites66.0%
Taylor expanded in y around 0
Applied rewrites39.4%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
(+ x (/ (* y (- z x)) t)))