
(FPCore (wj x) :precision binary64 (let* ((t_0 (* wj (exp wj)))) (- wj (/ (- t_0 x) (+ (exp wj) t_0)))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
return wj - ((t_0 - x) / (exp(wj) + t_0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(wj, x)
use fmin_fmax_functions
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
t_0 = wj * exp(wj)
code = wj - ((t_0 - x) / (exp(wj) + t_0))
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
return wj - ((t_0 - x) / (Math.exp(wj) + t_0));
}
def code(wj, x): t_0 = wj * math.exp(wj) return wj - ((t_0 - x) / (math.exp(wj) + t_0))
function code(wj, x) t_0 = Float64(wj * exp(wj)) return Float64(wj - Float64(Float64(t_0 - x) / Float64(exp(wj) + t_0))) end
function tmp = code(wj, x) t_0 = wj * exp(wj); tmp = wj - ((t_0 - x) / (exp(wj) + t_0)); end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, N[(wj - N[(N[(t$95$0 - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
wj - \frac{t\_0 - x}{e^{wj} + t\_0}
\end{array}
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (wj x) :precision binary64 (let* ((t_0 (* wj (exp wj)))) (- wj (/ (- t_0 x) (+ (exp wj) t_0)))))
double code(double wj, double x) {
double t_0 = wj * exp(wj);
return wj - ((t_0 - x) / (exp(wj) + t_0));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(wj, x)
use fmin_fmax_functions
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
t_0 = wj * exp(wj)
code = wj - ((t_0 - x) / (exp(wj) + t_0))
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
return wj - ((t_0 - x) / (Math.exp(wj) + t_0));
}
def code(wj, x): t_0 = wj * math.exp(wj) return wj - ((t_0 - x) / (math.exp(wj) + t_0))
function code(wj, x) t_0 = Float64(wj * exp(wj)) return Float64(wj - Float64(Float64(t_0 - x) / Float64(exp(wj) + t_0))) end
function tmp = code(wj, x) t_0 = wj * exp(wj); tmp = wj - ((t_0 - x) / (exp(wj) + t_0)); end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, N[(wj - N[(N[(t$95$0 - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
wj - \frac{t\_0 - x}{e^{wj} + t\_0}
\end{array}
(FPCore (wj x) :precision binary64 (if (<= wj 500.0) (/ (+ (* (exp wj) (pow wj 2.0)) x) (* (- wj -1.0) (exp wj))) (- wj (/ wj (- wj -1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 500.0) {
tmp = ((exp(wj) * pow(wj, 2.0)) + x) / ((wj - -1.0) * exp(wj));
} else {
tmp = wj - (wj / (wj - -1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(wj, x)
use fmin_fmax_functions
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= 500.0d0) then
tmp = ((exp(wj) * (wj ** 2.0d0)) + x) / ((wj - (-1.0d0)) * exp(wj))
else
tmp = wj - (wj / (wj - (-1.0d0)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 500.0) {
tmp = ((Math.exp(wj) * Math.pow(wj, 2.0)) + x) / ((wj - -1.0) * Math.exp(wj));
} else {
tmp = wj - (wj / (wj - -1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 500.0: tmp = ((math.exp(wj) * math.pow(wj, 2.0)) + x) / ((wj - -1.0) * math.exp(wj)) else: tmp = wj - (wj / (wj - -1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 500.0) tmp = Float64(Float64(Float64(exp(wj) * (wj ^ 2.0)) + x) / Float64(Float64(wj - -1.0) * exp(wj))); else tmp = Float64(wj - Float64(wj / Float64(wj - -1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 500.0) tmp = ((exp(wj) * (wj ^ 2.0)) + x) / ((wj - -1.0) * exp(wj)); else tmp = wj - (wj / (wj - -1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 500.0], N[(N[(N[(N[Exp[wj], $MachinePrecision] * N[Power[wj, 2.0], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] / N[(N[(wj - -1.0), $MachinePrecision] * N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;wj \leq 500:\\
\;\;\;\;\frac{e^{wj} \cdot {wj}^{2} + x}{\left(wj - -1\right) \cdot e^{wj}}\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj - -1}\\
\end{array}
if wj < 500Initial program 77.8%
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites88.4%
Taylor expanded in wj around 0
lower-pow.f6498.8%
Applied rewrites98.8%
if 500 < wj Initial program 77.8%
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites88.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f646.5%
Applied rewrites6.5%
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-to-fraction-revN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
lower-/.f646.5%
Applied rewrites6.5%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (* wj (exp wj))) (t_1 (* (- wj -1.0) (exp wj))))
(if (<= (- wj (/ (- t_0 x) (+ (exp wj) t_0))) 5.75e-11)
(/ (+ (* (pow wj 2.0) (+ 1.0 (* wj (+ 1.0 (* 0.5 wj))))) x) t_1)
(- (/ x t_1) (- (/ wj (- wj -1.0)) wj)))))double code(double wj, double x) {
double t_0 = wj * exp(wj);
double t_1 = (wj - -1.0) * exp(wj);
double tmp;
if ((wj - ((t_0 - x) / (exp(wj) + t_0))) <= 5.75e-11) {
tmp = ((pow(wj, 2.0) * (1.0 + (wj * (1.0 + (0.5 * wj))))) + x) / t_1;
} else {
tmp = (x / t_1) - ((wj / (wj - -1.0)) - wj);
}
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(wj, x)
use fmin_fmax_functions
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = wj * exp(wj)
t_1 = (wj - (-1.0d0)) * exp(wj)
if ((wj - ((t_0 - x) / (exp(wj) + t_0))) <= 5.75d-11) then
tmp = (((wj ** 2.0d0) * (1.0d0 + (wj * (1.0d0 + (0.5d0 * wj))))) + x) / t_1
else
tmp = (x / t_1) - ((wj / (wj - (-1.0d0))) - wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
double t_1 = (wj - -1.0) * Math.exp(wj);
double tmp;
if ((wj - ((t_0 - x) / (Math.exp(wj) + t_0))) <= 5.75e-11) {
tmp = ((Math.pow(wj, 2.0) * (1.0 + (wj * (1.0 + (0.5 * wj))))) + x) / t_1;
} else {
tmp = (x / t_1) - ((wj / (wj - -1.0)) - wj);
}
return tmp;
}
def code(wj, x): t_0 = wj * math.exp(wj) t_1 = (wj - -1.0) * math.exp(wj) tmp = 0 if (wj - ((t_0 - x) / (math.exp(wj) + t_0))) <= 5.75e-11: tmp = ((math.pow(wj, 2.0) * (1.0 + (wj * (1.0 + (0.5 * wj))))) + x) / t_1 else: tmp = (x / t_1) - ((wj / (wj - -1.0)) - wj) return tmp
function code(wj, x) t_0 = Float64(wj * exp(wj)) t_1 = Float64(Float64(wj - -1.0) * exp(wj)) tmp = 0.0 if (Float64(wj - Float64(Float64(t_0 - x) / Float64(exp(wj) + t_0))) <= 5.75e-11) tmp = Float64(Float64(Float64((wj ^ 2.0) * Float64(1.0 + Float64(wj * Float64(1.0 + Float64(0.5 * wj))))) + x) / t_1); else tmp = Float64(Float64(x / t_1) - Float64(Float64(wj / Float64(wj - -1.0)) - wj)); end return tmp end
function tmp_2 = code(wj, x) t_0 = wj * exp(wj); t_1 = (wj - -1.0) * exp(wj); tmp = 0.0; if ((wj - ((t_0 - x) / (exp(wj) + t_0))) <= 5.75e-11) tmp = (((wj ^ 2.0) * (1.0 + (wj * (1.0 + (0.5 * wj))))) + x) / t_1; else tmp = (x / t_1) - ((wj / (wj - -1.0)) - wj); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(wj - -1.0), $MachinePrecision] * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(wj - N[(N[(t$95$0 - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5.75e-11], N[(N[(N[(N[Power[wj, 2.0], $MachinePrecision] * N[(1.0 + N[(wj * N[(1.0 + N[(0.5 * wj), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(x / t$95$1), $MachinePrecision] - N[(N[(wj / N[(wj - -1.0), $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
t_1 := \left(wj - -1\right) \cdot e^{wj}\\
\mathbf{if}\;wj - \frac{t\_0 - x}{e^{wj} + t\_0} \leq 5.75 \cdot 10^{-11}:\\
\;\;\;\;\frac{{wj}^{2} \cdot \left(1 + wj \cdot \left(1 + 0.5 \cdot wj\right)\right) + x}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t\_1} - \left(\frac{wj}{wj - -1} - wj\right)\\
\end{array}
if (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) < 5.7500000000000002e-11Initial program 77.8%
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites88.4%
Taylor expanded in wj around 0
lower-*.f64N/A
lower-pow.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6497.7%
Applied rewrites97.7%
if 5.7500000000000002e-11 < (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) Initial program 77.8%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negateN/A
associate-+l-N/A
lower--.f64N/A
Applied rewrites89.6%
(FPCore (wj x)
:precision binary64
(let* ((t_0 (* wj (exp wj))))
(if (<= (- wj (/ (- t_0 x) (+ (exp wj) t_0))) 0.02)
(/ (+ (* (* wj wj) 1.0) x) (* (- wj -1.0) 1.0))
(- (/ x (* (- wj -1.0) (exp wj))) (- (/ wj (- wj -1.0)) wj)))))double code(double wj, double x) {
double t_0 = wj * exp(wj);
double tmp;
if ((wj - ((t_0 - x) / (exp(wj) + t_0))) <= 0.02) {
tmp = (((wj * wj) * 1.0) + x) / ((wj - -1.0) * 1.0);
} else {
tmp = (x / ((wj - -1.0) * exp(wj))) - ((wj / (wj - -1.0)) - wj);
}
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(wj, x)
use fmin_fmax_functions
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = wj * exp(wj)
if ((wj - ((t_0 - x) / (exp(wj) + t_0))) <= 0.02d0) then
tmp = (((wj * wj) * 1.0d0) + x) / ((wj - (-1.0d0)) * 1.0d0)
else
tmp = (x / ((wj - (-1.0d0)) * exp(wj))) - ((wj / (wj - (-1.0d0))) - wj)
end if
code = tmp
end function
public static double code(double wj, double x) {
double t_0 = wj * Math.exp(wj);
double tmp;
if ((wj - ((t_0 - x) / (Math.exp(wj) + t_0))) <= 0.02) {
tmp = (((wj * wj) * 1.0) + x) / ((wj - -1.0) * 1.0);
} else {
tmp = (x / ((wj - -1.0) * Math.exp(wj))) - ((wj / (wj - -1.0)) - wj);
}
return tmp;
}
def code(wj, x): t_0 = wj * math.exp(wj) tmp = 0 if (wj - ((t_0 - x) / (math.exp(wj) + t_0))) <= 0.02: tmp = (((wj * wj) * 1.0) + x) / ((wj - -1.0) * 1.0) else: tmp = (x / ((wj - -1.0) * math.exp(wj))) - ((wj / (wj - -1.0)) - wj) return tmp
function code(wj, x) t_0 = Float64(wj * exp(wj)) tmp = 0.0 if (Float64(wj - Float64(Float64(t_0 - x) / Float64(exp(wj) + t_0))) <= 0.02) tmp = Float64(Float64(Float64(Float64(wj * wj) * 1.0) + x) / Float64(Float64(wj - -1.0) * 1.0)); else tmp = Float64(Float64(x / Float64(Float64(wj - -1.0) * exp(wj))) - Float64(Float64(wj / Float64(wj - -1.0)) - wj)); end return tmp end
function tmp_2 = code(wj, x) t_0 = wj * exp(wj); tmp = 0.0; if ((wj - ((t_0 - x) / (exp(wj) + t_0))) <= 0.02) tmp = (((wj * wj) * 1.0) + x) / ((wj - -1.0) * 1.0); else tmp = (x / ((wj - -1.0) * exp(wj))) - ((wj / (wj - -1.0)) - wj); end tmp_2 = tmp; end
code[wj_, x_] := Block[{t$95$0 = N[(wj * N[Exp[wj], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(wj - N[(N[(t$95$0 - x), $MachinePrecision] / N[(N[Exp[wj], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.02], N[(N[(N[(N[(wj * wj), $MachinePrecision] * 1.0), $MachinePrecision] + x), $MachinePrecision] / N[(N[(wj - -1.0), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(N[(wj - -1.0), $MachinePrecision] * N[Exp[wj], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(wj / N[(wj - -1.0), $MachinePrecision]), $MachinePrecision] - wj), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := wj \cdot e^{wj}\\
\mathbf{if}\;wj - \frac{t\_0 - x}{e^{wj} + t\_0} \leq 0.02:\\
\;\;\;\;\frac{\left(wj \cdot wj\right) \cdot 1 + x}{\left(wj - -1\right) \cdot 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(wj - -1\right) \cdot e^{wj}} - \left(\frac{wj}{wj - -1} - wj\right)\\
\end{array}
if (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) < 0.02Initial program 77.8%
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites88.4%
Taylor expanded in wj around 0
lower-pow.f6498.8%
Applied rewrites98.8%
Taylor expanded in wj around 0
Applied rewrites97.1%
Taylor expanded in wj around 0
Applied rewrites97.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.1%
lift-pow.f64N/A
unpow2N/A
lower-*.f6497.1%
Applied rewrites97.1%
if 0.02 < (-.f64 wj (/.f64 (-.f64 (*.f64 wj (exp.f64 wj)) x) (+.f64 (exp.f64 wj) (*.f64 wj (exp.f64 wj))))) Initial program 77.8%
lift--.f64N/A
sub-flipN/A
+-commutativeN/A
lift-/.f64N/A
lift--.f64N/A
div-subN/A
sub-negateN/A
associate-+l-N/A
lower--.f64N/A
Applied rewrites89.6%
(FPCore (wj x) :precision binary64 (if (<= wj 7.5e-6) (+ x (* wj (+ wj (* x (- (* 2.5 wj) 2.0))))) (- wj (/ wj (- wj -1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 7.5e-6) {
tmp = x + (wj * (wj + (x * ((2.5 * wj) - 2.0))));
} else {
tmp = wj - (wj / (wj - -1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(wj, x)
use fmin_fmax_functions
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= 7.5d-6) then
tmp = x + (wj * (wj + (x * ((2.5d0 * wj) - 2.0d0))))
else
tmp = wj - (wj / (wj - (-1.0d0)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 7.5e-6) {
tmp = x + (wj * (wj + (x * ((2.5 * wj) - 2.0))));
} else {
tmp = wj - (wj / (wj - -1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 7.5e-6: tmp = x + (wj * (wj + (x * ((2.5 * wj) - 2.0)))) else: tmp = wj - (wj / (wj - -1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 7.5e-6) tmp = Float64(x + Float64(wj * Float64(wj + Float64(x * Float64(Float64(2.5 * wj) - 2.0))))); else tmp = Float64(wj - Float64(wj / Float64(wj - -1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 7.5e-6) tmp = x + (wj * (wj + (x * ((2.5 * wj) - 2.0)))); else tmp = wj - (wj / (wj - -1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 7.5e-6], N[(x + N[(wj * N[(wj + N[(x * N[(N[(2.5 * wj), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(wj - N[(wj / N[(wj - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;wj \leq 7.5 \cdot 10^{-6}:\\
\;\;\;\;x + wj \cdot \left(wj + x \cdot \left(2.5 \cdot wj - 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj - -1}\\
\end{array}
if wj < 7.5000000000000002e-6Initial program 77.8%
Taylor expanded in wj around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6495.7%
Applied rewrites95.7%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6495.8%
Applied rewrites95.8%
if 7.5000000000000002e-6 < wj Initial program 77.8%
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites88.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f646.5%
Applied rewrites6.5%
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-to-fraction-revN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
lower-/.f646.5%
Applied rewrites6.5%
(FPCore (wj x) :precision binary64 (if (<= wj 7.5e-6) (+ (* (* (- 1.0 wj) wj) wj) x) (- wj (/ wj (- wj -1.0)))))
double code(double wj, double x) {
double tmp;
if (wj <= 7.5e-6) {
tmp = (((1.0 - wj) * wj) * wj) + x;
} else {
tmp = wj - (wj / (wj - -1.0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(wj, x)
use fmin_fmax_functions
real(8), intent (in) :: wj
real(8), intent (in) :: x
real(8) :: tmp
if (wj <= 7.5d-6) then
tmp = (((1.0d0 - wj) * wj) * wj) + x
else
tmp = wj - (wj / (wj - (-1.0d0)))
end if
code = tmp
end function
public static double code(double wj, double x) {
double tmp;
if (wj <= 7.5e-6) {
tmp = (((1.0 - wj) * wj) * wj) + x;
} else {
tmp = wj - (wj / (wj - -1.0));
}
return tmp;
}
def code(wj, x): tmp = 0 if wj <= 7.5e-6: tmp = (((1.0 - wj) * wj) * wj) + x else: tmp = wj - (wj / (wj - -1.0)) return tmp
function code(wj, x) tmp = 0.0 if (wj <= 7.5e-6) tmp = Float64(Float64(Float64(Float64(1.0 - wj) * wj) * wj) + x); else tmp = Float64(wj - Float64(wj / Float64(wj - -1.0))); end return tmp end
function tmp_2 = code(wj, x) tmp = 0.0; if (wj <= 7.5e-6) tmp = (((1.0 - wj) * wj) * wj) + x; else tmp = wj - (wj / (wj - -1.0)); end tmp_2 = tmp; end
code[wj_, x_] := If[LessEqual[wj, 7.5e-6], N[(N[(N[(N[(1.0 - wj), $MachinePrecision] * wj), $MachinePrecision] * wj), $MachinePrecision] + x), $MachinePrecision], N[(wj - N[(wj / N[(wj - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;wj \leq 7.5 \cdot 10^{-6}:\\
\;\;\;\;\left(\left(1 - wj\right) \cdot wj\right) \cdot wj + x\\
\mathbf{else}:\\
\;\;\;\;wj - \frac{wj}{wj - -1}\\
\end{array}
if wj < 7.5000000000000002e-6Initial program 77.8%
Taylor expanded in wj around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites96.1%
Taylor expanded in wj around 0
lower-*.f6484.7%
Applied rewrites84.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6495.5%
Applied rewrites95.5%
Applied rewrites95.5%
if 7.5000000000000002e-6 < wj Initial program 77.8%
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites88.4%
Taylor expanded in x around 0
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-+.f646.5%
Applied rewrites6.5%
lift-/.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-to-fraction-revN/A
lower--.f64N/A
lift-+.f64N/A
+-commutativeN/A
metadata-evalN/A
sub-flipN/A
lift--.f64N/A
lower-/.f646.5%
Applied rewrites6.5%
(FPCore (wj x) :precision binary64 (/ (+ (* (* wj wj) 1.0) x) (* (- wj -1.0) 1.0)))
double code(double wj, double x) {
return (((wj * wj) * 1.0) + x) / ((wj - -1.0) * 1.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(wj, x)
use fmin_fmax_functions
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = (((wj * wj) * 1.0d0) + x) / ((wj - (-1.0d0)) * 1.0d0)
end function
public static double code(double wj, double x) {
return (((wj * wj) * 1.0) + x) / ((wj - -1.0) * 1.0);
}
def code(wj, x): return (((wj * wj) * 1.0) + x) / ((wj - -1.0) * 1.0)
function code(wj, x) return Float64(Float64(Float64(Float64(wj * wj) * 1.0) + x) / Float64(Float64(wj - -1.0) * 1.0)) end
function tmp = code(wj, x) tmp = (((wj * wj) * 1.0) + x) / ((wj - -1.0) * 1.0); end
code[wj_, x_] := N[(N[(N[(N[(wj * wj), $MachinePrecision] * 1.0), $MachinePrecision] + x), $MachinePrecision] / N[(N[(wj - -1.0), $MachinePrecision] * 1.0), $MachinePrecision]), $MachinePrecision]
\frac{\left(wj \cdot wj\right) \cdot 1 + x}{\left(wj - -1\right) \cdot 1}
Initial program 77.8%
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
lower-/.f64N/A
Applied rewrites88.4%
Taylor expanded in wj around 0
lower-pow.f6498.8%
Applied rewrites98.8%
Taylor expanded in wj around 0
Applied rewrites97.1%
Taylor expanded in wj around 0
Applied rewrites97.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6497.1%
lift-pow.f64N/A
unpow2N/A
lower-*.f6497.1%
Applied rewrites97.1%
(FPCore (wj x) :precision binary64 (+ (* (* (- 1.0 wj) wj) wj) x))
double code(double wj, double x) {
return (((1.0 - wj) * wj) * wj) + 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(wj, x)
use fmin_fmax_functions
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = (((1.0d0 - wj) * wj) * wj) + x
end function
public static double code(double wj, double x) {
return (((1.0 - wj) * wj) * wj) + x;
}
def code(wj, x): return (((1.0 - wj) * wj) * wj) + x
function code(wj, x) return Float64(Float64(Float64(Float64(1.0 - wj) * wj) * wj) + x) end
function tmp = code(wj, x) tmp = (((1.0 - wj) * wj) * wj) + x; end
code[wj_, x_] := N[(N[(N[(N[(1.0 - wj), $MachinePrecision] * wj), $MachinePrecision] * wj), $MachinePrecision] + x), $MachinePrecision]
\left(\left(1 - wj\right) \cdot wj\right) \cdot wj + x
Initial program 77.8%
Taylor expanded in wj around 0
lower-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
Applied rewrites96.1%
Taylor expanded in wj around 0
lower-*.f6484.7%
Applied rewrites84.7%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f6495.5%
Applied rewrites95.5%
Applied rewrites95.5%
(FPCore (wj x) :precision binary64 (+ x (* -2.0 (* wj x))))
double code(double wj, double x) {
return x + (-2.0 * (wj * 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(wj, x)
use fmin_fmax_functions
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x + ((-2.0d0) * (wj * x))
end function
public static double code(double wj, double x) {
return x + (-2.0 * (wj * x));
}
def code(wj, x): return x + (-2.0 * (wj * x))
function code(wj, x) return Float64(x + Float64(-2.0 * Float64(wj * x))) end
function tmp = code(wj, x) tmp = x + (-2.0 * (wj * x)); end
code[wj_, x_] := N[(x + N[(-2.0 * N[(wj * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x + -2 \cdot \left(wj \cdot x\right)
Initial program 77.8%
Taylor expanded in wj around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6484.8%
Applied rewrites84.8%
(FPCore (wj x) :precision binary64 x)
double code(double wj, double x) {
return 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(wj, x)
use fmin_fmax_functions
real(8), intent (in) :: wj
real(8), intent (in) :: x
code = x
end function
public static double code(double wj, double x) {
return x;
}
def code(wj, x): return x
function code(wj, x) return x end
function tmp = code(wj, x) tmp = x; end
code[wj_, x_] := x
x
Initial program 77.8%
Taylor expanded in wj around 0
Applied rewrites84.3%
herbie shell --seed 2025258
(FPCore (wj x)
:name "Jmat.Real.lambertw, newton loop step"
:precision binary64
(- wj (/ (- (* wj (exp wj)) x) (+ (exp wj) (* wj (exp wj))))))