
(FPCore (x y z t a b) :precision binary64 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))
double code(double x, double y, double z, double t, double a, double b) {
return (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = (x * exp((((y * log(z)) + ((t - 1.0d0) * log(a))) - b))) / y
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (x * Math.exp((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b))) / y;
}
def code(x, y, z, t, a, b): return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
function code(x, y, z, t, a, b) return Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y) end
function tmp = code(x, y, z, t, a, b) tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))
double code(double x, double y, double z, double t, double a, double b) {
return (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = (x * exp((((y * log(z)) + ((t - 1.0d0) * log(a))) - b))) / y
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (x * Math.exp((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b))) / y;
}
def code(x, y, z, t, a, b): return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
function code(x, y, z, t, a, b) return Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y) end
function tmp = code(x, y, z, t, a, b) tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\end{array}
(FPCore (x y z t a b) :precision binary64 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))
double code(double x, double y, double z, double t, double a, double b) {
return (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = (x * exp((((y * log(z)) + ((t - 1.0d0) * log(a))) - b))) / y
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (x * Math.exp((((y * Math.log(z)) + ((t - 1.0) * Math.log(a))) - b))) / y;
}
def code(x, y, z, t, a, b): return (x * math.exp((((y * math.log(z)) + ((t - 1.0) * math.log(a))) - b))) / y
function code(x, y, z, t, a, b) return Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y) end
function tmp = code(x, y, z, t, a, b) tmp = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}
\end{array}
Initial program 99.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y)))
(if (<= t_1 (- INFINITY))
(* (pow a -1.0) (/ x y))
(if (<= t_1 0.0)
(/
(*
x
(/ (/ 1.0 a) (fma (fma (fma 0.16666666666666666 b 0.5) b 1.0) b 1.0)))
y)
(/ (* x (pow a -1.0)) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * exp((((y * log(z)) + ((t - 1.0) * log(a))) - b))) / y;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = pow(a, -1.0) * (x / y);
} else if (t_1 <= 0.0) {
tmp = (x * ((1.0 / a) / fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0))) / y;
} else {
tmp = (x * pow(a, -1.0)) / y;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * exp(Float64(Float64(Float64(y * log(z)) + Float64(Float64(t - 1.0) * log(a))) - b))) / y) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64((a ^ -1.0) * Float64(x / y)); elseif (t_1 <= 0.0) tmp = Float64(Float64(x * Float64(Float64(1.0 / a) / fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0))) / y); else tmp = Float64(Float64(x * (a ^ -1.0)) / y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * N[Exp[N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] + N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[Power[a, -1.0], $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(x * N[(N[(1.0 / a), $MachinePrecision] / N[(N[(N[(0.16666666666666666 * b + 0.5), $MachinePrecision] * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[Power[a, -1.0], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot e^{\left(y \cdot \log z + \left(t - 1\right) \cdot \log a\right) - b}}{y}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;{a}^{-1} \cdot \frac{x}{y}\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{x \cdot \frac{\frac{1}{a}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, b, 0.5\right), b, 1\right), b, 1\right)}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot {a}^{-1}}{y}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < -inf.0Initial program 100.0%
Taylor expanded in b around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6464.1
Applied rewrites64.1%
Taylor expanded in y around 0
Applied rewrites59.6%
Taylor expanded in t around 0
Applied rewrites25.1%
if -inf.0 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) < 0.0Initial program 99.7%
Taylor expanded in t around 0
exp-diffN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identityN/A
exp-diffN/A
lower-/.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
rem-exp-logN/A
lower-exp.f6471.1
Applied rewrites71.1%
Taylor expanded in b around 0
Applied rewrites60.8%
Taylor expanded in y around 0
Applied rewrites46.2%
Taylor expanded in b around 0
Applied rewrites63.9%
if 0.0 < (/.f64 (*.f64 x (exp.f64 (-.f64 (+.f64 (*.f64 y (log.f64 z)) (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a))) b))) y) Initial program 98.9%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
mul-1-negN/A
lower-neg.f64N/A
rem-exp-logN/A
lower-log.f64N/A
rem-exp-log83.7
Applied rewrites83.7%
Taylor expanded in b around 0
exp-sumN/A
*-commutativeN/A
exp-to-powN/A
lower-*.f64N/A
lower-pow.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f6478.5
Applied rewrites78.5%
Taylor expanded in y around 0
Applied rewrites59.8%
Taylor expanded in t around 0
Applied rewrites33.5%
Final simplification45.9%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -3.2e+120)
(/ (* (pow a (- t 1.0)) x) y)
(if (<= t 7.5e+105)
(/ (* x (exp (- (fma (log z) y (- (log a))) b))) y)
(/ (/ (* (pow a t) x) y) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -3.2e+120) {
tmp = (pow(a, (t - 1.0)) * x) / y;
} else if (t <= 7.5e+105) {
tmp = (x * exp((fma(log(z), y, -log(a)) - b))) / y;
} else {
tmp = ((pow(a, t) * x) / y) / a;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -3.2e+120) tmp = Float64(Float64((a ^ Float64(t - 1.0)) * x) / y); elseif (t <= 7.5e+105) tmp = Float64(Float64(x * exp(Float64(fma(log(z), y, Float64(-log(a))) - b))) / y); else tmp = Float64(Float64(Float64((a ^ t) * x) / y) / a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -3.2e+120], N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t, 7.5e+105], N[(N[(x * N[Exp[N[(N[(N[Log[z], $MachinePrecision] * y + (-N[Log[a], $MachinePrecision])), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(N[Power[a, t], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{+120}:\\
\;\;\;\;\frac{{a}^{\left(t - 1\right)} \cdot x}{y}\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{+105}:\\
\;\;\;\;\frac{x \cdot e^{\mathsf{fma}\left(\log z, y, -\log a\right) - b}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{a}^{t} \cdot x}{y}}{a}\\
\end{array}
\end{array}
if t < -3.19999999999999982e120Initial program 100.0%
Taylor expanded in b around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6461.3
Applied rewrites61.3%
Taylor expanded in y around 0
Applied rewrites93.6%
if -3.19999999999999982e120 < t < 7.5000000000000002e105Initial program 99.3%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
mul-1-negN/A
lower-neg.f64N/A
rem-exp-logN/A
lower-log.f64N/A
rem-exp-log96.4
Applied rewrites96.4%
if 7.5000000000000002e105 < t Initial program 100.0%
Taylor expanded in b around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6460.9
Applied rewrites60.9%
Applied rewrites60.9%
Taylor expanded in y around 0
Applied rewrites89.3%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -6e+119)
(/ (* (pow a (- t 1.0)) x) y)
(if (<= t 6.9e+105)
(/ (* x (/ (/ (pow z y) a) (exp b))) y)
(/ (/ (* (pow a t) x) y) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -6e+119) {
tmp = (pow(a, (t - 1.0)) * x) / y;
} else if (t <= 6.9e+105) {
tmp = (x * ((pow(z, y) / a) / exp(b))) / y;
} else {
tmp = ((pow(a, t) * x) / y) / a;
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= (-6d+119)) then
tmp = ((a ** (t - 1.0d0)) * x) / y
else if (t <= 6.9d+105) then
tmp = (x * (((z ** y) / a) / exp(b))) / y
else
tmp = (((a ** t) * x) / y) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -6e+119) {
tmp = (Math.pow(a, (t - 1.0)) * x) / y;
} else if (t <= 6.9e+105) {
tmp = (x * ((Math.pow(z, y) / a) / Math.exp(b))) / y;
} else {
tmp = ((Math.pow(a, t) * x) / y) / a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -6e+119: tmp = (math.pow(a, (t - 1.0)) * x) / y elif t <= 6.9e+105: tmp = (x * ((math.pow(z, y) / a) / math.exp(b))) / y else: tmp = ((math.pow(a, t) * x) / y) / a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -6e+119) tmp = Float64(Float64((a ^ Float64(t - 1.0)) * x) / y); elseif (t <= 6.9e+105) tmp = Float64(Float64(x * Float64(Float64((z ^ y) / a) / exp(b))) / y); else tmp = Float64(Float64(Float64((a ^ t) * x) / y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -6e+119) tmp = ((a ^ (t - 1.0)) * x) / y; elseif (t <= 6.9e+105) tmp = (x * (((z ^ y) / a) / exp(b))) / y; else tmp = (((a ^ t) * x) / y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -6e+119], N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t, 6.9e+105], N[(N[(x * N[(N[(N[Power[z, y], $MachinePrecision] / a), $MachinePrecision] / N[Exp[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(N[(N[Power[a, t], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6 \cdot 10^{+119}:\\
\;\;\;\;\frac{{a}^{\left(t - 1\right)} \cdot x}{y}\\
\mathbf{elif}\;t \leq 6.9 \cdot 10^{+105}:\\
\;\;\;\;\frac{x \cdot \frac{\frac{{z}^{y}}{a}}{e^{b}}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{a}^{t} \cdot x}{y}}{a}\\
\end{array}
\end{array}
if t < -6.00000000000000002e119Initial program 100.0%
Taylor expanded in b around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6461.3
Applied rewrites61.3%
Taylor expanded in y around 0
Applied rewrites93.6%
if -6.00000000000000002e119 < t < 6.90000000000000036e105Initial program 99.3%
Taylor expanded in t around 0
exp-diffN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identityN/A
exp-diffN/A
lower-/.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
rem-exp-logN/A
lower-exp.f6486.4
Applied rewrites86.4%
if 6.90000000000000036e105 < t Initial program 100.0%
Taylor expanded in b around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6460.9
Applied rewrites60.9%
Applied rewrites60.9%
Taylor expanded in y around 0
Applied rewrites89.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -270000000000.0) (not (<= y 5.8e+116))) (/ (/ (* (pow z y) x) y) a) (* x (/ (/ (pow a (- t 1.0)) (exp b)) y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -270000000000.0) || !(y <= 5.8e+116)) {
tmp = ((pow(z, y) * x) / y) / a;
} else {
tmp = x * ((pow(a, (t - 1.0)) / exp(b)) / 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-270000000000.0d0)) .or. (.not. (y <= 5.8d+116))) then
tmp = (((z ** y) * x) / y) / a
else
tmp = x * (((a ** (t - 1.0d0)) / exp(b)) / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -270000000000.0) || !(y <= 5.8e+116)) {
tmp = ((Math.pow(z, y) * x) / y) / a;
} else {
tmp = x * ((Math.pow(a, (t - 1.0)) / Math.exp(b)) / y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -270000000000.0) or not (y <= 5.8e+116): tmp = ((math.pow(z, y) * x) / y) / a else: tmp = x * ((math.pow(a, (t - 1.0)) / math.exp(b)) / y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -270000000000.0) || !(y <= 5.8e+116)) tmp = Float64(Float64(Float64((z ^ y) * x) / y) / a); else tmp = Float64(x * Float64(Float64((a ^ Float64(t - 1.0)) / exp(b)) / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -270000000000.0) || ~((y <= 5.8e+116))) tmp = (((z ^ y) * x) / y) / a; else tmp = x * (((a ^ (t - 1.0)) / exp(b)) / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -270000000000.0], N[Not[LessEqual[y, 5.8e+116]], $MachinePrecision]], N[(N[(N[(N[Power[z, y], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] / N[Exp[b], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -270000000000 \lor \neg \left(y \leq 5.8 \cdot 10^{+116}\right):\\
\;\;\;\;\frac{\frac{{z}^{y} \cdot x}{y}}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{{a}^{\left(t - 1\right)}}{e^{b}}}{y}\\
\end{array}
\end{array}
if y < -2.7e11 or 5.8000000000000003e116 < y Initial program 100.0%
Taylor expanded in b around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6461.8
Applied rewrites61.8%
Applied rewrites61.8%
Taylor expanded in y around 0
Applied rewrites48.0%
Taylor expanded in t around 0
Applied rewrites86.3%
if -2.7e11 < y < 5.8000000000000003e116Initial program 99.1%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
fp-cancel-sub-sign-invN/A
*-commutativeN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
mul-1-negN/A
lower-neg.f64N/A
rem-exp-logN/A
lower-log.f64N/A
rem-exp-log73.3
Applied rewrites73.3%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
exp-diffN/A
lower-/.f64N/A
exp-to-powN/A
lower-pow.f64N/A
lower--.f64N/A
lower-exp.f6485.2
Applied rewrites85.2%
Final simplification85.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -3.5e+122) (not (<= b 4.5e-14))) (* (/ (exp (- b)) y) x) (/ (* x (* (pow a (- t 1.0)) (pow z y))) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -3.5e+122) || !(b <= 4.5e-14)) {
tmp = (exp(-b) / y) * x;
} else {
tmp = (x * (pow(a, (t - 1.0)) * pow(z, y))) / 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b <= (-3.5d+122)) .or. (.not. (b <= 4.5d-14))) then
tmp = (exp(-b) / y) * x
else
tmp = (x * ((a ** (t - 1.0d0)) * (z ** y))) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -3.5e+122) || !(b <= 4.5e-14)) {
tmp = (Math.exp(-b) / y) * x;
} else {
tmp = (x * (Math.pow(a, (t - 1.0)) * Math.pow(z, y))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -3.5e+122) or not (b <= 4.5e-14): tmp = (math.exp(-b) / y) * x else: tmp = (x * (math.pow(a, (t - 1.0)) * math.pow(z, y))) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -3.5e+122) || !(b <= 4.5e-14)) tmp = Float64(Float64(exp(Float64(-b)) / y) * x); else tmp = Float64(Float64(x * Float64((a ^ Float64(t - 1.0)) * (z ^ y))) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -3.5e+122) || ~((b <= 4.5e-14))) tmp = (exp(-b) / y) * x; else tmp = (x * ((a ^ (t - 1.0)) * (z ^ y))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -3.5e+122], N[Not[LessEqual[b, 4.5e-14]], $MachinePrecision]], N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], N[(N[(x * N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] * N[Power[z, y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.5 \cdot 10^{+122} \lor \neg \left(b \leq 4.5 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{e^{-b}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left({a}^{\left(t - 1\right)} \cdot {z}^{y}\right)}{y}\\
\end{array}
\end{array}
if b < -3.50000000000000014e122 or 4.4999999999999998e-14 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6484.5
Applied rewrites84.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6484.5
Applied rewrites84.5%
if -3.50000000000000014e122 < b < 4.4999999999999998e-14Initial program 99.2%
Taylor expanded in b around 0
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f6483.8
Applied rewrites83.8%
Final simplification84.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (/ (exp (- b)) y) x)))
(if (<= b -3.5e+122)
t_1
(if (<= b -9.8e-262)
(* (* (pow a (- t 1.0)) (pow z y)) (/ x y))
(if (<= b 22000.0) (/ (/ (* (pow z y) x) y) a) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (exp(-b) / y) * x;
double tmp;
if (b <= -3.5e+122) {
tmp = t_1;
} else if (b <= -9.8e-262) {
tmp = (pow(a, (t - 1.0)) * pow(z, y)) * (x / y);
} else if (b <= 22000.0) {
tmp = ((pow(z, y) * x) / y) / a;
} 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (exp(-b) / y) * x
if (b <= (-3.5d+122)) then
tmp = t_1
else if (b <= (-9.8d-262)) then
tmp = ((a ** (t - 1.0d0)) * (z ** y)) * (x / y)
else if (b <= 22000.0d0) then
tmp = (((z ** y) * x) / y) / a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (Math.exp(-b) / y) * x;
double tmp;
if (b <= -3.5e+122) {
tmp = t_1;
} else if (b <= -9.8e-262) {
tmp = (Math.pow(a, (t - 1.0)) * Math.pow(z, y)) * (x / y);
} else if (b <= 22000.0) {
tmp = ((Math.pow(z, y) * x) / y) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (math.exp(-b) / y) * x tmp = 0 if b <= -3.5e+122: tmp = t_1 elif b <= -9.8e-262: tmp = (math.pow(a, (t - 1.0)) * math.pow(z, y)) * (x / y) elif b <= 22000.0: tmp = ((math.pow(z, y) * x) / y) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(exp(Float64(-b)) / y) * x) tmp = 0.0 if (b <= -3.5e+122) tmp = t_1; elseif (b <= -9.8e-262) tmp = Float64(Float64((a ^ Float64(t - 1.0)) * (z ^ y)) * Float64(x / y)); elseif (b <= 22000.0) tmp = Float64(Float64(Float64((z ^ y) * x) / y) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (exp(-b) / y) * x; tmp = 0.0; if (b <= -3.5e+122) tmp = t_1; elseif (b <= -9.8e-262) tmp = ((a ^ (t - 1.0)) * (z ^ y)) * (x / y); elseif (b <= 22000.0) tmp = (((z ^ y) * x) / y) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[b, -3.5e+122], t$95$1, If[LessEqual[b, -9.8e-262], N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] * N[Power[z, y], $MachinePrecision]), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 22000.0], N[(N[(N[(N[Power[z, y], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{e^{-b}}{y} \cdot x\\
\mathbf{if}\;b \leq -3.5 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq -9.8 \cdot 10^{-262}:\\
\;\;\;\;\left({a}^{\left(t - 1\right)} \cdot {z}^{y}\right) \cdot \frac{x}{y}\\
\mathbf{elif}\;b \leq 22000:\\
\;\;\;\;\frac{\frac{{z}^{y} \cdot x}{y}}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -3.50000000000000014e122 or 22000 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6485.0
Applied rewrites85.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6485.0
Applied rewrites85.0%
if -3.50000000000000014e122 < b < -9.8000000000000005e-262Initial program 99.1%
Taylor expanded in b around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6479.5
Applied rewrites79.5%
if -9.8000000000000005e-262 < b < 22000Initial program 99.2%
Taylor expanded in b around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6474.5
Applied rewrites74.5%
Applied rewrites74.6%
Taylor expanded in y around 0
Applied rewrites72.1%
Taylor expanded in t around 0
Applied rewrites82.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -3.5e+122) (not (<= b 22000.0))) (* (/ (exp (- b)) y) x) (/ (/ (* (pow z y) x) y) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -3.5e+122) || !(b <= 22000.0)) {
tmp = (exp(-b) / y) * x;
} else {
tmp = ((pow(z, y) * x) / y) / a;
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b <= (-3.5d+122)) .or. (.not. (b <= 22000.0d0))) then
tmp = (exp(-b) / y) * x
else
tmp = (((z ** y) * x) / y) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -3.5e+122) || !(b <= 22000.0)) {
tmp = (Math.exp(-b) / y) * x;
} else {
tmp = ((Math.pow(z, y) * x) / y) / a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -3.5e+122) or not (b <= 22000.0): tmp = (math.exp(-b) / y) * x else: tmp = ((math.pow(z, y) * x) / y) / a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -3.5e+122) || !(b <= 22000.0)) tmp = Float64(Float64(exp(Float64(-b)) / y) * x); else tmp = Float64(Float64(Float64((z ^ y) * x) / y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -3.5e+122) || ~((b <= 22000.0))) tmp = (exp(-b) / y) * x; else tmp = (((z ^ y) * x) / y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -3.5e+122], N[Not[LessEqual[b, 22000.0]], $MachinePrecision]], N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(N[Power[z, y], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.5 \cdot 10^{+122} \lor \neg \left(b \leq 22000\right):\\
\;\;\;\;\frac{e^{-b}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{z}^{y} \cdot x}{y}}{a}\\
\end{array}
\end{array}
if b < -3.50000000000000014e122 or 22000 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6485.0
Applied rewrites85.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6485.0
Applied rewrites85.0%
if -3.50000000000000014e122 < b < 22000Initial program 99.2%
Taylor expanded in b around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6477.4
Applied rewrites77.4%
Applied rewrites77.5%
Taylor expanded in y around 0
Applied rewrites67.6%
Taylor expanded in t around 0
Applied rewrites77.7%
Final simplification80.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -6.6e+69) (not (<= b 220000.0))) (* (/ (exp (- b)) y) x) (* (/ (pow z y) y) (/ x a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -6.6e+69) || !(b <= 220000.0)) {
tmp = (exp(-b) / y) * x;
} else {
tmp = (pow(z, y) / y) * (x / a);
}
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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b <= (-6.6d+69)) .or. (.not. (b <= 220000.0d0))) then
tmp = (exp(-b) / y) * x
else
tmp = ((z ** y) / y) * (x / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -6.6e+69) || !(b <= 220000.0)) {
tmp = (Math.exp(-b) / y) * x;
} else {
tmp = (Math.pow(z, y) / y) * (x / a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -6.6e+69) or not (b <= 220000.0): tmp = (math.exp(-b) / y) * x else: tmp = (math.pow(z, y) / y) * (x / a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -6.6e+69) || !(b <= 220000.0)) tmp = Float64(Float64(exp(Float64(-b)) / y) * x); else tmp = Float64(Float64((z ^ y) / y) * Float64(x / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -6.6e+69) || ~((b <= 220000.0))) tmp = (exp(-b) / y) * x; else tmp = ((z ^ y) / y) * (x / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -6.6e+69], N[Not[LessEqual[b, 220000.0]], $MachinePrecision]], N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[Power[z, y], $MachinePrecision] / y), $MachinePrecision] * N[(x / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.6 \cdot 10^{+69} \lor \neg \left(b \leq 220000\right):\\
\;\;\;\;\frac{e^{-b}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{{z}^{y}}{y} \cdot \frac{x}{a}\\
\end{array}
\end{array}
if b < -6.5999999999999997e69 or 2.2e5 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6483.3
Applied rewrites83.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6483.3
Applied rewrites83.3%
if -6.5999999999999997e69 < b < 2.2e5Initial program 99.1%
Taylor expanded in b around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6476.7
Applied rewrites76.7%
Taylor expanded in t around 0
Applied rewrites72.8%
Final simplification77.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.4e+162) (not (<= b 3.4e-23))) (* (/ (exp (- b)) y) x) (/ (* (pow a (- t 1.0)) x) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.4e+162) || !(b <= 3.4e-23)) {
tmp = (exp(-b) / y) * x;
} else {
tmp = (pow(a, (t - 1.0)) * x) / y;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b <= (-1.4d+162)) .or. (.not. (b <= 3.4d-23))) then
tmp = (exp(-b) / y) * x
else
tmp = ((a ** (t - 1.0d0)) * x) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.4e+162) || !(b <= 3.4e-23)) {
tmp = (Math.exp(-b) / y) * x;
} else {
tmp = (Math.pow(a, (t - 1.0)) * x) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -1.4e+162) or not (b <= 3.4e-23): tmp = (math.exp(-b) / y) * x else: tmp = (math.pow(a, (t - 1.0)) * x) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.4e+162) || !(b <= 3.4e-23)) tmp = Float64(Float64(exp(Float64(-b)) / y) * x); else tmp = Float64(Float64((a ^ Float64(t - 1.0)) * x) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -1.4e+162) || ~((b <= 3.4e-23))) tmp = (exp(-b) / y) * x; else tmp = ((a ^ (t - 1.0)) * x) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.4e+162], N[Not[LessEqual[b, 3.4e-23]], $MachinePrecision]], N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.4 \cdot 10^{+162} \lor \neg \left(b \leq 3.4 \cdot 10^{-23}\right):\\
\;\;\;\;\frac{e^{-b}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{{a}^{\left(t - 1\right)} \cdot x}{y}\\
\end{array}
\end{array}
if b < -1.39999999999999995e162 or 3.4000000000000001e-23 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6485.8
Applied rewrites85.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6485.8
Applied rewrites85.8%
if -1.39999999999999995e162 < b < 3.4000000000000001e-23Initial program 99.2%
Taylor expanded in b around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6475.0
Applied rewrites75.0%
Taylor expanded in y around 0
Applied rewrites67.2%
Final simplification74.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.0) (not (<= b 2.45e-124))) (* (/ (exp (- b)) y) x) (/ (* x (/ 1.0 (* (- b -1.0) a))) y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.0) || !(b <= 2.45e-124)) {
tmp = (exp(-b) / y) * x;
} else {
tmp = (x * (1.0 / ((b - -1.0) * a))) / 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b <= (-1.0d0)) .or. (.not. (b <= 2.45d-124))) then
tmp = (exp(-b) / y) * x
else
tmp = (x * (1.0d0 / ((b - (-1.0d0)) * a))) / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.0) || !(b <= 2.45e-124)) {
tmp = (Math.exp(-b) / y) * x;
} else {
tmp = (x * (1.0 / ((b - -1.0) * a))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -1.0) or not (b <= 2.45e-124): tmp = (math.exp(-b) / y) * x else: tmp = (x * (1.0 / ((b - -1.0) * a))) / y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.0) || !(b <= 2.45e-124)) tmp = Float64(Float64(exp(Float64(-b)) / y) * x); else tmp = Float64(Float64(x * Float64(1.0 / Float64(Float64(b - -1.0) * a))) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -1.0) || ~((b <= 2.45e-124))) tmp = (exp(-b) / y) * x; else tmp = (x * (1.0 / ((b - -1.0) * a))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.0], N[Not[LessEqual[b, 2.45e-124]], $MachinePrecision]], N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], N[(N[(x * N[(1.0 / N[(N[(b - -1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1 \lor \neg \left(b \leq 2.45 \cdot 10^{-124}\right):\\
\;\;\;\;\frac{e^{-b}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{1}{\left(b - -1\right) \cdot a}}{y}\\
\end{array}
\end{array}
if b < -1 or 2.44999999999999983e-124 < b Initial program 99.9%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6478.0
Applied rewrites78.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6478.0
Applied rewrites78.0%
if -1 < b < 2.44999999999999983e-124Initial program 98.9%
Taylor expanded in t around 0
exp-diffN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identityN/A
exp-diffN/A
lower-/.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
rem-exp-logN/A
lower-exp.f6478.2
Applied rewrites78.2%
Taylor expanded in b around 0
Applied rewrites78.2%
Taylor expanded in y around 0
Applied rewrites36.9%
Applied rewrites36.9%
Final simplification61.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= b 4.5e-23)
(* (pow a -1.0) (/ x y))
(/
(* x (/ (/ 1.0 a) (fma (fma (fma 0.16666666666666666 b 0.5) b 1.0) b 1.0)))
y)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= 4.5e-23) {
tmp = pow(a, -1.0) * (x / y);
} else {
tmp = (x * ((1.0 / a) / fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0))) / y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= 4.5e-23) tmp = Float64((a ^ -1.0) * Float64(x / y)); else tmp = Float64(Float64(x * Float64(Float64(1.0 / a) / fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0))) / y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, 4.5e-23], N[(N[Power[a, -1.0], $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(N[(1.0 / a), $MachinePrecision] / N[(N[(N[(0.16666666666666666 * b + 0.5), $MachinePrecision] * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq 4.5 \cdot 10^{-23}:\\
\;\;\;\;{a}^{-1} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{\frac{1}{a}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, b, 0.5\right), b, 1\right), b, 1\right)}}{y}\\
\end{array}
\end{array}
if b < 4.49999999999999975e-23Initial program 99.3%
Taylor expanded in b around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
exp-sumN/A
lower-*.f64N/A
exp-prodN/A
lower-pow.f64N/A
rem-exp-logN/A
lower--.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
lower-/.f6472.2
Applied rewrites72.2%
Taylor expanded in y around 0
Applied rewrites63.0%
Taylor expanded in t around 0
Applied rewrites36.3%
if 4.49999999999999975e-23 < b Initial program 100.0%
Taylor expanded in t around 0
exp-diffN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identityN/A
exp-diffN/A
lower-/.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
rem-exp-logN/A
lower-exp.f6471.4
Applied rewrites71.4%
Taylor expanded in b around 0
Applied rewrites53.2%
Taylor expanded in y around 0
Applied rewrites43.0%
Taylor expanded in b around 0
Applied rewrites67.9%
(FPCore (x y z t a b) :precision binary64 (/ (* x (/ (/ 1.0 a) (fma (fma (fma 0.16666666666666666 b 0.5) b 1.0) b 1.0))) y))
double code(double x, double y, double z, double t, double a, double b) {
return (x * ((1.0 / a) / fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0))) / y;
}
function code(x, y, z, t, a, b) return Float64(Float64(x * Float64(Float64(1.0 / a) / fma(fma(fma(0.16666666666666666, b, 0.5), b, 1.0), b, 1.0))) / y) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[(N[(1.0 / a), $MachinePrecision] / N[(N[(N[(0.16666666666666666 * b + 0.5), $MachinePrecision] * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\frac{1}{a}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, b, 0.5\right), b, 1\right), b, 1\right)}}{y}
\end{array}
Initial program 99.5%
Taylor expanded in t around 0
exp-diffN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identityN/A
exp-diffN/A
lower-/.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
rem-exp-logN/A
lower-exp.f6474.4
Applied rewrites74.4%
Taylor expanded in b around 0
Applied rewrites54.5%
Taylor expanded in y around 0
Applied rewrites32.5%
Taylor expanded in b around 0
Applied rewrites40.8%
(FPCore (x y z t a b) :precision binary64 (/ (* x (/ (/ 1.0 a) (fma (fma 0.5 b 1.0) b 1.0))) y))
double code(double x, double y, double z, double t, double a, double b) {
return (x * ((1.0 / a) / fma(fma(0.5, b, 1.0), b, 1.0))) / y;
}
function code(x, y, z, t, a, b) return Float64(Float64(x * Float64(Float64(1.0 / a) / fma(fma(0.5, b, 1.0), b, 1.0))) / y) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[(N[(1.0 / a), $MachinePrecision] / N[(N[(0.5 * b + 1.0), $MachinePrecision] * b + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{\frac{1}{a}}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, b, 1\right), b, 1\right)}}{y}
\end{array}
Initial program 99.5%
Taylor expanded in t around 0
exp-diffN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identityN/A
exp-diffN/A
lower-/.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
rem-exp-logN/A
lower-exp.f6474.4
Applied rewrites74.4%
Taylor expanded in b around 0
Applied rewrites54.5%
Taylor expanded in y around 0
Applied rewrites32.5%
Taylor expanded in b around 0
Applied rewrites40.3%
(FPCore (x y z t a b) :precision binary64 (/ (* x (/ 1.0 (* (- b -1.0) a))) y))
double code(double x, double y, double z, double t, double a, double b) {
return (x * (1.0 / ((b - -1.0) * a))) / y;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
code = (x * (1.0d0 / ((b - (-1.0d0)) * a))) / y
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (x * (1.0 / ((b - -1.0) * a))) / y;
}
def code(x, y, z, t, a, b): return (x * (1.0 / ((b - -1.0) * a))) / y
function code(x, y, z, t, a, b) return Float64(Float64(x * Float64(1.0 / Float64(Float64(b - -1.0) * a))) / y) end
function tmp = code(x, y, z, t, a, b) tmp = (x * (1.0 / ((b - -1.0) * a))) / y; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[(1.0 / N[(N[(b - -1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \frac{1}{\left(b - -1\right) \cdot a}}{y}
\end{array}
Initial program 99.5%
Taylor expanded in t around 0
exp-diffN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-rgt-identityN/A
exp-diffN/A
lower-/.f64N/A
*-commutativeN/A
exp-to-powN/A
lower-pow.f64N/A
rem-exp-logN/A
lower-exp.f6474.4
Applied rewrites74.4%
Taylor expanded in b around 0
Applied rewrites54.5%
Taylor expanded in y around 0
Applied rewrites32.5%
Applied rewrites32.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (pow a (- t 1.0)))
(t_2 (/ (* x (/ t_1 y)) (- (+ b 1.0) (* y (log z))))))
(if (< t -0.8845848504127471)
t_2
(if (< t 852031.2288374073)
(/ (* (/ x y) t_1) (exp (- b (* (log z) y))))
t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = pow(a, (t - 1.0));
double t_2 = (x * (t_1 / y)) / ((b + 1.0) - (y * log(z)));
double tmp;
if (t < -0.8845848504127471) {
tmp = t_2;
} else if (t < 852031.2288374073) {
tmp = ((x / y) * t_1) / exp((b - (log(z) * y)));
} 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, a, b)
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), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = a ** (t - 1.0d0)
t_2 = (x * (t_1 / y)) / ((b + 1.0d0) - (y * log(z)))
if (t < (-0.8845848504127471d0)) then
tmp = t_2
else if (t < 852031.2288374073d0) then
tmp = ((x / y) * t_1) / exp((b - (log(z) * y)))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.pow(a, (t - 1.0));
double t_2 = (x * (t_1 / y)) / ((b + 1.0) - (y * Math.log(z)));
double tmp;
if (t < -0.8845848504127471) {
tmp = t_2;
} else if (t < 852031.2288374073) {
tmp = ((x / y) * t_1) / Math.exp((b - (Math.log(z) * y)));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.pow(a, (t - 1.0)) t_2 = (x * (t_1 / y)) / ((b + 1.0) - (y * math.log(z))) tmp = 0 if t < -0.8845848504127471: tmp = t_2 elif t < 852031.2288374073: tmp = ((x / y) * t_1) / math.exp((b - (math.log(z) * y))) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = a ^ Float64(t - 1.0) t_2 = Float64(Float64(x * Float64(t_1 / y)) / Float64(Float64(b + 1.0) - Float64(y * log(z)))) tmp = 0.0 if (t < -0.8845848504127471) tmp = t_2; elseif (t < 852031.2288374073) tmp = Float64(Float64(Float64(x / y) * t_1) / exp(Float64(b - Float64(log(z) * y)))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a ^ (t - 1.0); t_2 = (x * (t_1 / y)) / ((b + 1.0) - (y * log(z))); tmp = 0.0; if (t < -0.8845848504127471) tmp = t_2; elseif (t < 852031.2288374073) tmp = ((x / y) * t_1) / exp((b - (log(z) * y))); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Power[a, N[(t - 1.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision] / N[(N[(b + 1.0), $MachinePrecision] - N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -0.8845848504127471], t$95$2, If[Less[t, 852031.2288374073], N[(N[(N[(x / y), $MachinePrecision] * t$95$1), $MachinePrecision] / N[Exp[N[(b - N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {a}^{\left(t - 1\right)}\\
t_2 := \frac{x \cdot \frac{t\_1}{y}}{\left(b + 1\right) - y \cdot \log z}\\
\mathbf{if}\;t < -0.8845848504127471:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t < 852031.2288374073:\\
\;\;\;\;\frac{\frac{x}{y} \cdot t\_1}{e^{b - \log z \cdot y}}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
herbie shell --seed 2025017
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A"
:precision binary64
:alt
(! :herbie-platform default (if (< t -8845848504127471/10000000000000000) (/ (* x (/ (pow a (- t 1)) y)) (- (+ b 1) (* y (log z)))) (if (< t 8520312288374073/10000000000) (/ (* (/ x y) (pow a (- t 1))) (exp (- b (* (log z) y)))) (/ (* x (/ (pow a (- t 1)) y)) (- (+ b 1) (* y (log z)))))))
(/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))