
(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}
Herbie found 17 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
(let* ((t_1
(pow
(pow a (/ (- 1.0 t) -2.0))
(+ (/ (- (* y (log z)) b) (* (- t 1.0) (log a))) 1.0))))
(* (/ (* t_1 t_1) y) x)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = pow(pow(a, ((1.0 - t) / -2.0)), ((((y * log(z)) - b) / ((t - 1.0) * log(a))) + 1.0));
return ((t_1 * t_1) / y) * x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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
t_1 = (a ** ((1.0d0 - t) / (-2.0d0))) ** ((((y * log(z)) - b) / ((t - 1.0d0) * log(a))) + 1.0d0)
code = ((t_1 * t_1) / y) * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.pow(Math.pow(a, ((1.0 - t) / -2.0)), ((((y * Math.log(z)) - b) / ((t - 1.0) * Math.log(a))) + 1.0));
return ((t_1 * t_1) / y) * x;
}
def code(x, y, z, t, a, b): t_1 = math.pow(math.pow(a, ((1.0 - t) / -2.0)), ((((y * math.log(z)) - b) / ((t - 1.0) * math.log(a))) + 1.0)) return ((t_1 * t_1) / y) * x
function code(x, y, z, t, a, b) t_1 = (a ^ Float64(Float64(1.0 - t) / -2.0)) ^ Float64(Float64(Float64(Float64(y * log(z)) - b) / Float64(Float64(t - 1.0) * log(a))) + 1.0) return Float64(Float64(Float64(t_1 * t_1) / y) * x) end
function tmp = code(x, y, z, t, a, b) t_1 = (a ^ ((1.0 - t) / -2.0)) ^ ((((y * log(z)) - b) / ((t - 1.0) * log(a))) + 1.0); tmp = ((t_1 * t_1) / y) * x; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Power[N[Power[a, N[(N[(1.0 - t), $MachinePrecision] / -2.0), $MachinePrecision]], $MachinePrecision], N[(N[(N[(N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision] / N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\left({a}^{\left(\frac{1 - t}{-2}\right)}\right)}^{\left(\frac{y \cdot \log z - b}{\left(t - 1\right) \cdot \log a} + 1\right)}\\
\frac{t\_1 \cdot t\_1}{y} \cdot x
\end{array}
\end{array}
Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
lift-exp.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
sum-to-multN/A
*-commutativeN/A
pow-expN/A
lift-*.f64N/A
lift-log.f64N/A
pow-to-expN/A
sqr-powN/A
unpow-prod-downN/A
Applied rewrites98.9%
(FPCore (x y z t a b)
:precision binary64
(*
(/
(pow
(pow a (* -0.5 (- 1.0 t)))
(fma (/ (- (* (log z) y) b) (* (log a) (- t 1.0))) 2.0 2.0))
y)
x))
double code(double x, double y, double z, double t, double a, double b) {
return (pow(pow(a, (-0.5 * (1.0 - t))), fma((((log(z) * y) - b) / (log(a) * (t - 1.0))), 2.0, 2.0)) / y) * x;
}
function code(x, y, z, t, a, b) return Float64(Float64(((a ^ Float64(-0.5 * Float64(1.0 - t))) ^ fma(Float64(Float64(Float64(log(z) * y) - b) / Float64(log(a) * Float64(t - 1.0))), 2.0, 2.0)) / y) * x) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[Power[N[Power[a, N[(-0.5 * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[(N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision] - b), $MachinePrecision] / N[(N[Log[a], $MachinePrecision] * N[(t - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 2.0 + 2.0), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left({a}^{\left(-0.5 \cdot \left(1 - t\right)\right)}\right)}^{\left(\mathsf{fma}\left(\frac{\log z \cdot y - b}{\log a \cdot \left(t - 1\right)}, 2, 2\right)\right)}}{y} \cdot x
\end{array}
Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
lift-exp.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
sum-to-multN/A
*-commutativeN/A
pow-expN/A
lift-*.f64N/A
lift-log.f64N/A
pow-to-expN/A
sqr-powN/A
unpow-prod-downN/A
Applied rewrites98.9%
lift-*.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-sqrN/A
lower-pow.f64N/A
lift-/.f64N/A
div-flipN/A
associate-/r/N/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites98.9%
(FPCore (x y z t a b) :precision binary64 (/ x (/ y (exp (fma (log a) (- t 1.0) (- (* (log z) y) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x / (y / exp(fma(log(a), (t - 1.0), ((log(z) * y) - b))));
}
function code(x, y, z, t, a, b) return Float64(x / Float64(y / exp(fma(log(a), Float64(t - 1.0), Float64(Float64(log(z) * y) - b))))) end
code[x_, y_, z_, t_, a_, b_] := N[(x / N[(y / N[Exp[N[(N[Log[a], $MachinePrecision] * N[(t - 1.0), $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{y}{e^{\mathsf{fma}\left(\log a, t - 1, \log z \cdot y - b\right)}}}
\end{array}
Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
lift-exp.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
sum-to-multN/A
*-commutativeN/A
pow-expN/A
lift-*.f64N/A
lift-log.f64N/A
pow-to-expN/A
sqr-powN/A
unpow-prod-downN/A
Applied rewrites98.9%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
Applied rewrites98.5%
(FPCore (x y z t a b) :precision binary64 (/ x (* (exp (fma (log a) (- 1.0 t) (- b (* y (log z))))) y)))
double code(double x, double y, double z, double t, double a, double b) {
return x / (exp(fma(log(a), (1.0 - t), (b - (y * log(z))))) * y);
}
function code(x, y, z, t, a, b) return Float64(x / Float64(exp(fma(log(a), Float64(1.0 - t), Float64(b - Float64(y * log(z))))) * y)) end
code[x_, y_, z_, t_, a_, b_] := N[(x / N[(N[Exp[N[(N[Log[a], $MachinePrecision] * N[(1.0 - t), $MachinePrecision] + N[(b - N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{e^{\mathsf{fma}\left(\log a, 1 - t, b - y \cdot \log z\right)} \cdot y}
\end{array}
Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
lift-exp.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
sum-to-multN/A
*-commutativeN/A
pow-expN/A
lift-*.f64N/A
lift-log.f64N/A
pow-to-expN/A
sqr-powN/A
unpow-prod-downN/A
Applied rewrites98.9%
Applied rewrites98.5%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
mult-flip-revN/A
lower-/.f64N/A
lower-*.f6498.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6498.5
Applied rewrites98.5%
(FPCore (x y z t a b) :precision binary64 (* (/ (exp (fma (log a) (- t 1.0) (- (* (log z) y) b))) y) x))
double code(double x, double y, double z, double t, double a, double b) {
return (exp(fma(log(a), (t - 1.0), ((log(z) * y) - b))) / y) * x;
}
function code(x, y, z, t, a, b) return Float64(Float64(exp(fma(log(a), Float64(t - 1.0), Float64(Float64(log(z) * y) - b))) / y) * x) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[Exp[N[(N[Log[a], $MachinePrecision] * N[(t - 1.0), $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{\mathsf{fma}\left(\log a, t - 1, \log z \cdot y - b\right)}}{y} \cdot x
\end{array}
Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- t 1.0) (log a))))
(if (<= t_1 -595.0)
(* (exp (fma (log a) (- t 1.0) (- (* (log z) y) b))) (/ x y))
(if (<= t_1 4e+65)
(/ (* x (exp (- (fma -1.0 (log a) (* y (log z))) b))) y)
(/ (* x (sqrt (exp (* (- t_1 b) 2.0)))) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - 1.0) * log(a);
double tmp;
if (t_1 <= -595.0) {
tmp = exp(fma(log(a), (t - 1.0), ((log(z) * y) - b))) * (x / y);
} else if (t_1 <= 4e+65) {
tmp = (x * exp((fma(-1.0, log(a), (y * log(z))) - b))) / y;
} else {
tmp = (x * sqrt(exp(((t_1 - b) * 2.0)))) / y;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - 1.0) * log(a)) tmp = 0.0 if (t_1 <= -595.0) tmp = Float64(exp(fma(log(a), Float64(t - 1.0), Float64(Float64(log(z) * y) - b))) * Float64(x / y)); elseif (t_1 <= 4e+65) tmp = Float64(Float64(x * exp(Float64(fma(-1.0, log(a), Float64(y * log(z))) - b))) / y); else tmp = Float64(Float64(x * sqrt(exp(Float64(Float64(t_1 - b) * 2.0)))) / y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -595.0], N[(N[Exp[N[(N[Log[a], $MachinePrecision] * N[(t - 1.0), $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+65], N[(N[(x * N[Exp[N[(N[(-1.0 * N[Log[a], $MachinePrecision] + N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(N[(x * N[Sqrt[N[Exp[N[(N[(t$95$1 - b), $MachinePrecision] * 2.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - 1\right) \cdot \log a\\
\mathbf{if}\;t\_1 \leq -595:\\
\;\;\;\;e^{\mathsf{fma}\left(\log a, t - 1, \log z \cdot y - b\right)} \cdot \frac{x}{y}\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+65}:\\
\;\;\;\;\frac{x \cdot e^{\mathsf{fma}\left(-1, \log a, y \cdot \log z\right) - b}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \sqrt{e^{\left(t\_1 - b\right) \cdot 2}}}{y}\\
\end{array}
\end{array}
if (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -595Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites88.1%
if -595 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 4e65Initial program 98.2%
Taylor expanded in t around 0
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6479.2
Applied rewrites79.2%
if 4e65 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f64N/A
lower--.f6479.7
Applied rewrites79.7%
lift-exp.f64N/A
exp-fabsN/A
lift-exp.f64N/A
rem-sqrt-square-revN/A
lower-sqrt.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
Applied rewrites78.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- t 1.0) (log a))) (t_2 (- t_1 b)))
(if (<= t_1 -2e+27)
(* (/ (exp t_2) y) x)
(if (<= t_1 4e+65)
(* (/ (exp (fma (log a) -1.0 (- (* (log z) y) b))) y) x)
(/ (* x (sqrt (exp (* t_2 2.0)))) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - 1.0) * log(a);
double t_2 = t_1 - b;
double tmp;
if (t_1 <= -2e+27) {
tmp = (exp(t_2) / y) * x;
} else if (t_1 <= 4e+65) {
tmp = (exp(fma(log(a), -1.0, ((log(z) * y) - b))) / y) * x;
} else {
tmp = (x * sqrt(exp((t_2 * 2.0)))) / y;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - 1.0) * log(a)) t_2 = Float64(t_1 - b) tmp = 0.0 if (t_1 <= -2e+27) tmp = Float64(Float64(exp(t_2) / y) * x); elseif (t_1 <= 4e+65) tmp = Float64(Float64(exp(fma(log(a), -1.0, Float64(Float64(log(z) * y) - b))) / y) * x); else tmp = Float64(Float64(x * sqrt(exp(Float64(t_2 * 2.0)))) / y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - b), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+27], N[(N[(N[Exp[t$95$2], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$1, 4e+65], N[(N[(N[Exp[N[(N[Log[a], $MachinePrecision] * -1.0 + N[(N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], N[(N[(x * N[Sqrt[N[Exp[N[(t$95$2 * 2.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - 1\right) \cdot \log a\\
t_2 := t\_1 - b\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+27}:\\
\;\;\;\;\frac{e^{t\_2}}{y} \cdot x\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+65}:\\
\;\;\;\;\frac{e^{\mathsf{fma}\left(\log a, -1, \log z \cdot y - b\right)}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \sqrt{e^{t\_2 \cdot 2}}}{y}\\
\end{array}
\end{array}
if (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -2e27Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f64N/A
lower--.f6479.7
Applied rewrites79.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.0%
if -2e27 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 4e65Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
Taylor expanded in t around 0
Applied rewrites79.7%
if 4e65 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f64N/A
lower--.f6479.7
Applied rewrites79.7%
lift-exp.f64N/A
exp-fabsN/A
lift-exp.f64N/A
rem-sqrt-square-revN/A
lower-sqrt.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
Applied rewrites78.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- t 1.0) (log a))) (t_2 (- t_1 b)))
(if (<= t_1 -2e+27)
(* (/ (exp t_2) y) x)
(if (<= t_1 4e+65)
(/ x (* y (exp (- (+ b (log a)) (* y (log z))))))
(/ (* x (sqrt (exp (* t_2 2.0)))) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - 1.0) * log(a);
double t_2 = t_1 - b;
double tmp;
if (t_1 <= -2e+27) {
tmp = (exp(t_2) / y) * x;
} else if (t_1 <= 4e+65) {
tmp = x / (y * exp(((b + log(a)) - (y * log(z)))));
} else {
tmp = (x * sqrt(exp((t_2 * 2.0)))) / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (t - 1.0d0) * log(a)
t_2 = t_1 - b
if (t_1 <= (-2d+27)) then
tmp = (exp(t_2) / y) * x
else if (t_1 <= 4d+65) then
tmp = x / (y * exp(((b + log(a)) - (y * log(z)))))
else
tmp = (x * sqrt(exp((t_2 * 2.0d0)))) / y
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 = (t - 1.0) * Math.log(a);
double t_2 = t_1 - b;
double tmp;
if (t_1 <= -2e+27) {
tmp = (Math.exp(t_2) / y) * x;
} else if (t_1 <= 4e+65) {
tmp = x / (y * Math.exp(((b + Math.log(a)) - (y * Math.log(z)))));
} else {
tmp = (x * Math.sqrt(Math.exp((t_2 * 2.0)))) / y;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - 1.0) * math.log(a) t_2 = t_1 - b tmp = 0 if t_1 <= -2e+27: tmp = (math.exp(t_2) / y) * x elif t_1 <= 4e+65: tmp = x / (y * math.exp(((b + math.log(a)) - (y * math.log(z))))) else: tmp = (x * math.sqrt(math.exp((t_2 * 2.0)))) / y return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - 1.0) * log(a)) t_2 = Float64(t_1 - b) tmp = 0.0 if (t_1 <= -2e+27) tmp = Float64(Float64(exp(t_2) / y) * x); elseif (t_1 <= 4e+65) tmp = Float64(x / Float64(y * exp(Float64(Float64(b + log(a)) - Float64(y * log(z)))))); else tmp = Float64(Float64(x * sqrt(exp(Float64(t_2 * 2.0)))) / y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - 1.0) * log(a); t_2 = t_1 - b; tmp = 0.0; if (t_1 <= -2e+27) tmp = (exp(t_2) / y) * x; elseif (t_1 <= 4e+65) tmp = x / (y * exp(((b + log(a)) - (y * log(z))))); else tmp = (x * sqrt(exp((t_2 * 2.0)))) / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - b), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+27], N[(N[(N[Exp[t$95$2], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t$95$1, 4e+65], N[(x / N[(y * N[Exp[N[(N[(b + N[Log[a], $MachinePrecision]), $MachinePrecision] - N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[Sqrt[N[Exp[N[(t$95$2 * 2.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - 1\right) \cdot \log a\\
t_2 := t\_1 - b\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+27}:\\
\;\;\;\;\frac{e^{t\_2}}{y} \cdot x\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+65}:\\
\;\;\;\;\frac{x}{y \cdot e^{\left(b + \log a\right) - y \cdot \log z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \sqrt{e^{t\_2 \cdot 2}}}{y}\\
\end{array}
\end{array}
if (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -2e27Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f64N/A
lower--.f6479.7
Applied rewrites79.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.0%
if -2e27 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 4e65Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
lift-exp.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
sum-to-multN/A
*-commutativeN/A
pow-expN/A
lift-*.f64N/A
lift-log.f64N/A
pow-to-expN/A
sqr-powN/A
unpow-prod-downN/A
Applied rewrites98.9%
Applied rewrites98.5%
Taylor expanded in t around 0
lower-/.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6479.7
Applied rewrites79.7%
if 4e65 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f64N/A
lower--.f6479.7
Applied rewrites79.7%
lift-exp.f64N/A
exp-fabsN/A
lift-exp.f64N/A
rem-sqrt-square-revN/A
lower-sqrt.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
Applied rewrites78.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (* x (sqrt (exp (* 2.0 (* y (log z)))))) y)))
(if (<= y -1.1e+111)
t_1
(if (<= y 2.8e+123) (* (/ (exp (- (* (- t 1.0) (log a)) b)) y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * sqrt(exp((2.0 * (y * log(z)))))) / y;
double tmp;
if (y <= -1.1e+111) {
tmp = t_1;
} else if (y <= 2.8e+123) {
tmp = (exp((((t - 1.0) * log(a)) - b)) / y) * x;
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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 = (x * sqrt(exp((2.0d0 * (y * log(z)))))) / y
if (y <= (-1.1d+111)) then
tmp = t_1
else if (y <= 2.8d+123) then
tmp = (exp((((t - 1.0d0) * log(a)) - b)) / y) * x
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 = (x * Math.sqrt(Math.exp((2.0 * (y * Math.log(z)))))) / y;
double tmp;
if (y <= -1.1e+111) {
tmp = t_1;
} else if (y <= 2.8e+123) {
tmp = (Math.exp((((t - 1.0) * Math.log(a)) - b)) / y) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x * math.sqrt(math.exp((2.0 * (y * math.log(z)))))) / y tmp = 0 if y <= -1.1e+111: tmp = t_1 elif y <= 2.8e+123: tmp = (math.exp((((t - 1.0) * math.log(a)) - b)) / y) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * sqrt(exp(Float64(2.0 * Float64(y * log(z)))))) / y) tmp = 0.0 if (y <= -1.1e+111) tmp = t_1; elseif (y <= 2.8e+123) tmp = Float64(Float64(exp(Float64(Float64(Float64(t - 1.0) * log(a)) - b)) / y) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x * sqrt(exp((2.0 * (y * log(z)))))) / y; tmp = 0.0; if (y <= -1.1e+111) tmp = t_1; elseif (y <= 2.8e+123) tmp = (exp((((t - 1.0) * log(a)) - b)) / y) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * N[Sqrt[N[Exp[N[(2.0 * N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -1.1e+111], t$95$1, If[LessEqual[y, 2.8e+123], N[(N[(N[Exp[N[(N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \sqrt{e^{2 \cdot \left(y \cdot \log z\right)}}}{y}\\
\mathbf{if}\;y \leq -1.1 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+123}:\\
\;\;\;\;\frac{e^{\left(t - 1\right) \cdot \log a - b}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.09999999999999999e111 or 2.80000000000000011e123 < y Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f64N/A
lower--.f6479.7
Applied rewrites79.7%
lift-exp.f64N/A
exp-fabsN/A
lift-exp.f64N/A
rem-sqrt-square-revN/A
lower-sqrt.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
Applied rewrites78.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6448.1
Applied rewrites48.1%
if -1.09999999999999999e111 < y < 2.80000000000000011e123Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f64N/A
lower--.f6479.7
Applied rewrites79.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (* x (sqrt (exp (* 2.0 (* y (log z)))))) y)))
(if (<= y -3.7e+79)
t_1
(if (<= y 2.8e+123) (* (exp (- (* (- t 1.0) (log a)) b)) (/ x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * sqrt(exp((2.0 * (y * log(z)))))) / y;
double tmp;
if (y <= -3.7e+79) {
tmp = t_1;
} else if (y <= 2.8e+123) {
tmp = exp((((t - 1.0) * log(a)) - b)) * (x / y);
} 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 = (x * sqrt(exp((2.0d0 * (y * log(z)))))) / y
if (y <= (-3.7d+79)) then
tmp = t_1
else if (y <= 2.8d+123) then
tmp = exp((((t - 1.0d0) * log(a)) - b)) * (x / y)
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 = (x * Math.sqrt(Math.exp((2.0 * (y * Math.log(z)))))) / y;
double tmp;
if (y <= -3.7e+79) {
tmp = t_1;
} else if (y <= 2.8e+123) {
tmp = Math.exp((((t - 1.0) * Math.log(a)) - b)) * (x / y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x * math.sqrt(math.exp((2.0 * (y * math.log(z)))))) / y tmp = 0 if y <= -3.7e+79: tmp = t_1 elif y <= 2.8e+123: tmp = math.exp((((t - 1.0) * math.log(a)) - b)) * (x / y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * sqrt(exp(Float64(2.0 * Float64(y * log(z)))))) / y) tmp = 0.0 if (y <= -3.7e+79) tmp = t_1; elseif (y <= 2.8e+123) tmp = Float64(exp(Float64(Float64(Float64(t - 1.0) * log(a)) - b)) * Float64(x / y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x * sqrt(exp((2.0 * (y * log(z)))))) / y; tmp = 0.0; if (y <= -3.7e+79) tmp = t_1; elseif (y <= 2.8e+123) tmp = exp((((t - 1.0) * log(a)) - b)) * (x / y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * N[Sqrt[N[Exp[N[(2.0 * N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[y, -3.7e+79], t$95$1, If[LessEqual[y, 2.8e+123], N[(N[Exp[N[(N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot \sqrt{e^{2 \cdot \left(y \cdot \log z\right)}}}{y}\\
\mathbf{if}\;y \leq -3.7 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+123}:\\
\;\;\;\;e^{\left(t - 1\right) \cdot \log a - b} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.70000000000000009e79 or 2.80000000000000011e123 < y Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f64N/A
lower--.f6479.7
Applied rewrites79.7%
lift-exp.f64N/A
exp-fabsN/A
lift-exp.f64N/A
rem-sqrt-square-revN/A
lower-sqrt.f64N/A
lift-exp.f64N/A
lift-exp.f64N/A
Applied rewrites78.6%
Taylor expanded in y around inf
lower-*.f64N/A
lower-*.f64N/A
lower-log.f6448.1
Applied rewrites48.1%
if -3.70000000000000009e79 < y < 2.80000000000000011e123Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f64N/A
lower--.f6479.7
Applied rewrites79.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lower-*.f6472.7
Applied rewrites72.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (/ (exp (* t (log a))) y) x)))
(if (<= t -76.0)
t_1
(if (<= t 3.7e+54) (/ (* x (exp (- (* (log a) -1.0) b))) y) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (exp((t * log(a))) / y) * x;
double tmp;
if (t <= -76.0) {
tmp = t_1;
} else if (t <= 3.7e+54) {
tmp = (x * exp(((log(a) * -1.0) - b))) / y;
} 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((t * log(a))) / y) * x
if (t <= (-76.0d0)) then
tmp = t_1
else if (t <= 3.7d+54) then
tmp = (x * exp(((log(a) * (-1.0d0)) - b))) / y
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((t * Math.log(a))) / y) * x;
double tmp;
if (t <= -76.0) {
tmp = t_1;
} else if (t <= 3.7e+54) {
tmp = (x * Math.exp(((Math.log(a) * -1.0) - b))) / y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (math.exp((t * math.log(a))) / y) * x tmp = 0 if t <= -76.0: tmp = t_1 elif t <= 3.7e+54: tmp = (x * math.exp(((math.log(a) * -1.0) - b))) / y else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(exp(Float64(t * log(a))) / y) * x) tmp = 0.0 if (t <= -76.0) tmp = t_1; elseif (t <= 3.7e+54) tmp = Float64(Float64(x * exp(Float64(Float64(log(a) * -1.0) - b))) / y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (exp((t * log(a))) / y) * x; tmp = 0.0; if (t <= -76.0) tmp = t_1; elseif (t <= 3.7e+54) tmp = (x * exp(((log(a) * -1.0) - b))) / y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[Exp[N[(t * N[Log[a], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -76.0], t$95$1, If[LessEqual[t, 3.7e+54], N[(N[(x * N[Exp[N[(N[(N[Log[a], $MachinePrecision] * -1.0), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{e^{t \cdot \log a}}{y} \cdot x\\
\mathbf{if}\;t \leq -76:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{+54}:\\
\;\;\;\;\frac{x \cdot e^{\log a \cdot -1 - b}}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -76 or 3.7000000000000002e54 < t Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
Taylor expanded in t around inf
lower-*.f64N/A
lower-log.f6448.4
Applied rewrites48.4%
if -76 < t < 3.7000000000000002e54Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f64N/A
lower--.f6479.7
Applied rewrites79.7%
Taylor expanded in t around 0
Applied rewrites57.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- t 1.0) (log a))) (t_2 (* (/ (exp (* t (log a))) y) x)))
(if (<= t_1 -2e+27)
t_2
(if (<= t_1 5e+51) (* (/ (exp (- (* -1.0 (log a)) b)) y) x) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - 1.0) * log(a);
double t_2 = (exp((t * log(a))) / y) * x;
double tmp;
if (t_1 <= -2e+27) {
tmp = t_2;
} else if (t_1 <= 5e+51) {
tmp = (exp(((-1.0 * log(a)) - b)) / y) * x;
} 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 = (t - 1.0d0) * log(a)
t_2 = (exp((t * log(a))) / y) * x
if (t_1 <= (-2d+27)) then
tmp = t_2
else if (t_1 <= 5d+51) then
tmp = (exp((((-1.0d0) * log(a)) - b)) / y) * x
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 = (t - 1.0) * Math.log(a);
double t_2 = (Math.exp((t * Math.log(a))) / y) * x;
double tmp;
if (t_1 <= -2e+27) {
tmp = t_2;
} else if (t_1 <= 5e+51) {
tmp = (Math.exp(((-1.0 * Math.log(a)) - b)) / y) * x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - 1.0) * math.log(a) t_2 = (math.exp((t * math.log(a))) / y) * x tmp = 0 if t_1 <= -2e+27: tmp = t_2 elif t_1 <= 5e+51: tmp = (math.exp(((-1.0 * math.log(a)) - b)) / y) * x else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - 1.0) * log(a)) t_2 = Float64(Float64(exp(Float64(t * log(a))) / y) * x) tmp = 0.0 if (t_1 <= -2e+27) tmp = t_2; elseif (t_1 <= 5e+51) tmp = Float64(Float64(exp(Float64(Float64(-1.0 * log(a)) - b)) / y) * x); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - 1.0) * log(a); t_2 = (exp((t * log(a))) / y) * x; tmp = 0.0; if (t_1 <= -2e+27) tmp = t_2; elseif (t_1 <= 5e+51) tmp = (exp(((-1.0 * log(a)) - b)) / y) * x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Exp[N[(t * N[Log[a], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+27], t$95$2, If[LessEqual[t$95$1, 5e+51], N[(N[(N[Exp[N[(N[(-1.0 * N[Log[a], $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - 1\right) \cdot \log a\\
t_2 := \frac{e^{t \cdot \log a}}{y} \cdot x\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+27}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+51}:\\
\;\;\;\;\frac{e^{-1 \cdot \log a - b}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -2e27 or 5e51 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
Taylor expanded in t around inf
lower-*.f64N/A
lower-log.f6448.4
Applied rewrites48.4%
if -2e27 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 5e51Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f64N/A
lower--.f6479.7
Applied rewrites79.7%
Taylor expanded in t around 0
Applied rewrites57.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites58.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- t 1.0) (log a))) (t_2 (* (/ (exp (* t (log a))) y) x)))
(if (<= t_1 -2e+27)
t_2
(if (<= t_1 5e+51) (* (exp (- (* -1.0 (log a)) b)) (/ x y)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - 1.0) * log(a);
double t_2 = (exp((t * log(a))) / y) * x;
double tmp;
if (t_1 <= -2e+27) {
tmp = t_2;
} else if (t_1 <= 5e+51) {
tmp = exp(((-1.0 * log(a)) - b)) * (x / 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 = (t - 1.0d0) * log(a)
t_2 = (exp((t * log(a))) / y) * x
if (t_1 <= (-2d+27)) then
tmp = t_2
else if (t_1 <= 5d+51) then
tmp = exp((((-1.0d0) * log(a)) - b)) * (x / 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 = (t - 1.0) * Math.log(a);
double t_2 = (Math.exp((t * Math.log(a))) / y) * x;
double tmp;
if (t_1 <= -2e+27) {
tmp = t_2;
} else if (t_1 <= 5e+51) {
tmp = Math.exp(((-1.0 * Math.log(a)) - b)) * (x / y);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - 1.0) * math.log(a) t_2 = (math.exp((t * math.log(a))) / y) * x tmp = 0 if t_1 <= -2e+27: tmp = t_2 elif t_1 <= 5e+51: tmp = math.exp(((-1.0 * math.log(a)) - b)) * (x / y) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - 1.0) * log(a)) t_2 = Float64(Float64(exp(Float64(t * log(a))) / y) * x) tmp = 0.0 if (t_1 <= -2e+27) tmp = t_2; elseif (t_1 <= 5e+51) tmp = Float64(exp(Float64(Float64(-1.0 * log(a)) - b)) * Float64(x / y)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - 1.0) * log(a); t_2 = (exp((t * log(a))) / y) * x; tmp = 0.0; if (t_1 <= -2e+27) tmp = t_2; elseif (t_1 <= 5e+51) tmp = exp(((-1.0 * log(a)) - b)) * (x / y); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Exp[N[(t * N[Log[a], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+27], t$95$2, If[LessEqual[t$95$1, 5e+51], N[(N[Exp[N[(N[(-1.0 * N[Log[a], $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision]], $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - 1\right) \cdot \log a\\
t_2 := \frac{e^{t \cdot \log a}}{y} \cdot x\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+27}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+51}:\\
\;\;\;\;e^{-1 \cdot \log a - b} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -2e27 or 5e51 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
Taylor expanded in t around inf
lower-*.f64N/A
lower-log.f6448.4
Applied rewrites48.4%
if -2e27 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 5e51Initial program 98.2%
Taylor expanded in y around 0
lower-*.f64N/A
lower-log.f64N/A
lower--.f6479.7
Applied rewrites79.7%
Taylor expanded in t around 0
Applied rewrites57.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
lower-*.f6453.6
Applied rewrites53.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (- t 1.0) (log a))) (t_2 (* (/ (exp (* t (log a))) y) x))) (if (<= t_1 -2e+27) t_2 (if (<= t_1 5e+51) (* (/ (exp (- b)) y) x) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - 1.0) * log(a);
double t_2 = (exp((t * log(a))) / y) * x;
double tmp;
if (t_1 <= -2e+27) {
tmp = t_2;
} else if (t_1 <= 5e+51) {
tmp = (exp(-b) / y) * x;
} 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 = (t - 1.0d0) * log(a)
t_2 = (exp((t * log(a))) / y) * x
if (t_1 <= (-2d+27)) then
tmp = t_2
else if (t_1 <= 5d+51) then
tmp = (exp(-b) / y) * x
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 = (t - 1.0) * Math.log(a);
double t_2 = (Math.exp((t * Math.log(a))) / y) * x;
double tmp;
if (t_1 <= -2e+27) {
tmp = t_2;
} else if (t_1 <= 5e+51) {
tmp = (Math.exp(-b) / y) * x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - 1.0) * math.log(a) t_2 = (math.exp((t * math.log(a))) / y) * x tmp = 0 if t_1 <= -2e+27: tmp = t_2 elif t_1 <= 5e+51: tmp = (math.exp(-b) / y) * x else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - 1.0) * log(a)) t_2 = Float64(Float64(exp(Float64(t * log(a))) / y) * x) tmp = 0.0 if (t_1 <= -2e+27) tmp = t_2; elseif (t_1 <= 5e+51) tmp = Float64(Float64(exp(Float64(-b)) / y) * x); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - 1.0) * log(a); t_2 = (exp((t * log(a))) / y) * x; tmp = 0.0; if (t_1 <= -2e+27) tmp = t_2; elseif (t_1 <= 5e+51) tmp = (exp(-b) / y) * x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - 1.0), $MachinePrecision] * N[Log[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Exp[N[(t * N[Log[a], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+27], t$95$2, If[LessEqual[t$95$1, 5e+51], N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t - 1\right) \cdot \log a\\
t_2 := \frac{e^{t \cdot \log a}}{y} \cdot x\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+27}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+51}:\\
\;\;\;\;\frac{e^{-b}}{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < -2e27 or 5e51 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
Taylor expanded in t around inf
lower-*.f64N/A
lower-log.f6448.4
Applied rewrites48.4%
if -2e27 < (*.f64 (-.f64 t #s(literal 1 binary64)) (log.f64 a)) < 5e51Initial program 98.2%
Taylor expanded in b around inf
lower-*.f6447.1
Applied rewrites47.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6447.1
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6447.1
Applied rewrites47.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (/ (exp (- b)) y) x)))
(if (<= b -11500000000000.0)
t_1
(if (<= b 290000000.0) (* (exp (* t (log a))) (/ x y)) 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 <= -11500000000000.0) {
tmp = t_1;
} else if (b <= 290000000.0) {
tmp = exp((t * log(a))) * (x / y);
} 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 <= (-11500000000000.0d0)) then
tmp = t_1
else if (b <= 290000000.0d0) then
tmp = exp((t * log(a))) * (x / y)
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 <= -11500000000000.0) {
tmp = t_1;
} else if (b <= 290000000.0) {
tmp = Math.exp((t * Math.log(a))) * (x / y);
} 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 <= -11500000000000.0: tmp = t_1 elif b <= 290000000.0: tmp = math.exp((t * math.log(a))) * (x / y) 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 <= -11500000000000.0) tmp = t_1; elseif (b <= 290000000.0) tmp = Float64(exp(Float64(t * log(a))) * Float64(x / y)); 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 <= -11500000000000.0) tmp = t_1; elseif (b <= 290000000.0) tmp = exp((t * log(a))) * (x / y); 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, -11500000000000.0], t$95$1, If[LessEqual[b, 290000000.0], N[(N[Exp[N[(t * N[Log[a], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{e^{-b}}{y} \cdot x\\
\mathbf{if}\;b \leq -11500000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 290000000:\\
\;\;\;\;e^{t \cdot \log a} \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.15e13 or 2.9e8 < b Initial program 98.2%
Taylor expanded in b around inf
lower-*.f6447.1
Applied rewrites47.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6447.1
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6447.1
Applied rewrites47.1%
if -1.15e13 < b < 2.9e8Initial program 98.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites88.1%
Taylor expanded in t around inf
lower-*.f64N/A
lower-log.f6444.1
Applied rewrites44.1%
(FPCore (x y z t a b) :precision binary64 (* (/ (exp (- b)) y) x))
double code(double x, double y, double z, double t, double a, double b) {
return (exp(-b) / y) * x;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t, 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 = (exp(-b) / y) * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (Math.exp(-b) / y) * x;
}
def code(x, y, z, t, a, b): return (math.exp(-b) / y) * x
function code(x, y, z, t, a, b) return Float64(Float64(exp(Float64(-b)) / y) * x) end
function tmp = code(x, y, z, t, a, b) tmp = (exp(-b) / y) * x; end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[Exp[(-b)], $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
\frac{e^{-b}}{y} \cdot x
\end{array}
Initial program 98.2%
Taylor expanded in b around inf
lower-*.f6447.1
Applied rewrites47.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6447.1
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6447.1
Applied rewrites47.1%
(FPCore (x y z t a b) :precision binary64 (* (exp (- b)) (/ x y)))
double code(double x, double y, double z, double t, double a, double b) {
return exp(-b) * (x / 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 = exp(-b) * (x / y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.exp(-b) * (x / y);
}
def code(x, y, z, t, a, b): return math.exp(-b) * (x / y)
function code(x, y, z, t, a, b) return Float64(exp(Float64(-b)) * Float64(x / y)) end
function tmp = code(x, y, z, t, a, b) tmp = exp(-b) * (x / y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[Exp[(-b)], $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{-b} \cdot \frac{x}{y}
\end{array}
Initial program 98.2%
Taylor expanded in b around inf
lower-*.f6447.1
Applied rewrites47.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
lower-*.f6442.9
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6442.9
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
Applied rewrites42.9%
herbie shell --seed 2025142
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:incompleteBetaWorker from math-functions-0.1.5.2, A"
:precision binary64
(/ (* x (exp (- (+ (* y (log z)) (* (- t 1.0) (log a))) b))) y))