
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
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(i, n)
use fmin_fmax_functions
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (i n) :precision binary64 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
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(i, n)
use fmin_fmax_functions
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n): return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n) return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) end
function tmp = code(i, n) tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n)); end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}
(FPCore (i n)
:precision binary64
(let* ((t_0 (log (/ -1.0 i))))
(if (<= n -1.2e-105)
(* n (fma -50.0 (/ (* i (exp i)) n) (* 100.0 (/ (expm1 i) i))))
(if (<= n -2e-310)
(*
(*
(*
(+
(log (/ -1.0 n))
(fma
-1.0
t_0
(fma 0.5 (* n (pow (+ (log (* -1.0 n)) t_0) 2.0)) (/ n i))))
n)
100.0)
(/ n i))
(if (<= n 3.6e-84)
(*
100.0
(/ (* n (+ (log i) (fma -1.0 (log n) (* n (/ 1.0 i))))) (/ i n)))
(* 100.0 (/ (* n (expm1 i)) i)))))))
double code(double i, double n) {
double t_0 = log((-1.0 / i));
double tmp;
if (n <= -1.2e-105) {
tmp = n * fma(-50.0, ((i * exp(i)) / n), (100.0 * (expm1(i) / i)));
} else if (n <= -2e-310) {
tmp = (((log((-1.0 / n)) + fma(-1.0, t_0, fma(0.5, (n * pow((log((-1.0 * n)) + t_0), 2.0)), (n / i)))) * n) * 100.0) * (n / i);
} else if (n <= 3.6e-84) {
tmp = 100.0 * ((n * (log(i) + fma(-1.0, log(n), (n * (1.0 / i))))) / (i / n));
} else {
tmp = 100.0 * ((n * expm1(i)) / i);
}
return tmp;
}
function code(i, n) t_0 = log(Float64(-1.0 / i)) tmp = 0.0 if (n <= -1.2e-105) tmp = Float64(n * fma(-50.0, Float64(Float64(i * exp(i)) / n), Float64(100.0 * Float64(expm1(i) / i)))); elseif (n <= -2e-310) tmp = Float64(Float64(Float64(Float64(log(Float64(-1.0 / n)) + fma(-1.0, t_0, fma(0.5, Float64(n * (Float64(log(Float64(-1.0 * n)) + t_0) ^ 2.0)), Float64(n / i)))) * n) * 100.0) * Float64(n / i)); elseif (n <= 3.6e-84) tmp = Float64(100.0 * Float64(Float64(n * Float64(log(i) + fma(-1.0, log(n), Float64(n * Float64(1.0 / i))))) / Float64(i / n))); else tmp = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)); end return tmp end
code[i_, n_] := Block[{t$95$0 = N[Log[N[(-1.0 / i), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -1.2e-105], N[(n * N[(-50.0 * N[(N[(i * N[Exp[i], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -2e-310], N[(N[(N[(N[(N[Log[N[(-1.0 / n), $MachinePrecision]], $MachinePrecision] + N[(-1.0 * t$95$0 + N[(0.5 * N[(n * N[Power[N[(N[Log[N[(-1.0 * n), $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.6e-84], N[(100.0 * N[(N[(n * N[(N[Log[i], $MachinePrecision] + N[(-1.0 * N[Log[n], $MachinePrecision] + N[(n * N[(1.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\frac{-1}{i}\right)\\
\mathbf{if}\;n \leq -1.2 \cdot 10^{-105}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(-50, \frac{i \cdot e^{i}}{n}, 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;n \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(\left(\log \left(\frac{-1}{n}\right) + \mathsf{fma}\left(-1, t\_0, \mathsf{fma}\left(0.5, n \cdot {\left(\log \left(-1 \cdot n\right) + t\_0\right)}^{2}, \frac{n}{i}\right)\right)\right) \cdot n\right) \cdot 100\right) \cdot \frac{n}{i}\\
\mathbf{elif}\;n \leq 3.6 \cdot 10^{-84}:\\
\;\;\;\;100 \cdot \frac{n \cdot \left(\log i + \mathsf{fma}\left(-1, \log n, n \cdot \frac{1}{i}\right)\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\end{array}
\end{array}
if n < -1.20000000000000007e-105Initial program 27.9%
Taylor expanded in n around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6467.6
Applied rewrites67.6%
if -1.20000000000000007e-105 < n < -1.999999999999994e-310Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites16.7%
Applied rewrites20.6%
Taylor expanded in i around -inf
lower-+.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-/.f64N/A
lower-fma.f64N/A
Applied rewrites12.6%
if -1.999999999999994e-310 < n < 3.60000000000000003e-84Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites16.7%
Taylor expanded in i around 0
lower-/.f6414.9
Applied rewrites14.9%
if 3.60000000000000003e-84 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
(FPCore (i n)
:precision binary64
(if (<= n -1.2e-105)
(* n (fma -50.0 (/ (* i (exp i)) n) (* 100.0 (/ (expm1 i) i))))
(if (<= n -2e-310)
(*
100.0
(/
(expm1 (* n (+ (log (- (/ 1.0 n))) (* -1.0 (log (/ -1.0 i))))))
(/ i n)))
(if (<= n 3.6e-84)
(*
100.0
(/ (* n (+ (log i) (fma -1.0 (log n) (* n (/ 1.0 i))))) (/ i n)))
(* 100.0 (/ (* n (expm1 i)) i))))))
double code(double i, double n) {
double tmp;
if (n <= -1.2e-105) {
tmp = n * fma(-50.0, ((i * exp(i)) / n), (100.0 * (expm1(i) / i)));
} else if (n <= -2e-310) {
tmp = 100.0 * (expm1((n * (log(-(1.0 / n)) + (-1.0 * log((-1.0 / i)))))) / (i / n));
} else if (n <= 3.6e-84) {
tmp = 100.0 * ((n * (log(i) + fma(-1.0, log(n), (n * (1.0 / i))))) / (i / n));
} else {
tmp = 100.0 * ((n * expm1(i)) / i);
}
return tmp;
}
function code(i, n) tmp = 0.0 if (n <= -1.2e-105) tmp = Float64(n * fma(-50.0, Float64(Float64(i * exp(i)) / n), Float64(100.0 * Float64(expm1(i) / i)))); elseif (n <= -2e-310) tmp = Float64(100.0 * Float64(expm1(Float64(n * Float64(log(Float64(-Float64(1.0 / n))) + Float64(-1.0 * log(Float64(-1.0 / i)))))) / Float64(i / n))); elseif (n <= 3.6e-84) tmp = Float64(100.0 * Float64(Float64(n * Float64(log(i) + fma(-1.0, log(n), Float64(n * Float64(1.0 / i))))) / Float64(i / n))); else tmp = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)); end return tmp end
code[i_, n_] := If[LessEqual[n, -1.2e-105], N[(n * N[(-50.0 * N[(N[(i * N[Exp[i], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -2e-310], N[(100.0 * N[(N[(Exp[N[(n * N[(N[Log[(-N[(1.0 / n), $MachinePrecision])], $MachinePrecision] + N[(-1.0 * N[Log[N[(-1.0 / i), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.6e-84], N[(100.0 * N[(N[(n * N[(N[Log[i], $MachinePrecision] + N[(-1.0 * N[Log[n], $MachinePrecision] + N[(n * N[(1.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.2 \cdot 10^{-105}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(-50, \frac{i \cdot e^{i}}{n}, 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;n \leq -2 \cdot 10^{-310}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \left(\log \left(-\frac{1}{n}\right) + -1 \cdot \log \left(\frac{-1}{i}\right)\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;n \leq 3.6 \cdot 10^{-84}:\\
\;\;\;\;100 \cdot \frac{n \cdot \left(\log i + \mathsf{fma}\left(-1, \log n, n \cdot \frac{1}{i}\right)\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\end{array}
\end{array}
if n < -1.20000000000000007e-105Initial program 27.9%
Taylor expanded in n around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6467.6
Applied rewrites67.6%
if -1.20000000000000007e-105 < n < -1.999999999999994e-310Initial program 27.9%
Taylor expanded in i around -inf
lower-expm1.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-log.f64N/A
lower-/.f6415.8
Applied rewrites15.8%
if -1.999999999999994e-310 < n < 3.60000000000000003e-84Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites16.7%
Taylor expanded in i around 0
lower-/.f6414.9
Applied rewrites14.9%
if 3.60000000000000003e-84 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
(FPCore (i n)
:precision binary64
(if (<= n -8.4e-106)
(* n (fma -50.0 (/ (* i (exp i)) n) (* 100.0 (/ (expm1 i) i))))
(if (<= n -4.9e-209)
(* (/ (* -100.0 (* (log (/ i n)) n)) i) (- n))
(if (<= n 1.05e-229)
(* (* (* (/ n i) n) 100.0) (/ n i))
(if (<= n 9e-10)
(* 100.0 (* i (/ n i)))
(* 100.0 (/ (* n (expm1 i)) i)))))))
double code(double i, double n) {
double tmp;
if (n <= -8.4e-106) {
tmp = n * fma(-50.0, ((i * exp(i)) / n), (100.0 * (expm1(i) / i)));
} else if (n <= -4.9e-209) {
tmp = ((-100.0 * (log((i / n)) * n)) / i) * -n;
} else if (n <= 1.05e-229) {
tmp = (((n / i) * n) * 100.0) * (n / i);
} else if (n <= 9e-10) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = 100.0 * ((n * expm1(i)) / i);
}
return tmp;
}
function code(i, n) tmp = 0.0 if (n <= -8.4e-106) tmp = Float64(n * fma(-50.0, Float64(Float64(i * exp(i)) / n), Float64(100.0 * Float64(expm1(i) / i)))); elseif (n <= -4.9e-209) tmp = Float64(Float64(Float64(-100.0 * Float64(log(Float64(i / n)) * n)) / i) * Float64(-n)); elseif (n <= 1.05e-229) tmp = Float64(Float64(Float64(Float64(n / i) * n) * 100.0) * Float64(n / i)); elseif (n <= 9e-10) tmp = Float64(100.0 * Float64(i * Float64(n / i))); else tmp = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)); end return tmp end
code[i_, n_] := If[LessEqual[n, -8.4e-106], N[(n * N[(-50.0 * N[(N[(i * N[Exp[i], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -4.9e-209], N[(N[(N[(-100.0 * N[(N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision] * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision] * (-n)), $MachinePrecision], If[LessEqual[n, 1.05e-229], N[(N[(N[(N[(n / i), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9e-10], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -8.4 \cdot 10^{-106}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(-50, \frac{i \cdot e^{i}}{n}, 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;n \leq -4.9 \cdot 10^{-209}:\\
\;\;\;\;\frac{-100 \cdot \left(\log \left(\frac{i}{n}\right) \cdot n\right)}{i} \cdot \left(-n\right)\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-229}:\\
\;\;\;\;\left(\left(\frac{n}{i} \cdot n\right) \cdot 100\right) \cdot \frac{n}{i}\\
\mathbf{elif}\;n \leq 9 \cdot 10^{-10}:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\end{array}
\end{array}
if n < -8.40000000000000013e-106Initial program 27.9%
Taylor expanded in n around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6467.6
Applied rewrites67.6%
if -8.40000000000000013e-106 < n < -4.90000000000000035e-209Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6411.2
Applied rewrites11.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
frac-2negN/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites15.8%
if -4.90000000000000035e-209 < n < 1.04999999999999992e-229Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites16.7%
Applied rewrites20.6%
Taylor expanded in i around 0
lower-/.f6425.1
Applied rewrites25.1%
if 1.04999999999999992e-229 < n < 8.9999999999999999e-10Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
lower-*.f6441.7
Applied rewrites41.7%
if 8.9999999999999999e-10 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
(FPCore (i n)
:precision binary64
(if (<= n -1.2e-105)
(* n (fma -50.0 (/ (* i (exp i)) n) (* 100.0 (/ (expm1 i) i))))
(if (<= n -2e-310)
(*
100.0
(/
(* n (expm1 (* n (+ (log (- (/ 1.0 n))) (* -1.0 (log (/ -1.0 i)))))))
i))
(if (<= n 3.6e-84)
(*
100.0
(/ (* n (+ (log i) (fma -1.0 (log n) (* n (/ 1.0 i))))) (/ i n)))
(* 100.0 (/ (* n (expm1 i)) i))))))
double code(double i, double n) {
double tmp;
if (n <= -1.2e-105) {
tmp = n * fma(-50.0, ((i * exp(i)) / n), (100.0 * (expm1(i) / i)));
} else if (n <= -2e-310) {
tmp = 100.0 * ((n * expm1((n * (log(-(1.0 / n)) + (-1.0 * log((-1.0 / i))))))) / i);
} else if (n <= 3.6e-84) {
tmp = 100.0 * ((n * (log(i) + fma(-1.0, log(n), (n * (1.0 / i))))) / (i / n));
} else {
tmp = 100.0 * ((n * expm1(i)) / i);
}
return tmp;
}
function code(i, n) tmp = 0.0 if (n <= -1.2e-105) tmp = Float64(n * fma(-50.0, Float64(Float64(i * exp(i)) / n), Float64(100.0 * Float64(expm1(i) / i)))); elseif (n <= -2e-310) tmp = Float64(100.0 * Float64(Float64(n * expm1(Float64(n * Float64(log(Float64(-Float64(1.0 / n))) + Float64(-1.0 * log(Float64(-1.0 / i))))))) / i)); elseif (n <= 3.6e-84) tmp = Float64(100.0 * Float64(Float64(n * Float64(log(i) + fma(-1.0, log(n), Float64(n * Float64(1.0 / i))))) / Float64(i / n))); else tmp = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)); end return tmp end
code[i_, n_] := If[LessEqual[n, -1.2e-105], N[(n * N[(-50.0 * N[(N[(i * N[Exp[i], $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision] + N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -2e-310], N[(100.0 * N[(N[(n * N[(Exp[N[(n * N[(N[Log[(-N[(1.0 / n), $MachinePrecision])], $MachinePrecision] + N[(-1.0 * N[Log[N[(-1.0 / i), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.6e-84], N[(100.0 * N[(N[(n * N[(N[Log[i], $MachinePrecision] + N[(-1.0 * N[Log[n], $MachinePrecision] + N[(n * N[(1.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.2 \cdot 10^{-105}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(-50, \frac{i \cdot e^{i}}{n}, 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
\mathbf{elif}\;n \leq -2 \cdot 10^{-310}:\\
\;\;\;\;100 \cdot \frac{n \cdot \mathsf{expm1}\left(n \cdot \left(\log \left(-\frac{1}{n}\right) + -1 \cdot \log \left(\frac{-1}{i}\right)\right)\right)}{i}\\
\mathbf{elif}\;n \leq 3.6 \cdot 10^{-84}:\\
\;\;\;\;100 \cdot \frac{n \cdot \left(\log i + \mathsf{fma}\left(-1, \log n, n \cdot \frac{1}{i}\right)\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\end{array}
\end{array}
if n < -1.20000000000000007e-105Initial program 27.9%
Taylor expanded in n around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6467.6
Applied rewrites67.6%
if -1.20000000000000007e-105 < n < -1.999999999999994e-310Initial program 27.9%
Taylor expanded in i around -inf
lower-/.f64N/A
Applied rewrites15.0%
if -1.999999999999994e-310 < n < 3.60000000000000003e-84Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites16.7%
Taylor expanded in i around 0
lower-/.f6414.9
Applied rewrites14.9%
if 3.60000000000000003e-84 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (* n (expm1 i)) i))))
(if (<= n -1.2e-105)
t_0
(if (<= n -4.9e-209)
(* (/ (* -100.0 (* (log (/ i n)) n)) i) (- n))
(if (<= n 1.05e-229)
(* (* (* (/ n i) n) 100.0) (/ n i))
(if (<= n 9e-10) (* 100.0 (* i (/ n i))) t_0))))))
double code(double i, double n) {
double t_0 = 100.0 * ((n * expm1(i)) / i);
double tmp;
if (n <= -1.2e-105) {
tmp = t_0;
} else if (n <= -4.9e-209) {
tmp = ((-100.0 * (log((i / n)) * n)) / i) * -n;
} else if (n <= 1.05e-229) {
tmp = (((n / i) * n) * 100.0) * (n / i);
} else if (n <= 9e-10) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * ((n * Math.expm1(i)) / i);
double tmp;
if (n <= -1.2e-105) {
tmp = t_0;
} else if (n <= -4.9e-209) {
tmp = ((-100.0 * (Math.log((i / n)) * n)) / i) * -n;
} else if (n <= 1.05e-229) {
tmp = (((n / i) * n) * 100.0) * (n / i);
} else if (n <= 9e-10) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((n * math.expm1(i)) / i) tmp = 0 if n <= -1.2e-105: tmp = t_0 elif n <= -4.9e-209: tmp = ((-100.0 * (math.log((i / n)) * n)) / i) * -n elif n <= 1.05e-229: tmp = (((n / i) * n) * 100.0) * (n / i) elif n <= 9e-10: tmp = 100.0 * (i * (n / i)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)) tmp = 0.0 if (n <= -1.2e-105) tmp = t_0; elseif (n <= -4.9e-209) tmp = Float64(Float64(Float64(-100.0 * Float64(log(Float64(i / n)) * n)) / i) * Float64(-n)); elseif (n <= 1.05e-229) tmp = Float64(Float64(Float64(Float64(n / i) * n) * 100.0) * Float64(n / i)); elseif (n <= 9e-10) tmp = Float64(100.0 * Float64(i * Float64(n / i))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.2e-105], t$95$0, If[LessEqual[n, -4.9e-209], N[(N[(N[(-100.0 * N[(N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision] * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision] * (-n)), $MachinePrecision], If[LessEqual[n, 1.05e-229], N[(N[(N[(N[(n / i), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9e-10], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -1.2 \cdot 10^{-105}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -4.9 \cdot 10^{-209}:\\
\;\;\;\;\frac{-100 \cdot \left(\log \left(\frac{i}{n}\right) \cdot n\right)}{i} \cdot \left(-n\right)\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-229}:\\
\;\;\;\;\left(\left(\frac{n}{i} \cdot n\right) \cdot 100\right) \cdot \frac{n}{i}\\
\mathbf{elif}\;n \leq 9 \cdot 10^{-10}:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.20000000000000007e-105 or 8.9999999999999999e-10 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
if -1.20000000000000007e-105 < n < -4.90000000000000035e-209Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6411.2
Applied rewrites11.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
frac-2negN/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites15.8%
if -4.90000000000000035e-209 < n < 1.04999999999999992e-229Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites16.7%
Applied rewrites20.6%
Taylor expanded in i around 0
lower-/.f6425.1
Applied rewrites25.1%
if 1.04999999999999992e-229 < n < 8.9999999999999999e-10Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
lower-*.f6441.7
Applied rewrites41.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (* n (expm1 i)) i))))
(if (<= n -1.2e-105)
t_0
(if (<= n -4.9e-209)
(* (* (* (log (/ i n)) n) (/ 100.0 i)) n)
(if (<= n 1.05e-229)
(* (* (* (/ n i) n) 100.0) (/ n i))
(if (<= n 9e-10) (* 100.0 (* i (/ n i))) t_0))))))
double code(double i, double n) {
double t_0 = 100.0 * ((n * expm1(i)) / i);
double tmp;
if (n <= -1.2e-105) {
tmp = t_0;
} else if (n <= -4.9e-209) {
tmp = ((log((i / n)) * n) * (100.0 / i)) * n;
} else if (n <= 1.05e-229) {
tmp = (((n / i) * n) * 100.0) * (n / i);
} else if (n <= 9e-10) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * ((n * Math.expm1(i)) / i);
double tmp;
if (n <= -1.2e-105) {
tmp = t_0;
} else if (n <= -4.9e-209) {
tmp = ((Math.log((i / n)) * n) * (100.0 / i)) * n;
} else if (n <= 1.05e-229) {
tmp = (((n / i) * n) * 100.0) * (n / i);
} else if (n <= 9e-10) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((n * math.expm1(i)) / i) tmp = 0 if n <= -1.2e-105: tmp = t_0 elif n <= -4.9e-209: tmp = ((math.log((i / n)) * n) * (100.0 / i)) * n elif n <= 1.05e-229: tmp = (((n / i) * n) * 100.0) * (n / i) elif n <= 9e-10: tmp = 100.0 * (i * (n / i)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)) tmp = 0.0 if (n <= -1.2e-105) tmp = t_0; elseif (n <= -4.9e-209) tmp = Float64(Float64(Float64(log(Float64(i / n)) * n) * Float64(100.0 / i)) * n); elseif (n <= 1.05e-229) tmp = Float64(Float64(Float64(Float64(n / i) * n) * 100.0) * Float64(n / i)); elseif (n <= 9e-10) tmp = Float64(100.0 * Float64(i * Float64(n / i))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.2e-105], t$95$0, If[LessEqual[n, -4.9e-209], N[(N[(N[(N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision] * n), $MachinePrecision] * N[(100.0 / i), $MachinePrecision]), $MachinePrecision] * n), $MachinePrecision], If[LessEqual[n, 1.05e-229], N[(N[(N[(N[(n / i), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9e-10], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -1.2 \cdot 10^{-105}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -4.9 \cdot 10^{-209}:\\
\;\;\;\;\left(\left(\log \left(\frac{i}{n}\right) \cdot n\right) \cdot \frac{100}{i}\right) \cdot n\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-229}:\\
\;\;\;\;\left(\left(\frac{n}{i} \cdot n\right) \cdot 100\right) \cdot \frac{n}{i}\\
\mathbf{elif}\;n \leq 9 \cdot 10^{-10}:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.20000000000000007e-105 or 8.9999999999999999e-10 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
if -1.20000000000000007e-105 < n < -4.90000000000000035e-209Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6411.2
Applied rewrites11.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites15.8%
if -4.90000000000000035e-209 < n < 1.04999999999999992e-229Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites16.7%
Applied rewrites20.6%
Taylor expanded in i around 0
lower-/.f6425.1
Applied rewrites25.1%
if 1.04999999999999992e-229 < n < 8.9999999999999999e-10Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
lower-*.f6441.7
Applied rewrites41.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (* n (expm1 i)) i))))
(if (<= n -1.2e-105)
t_0
(if (<= n -4.9e-209)
(* (* (* (log (/ i n)) n) 100.0) (/ n i))
(if (<= n 1.05e-229)
(* (* (* (/ n i) n) 100.0) (/ n i))
(if (<= n 9e-10) (* 100.0 (* i (/ n i))) t_0))))))
double code(double i, double n) {
double t_0 = 100.0 * ((n * expm1(i)) / i);
double tmp;
if (n <= -1.2e-105) {
tmp = t_0;
} else if (n <= -4.9e-209) {
tmp = ((log((i / n)) * n) * 100.0) * (n / i);
} else if (n <= 1.05e-229) {
tmp = (((n / i) * n) * 100.0) * (n / i);
} else if (n <= 9e-10) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * ((n * Math.expm1(i)) / i);
double tmp;
if (n <= -1.2e-105) {
tmp = t_0;
} else if (n <= -4.9e-209) {
tmp = ((Math.log((i / n)) * n) * 100.0) * (n / i);
} else if (n <= 1.05e-229) {
tmp = (((n / i) * n) * 100.0) * (n / i);
} else if (n <= 9e-10) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((n * math.expm1(i)) / i) tmp = 0 if n <= -1.2e-105: tmp = t_0 elif n <= -4.9e-209: tmp = ((math.log((i / n)) * n) * 100.0) * (n / i) elif n <= 1.05e-229: tmp = (((n / i) * n) * 100.0) * (n / i) elif n <= 9e-10: tmp = 100.0 * (i * (n / i)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)) tmp = 0.0 if (n <= -1.2e-105) tmp = t_0; elseif (n <= -4.9e-209) tmp = Float64(Float64(Float64(log(Float64(i / n)) * n) * 100.0) * Float64(n / i)); elseif (n <= 1.05e-229) tmp = Float64(Float64(Float64(Float64(n / i) * n) * 100.0) * Float64(n / i)); elseif (n <= 9e-10) tmp = Float64(100.0 * Float64(i * Float64(n / i))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.2e-105], t$95$0, If[LessEqual[n, -4.9e-209], N[(N[(N[(N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.05e-229], N[(N[(N[(N[(n / i), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9e-10], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -1.2 \cdot 10^{-105}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq -4.9 \cdot 10^{-209}:\\
\;\;\;\;\left(\left(\log \left(\frac{i}{n}\right) \cdot n\right) \cdot 100\right) \cdot \frac{n}{i}\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-229}:\\
\;\;\;\;\left(\left(\frac{n}{i} \cdot n\right) \cdot 100\right) \cdot \frac{n}{i}\\
\mathbf{elif}\;n \leq 9 \cdot 10^{-10}:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -1.20000000000000007e-105 or 8.9999999999999999e-10 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
if -1.20000000000000007e-105 < n < -4.90000000000000035e-209Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-log.f6411.2
Applied rewrites11.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
mult-flipN/A
lower-*.f64N/A
Applied rewrites15.6%
if -4.90000000000000035e-209 < n < 1.04999999999999992e-229Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites16.7%
Applied rewrites20.6%
Taylor expanded in i around 0
lower-/.f6425.1
Applied rewrites25.1%
if 1.04999999999999992e-229 < n < 8.9999999999999999e-10Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
lower-*.f6441.7
Applied rewrites41.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (/ (* n (expm1 i)) i))))
(if (<= n -8.4e-106)
t_0
(if (<= n 1.05e-229)
(* (* (* (/ n i) n) 100.0) (/ n i))
(if (<= n 9e-10) (* 100.0 (* i (/ n i))) t_0)))))
double code(double i, double n) {
double t_0 = 100.0 * ((n * expm1(i)) / i);
double tmp;
if (n <= -8.4e-106) {
tmp = t_0;
} else if (n <= 1.05e-229) {
tmp = (((n / i) * n) * 100.0) * (n / i);
} else if (n <= 9e-10) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double i, double n) {
double t_0 = 100.0 * ((n * Math.expm1(i)) / i);
double tmp;
if (n <= -8.4e-106) {
tmp = t_0;
} else if (n <= 1.05e-229) {
tmp = (((n / i) * n) * 100.0) * (n / i);
} else if (n <= 9e-10) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((n * math.expm1(i)) / i) tmp = 0 if n <= -8.4e-106: tmp = t_0 elif n <= 1.05e-229: tmp = (((n / i) * n) * 100.0) * (n / i) elif n <= 9e-10: tmp = 100.0 * (i * (n / i)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(n * expm1(i)) / i)) tmp = 0.0 if (n <= -8.4e-106) tmp = t_0; elseif (n <= 1.05e-229) tmp = Float64(Float64(Float64(Float64(n / i) * n) * 100.0) * Float64(n / i)); elseif (n <= 9e-10) tmp = Float64(100.0 * Float64(i * Float64(n / i))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -8.4e-106], t$95$0, If[LessEqual[n, 1.05e-229], N[(N[(N[(N[(n / i), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9e-10], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -8.4 \cdot 10^{-106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-229}:\\
\;\;\;\;\left(\left(\frac{n}{i} \cdot n\right) \cdot 100\right) \cdot \frac{n}{i}\\
\mathbf{elif}\;n \leq 9 \cdot 10^{-10}:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -8.40000000000000013e-106 or 8.9999999999999999e-10 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
if -8.40000000000000013e-106 < n < 1.04999999999999992e-229Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites16.7%
Applied rewrites20.6%
Taylor expanded in i around 0
lower-/.f6425.1
Applied rewrites25.1%
if 1.04999999999999992e-229 < n < 8.9999999999999999e-10Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
lower-*.f6441.7
Applied rewrites41.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (* (expm1 i) (/ n i)))))
(if (<= i -3.2e-42)
t_0
(if (<= i 9.4e-38) (* n (fma -50.0 (/ i n) (* 100.0 1.0))) t_0))))
double code(double i, double n) {
double t_0 = 100.0 * (expm1(i) * (n / i));
double tmp;
if (i <= -3.2e-42) {
tmp = t_0;
} else if (i <= 9.4e-38) {
tmp = n * fma(-50.0, (i / n), (100.0 * 1.0));
} else {
tmp = t_0;
}
return tmp;
}
function code(i, n) t_0 = Float64(100.0 * Float64(expm1(i) * Float64(n / i))) tmp = 0.0 if (i <= -3.2e-42) tmp = t_0; elseif (i <= 9.4e-38) tmp = Float64(n * fma(-50.0, Float64(i / n), Float64(100.0 * 1.0))); else tmp = t_0; end return tmp end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -3.2e-42], t$95$0, If[LessEqual[i, 9.4e-38], N[(n * N[(-50.0 * N[(i / n), $MachinePrecision] + N[(100.0 * 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{n}{i}\right)\\
\mathbf{if}\;i \leq -3.2 \cdot 10^{-42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 9.4 \cdot 10^{-38}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(-50, \frac{i}{n}, 100 \cdot 1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if i < -3.20000000000000025e-42 or 9.39999999999999996e-38 < i Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
div-flip-revN/A
lift-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
div-flip-revN/A
lower-/.f6461.2
Applied rewrites61.2%
if -3.20000000000000025e-42 < i < 9.39999999999999996e-38Initial program 27.9%
Taylor expanded in n around inf
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-exp.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-expm1.f6467.6
Applied rewrites67.6%
Taylor expanded in i around 0
Applied rewrites63.9%
Taylor expanded in i around 0
Applied rewrites48.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (+ n (* 0.5 (* i n))))))
(if (<= n -8.4e-106)
t_0
(if (<= n 2.3e-122) (* (* (* (/ n i) n) 100.0) (/ n i)) t_0))))
double code(double i, double n) {
double t_0 = 100.0 * (n + (0.5 * (i * n)));
double tmp;
if (n <= -8.4e-106) {
tmp = t_0;
} else if (n <= 2.3e-122) {
tmp = (((n / i) * n) * 100.0) * (n / i);
} else {
tmp = t_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(i, n)
use fmin_fmax_functions
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * (n + (0.5d0 * (i * n)))
if (n <= (-8.4d-106)) then
tmp = t_0
else if (n <= 2.3d-122) then
tmp = (((n / i) * n) * 100.0d0) * (n / i)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (n + (0.5 * (i * n)));
double tmp;
if (n <= -8.4e-106) {
tmp = t_0;
} else if (n <= 2.3e-122) {
tmp = (((n / i) * n) * 100.0) * (n / i);
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n + (0.5 * (i * n))) tmp = 0 if n <= -8.4e-106: tmp = t_0 elif n <= 2.3e-122: tmp = (((n / i) * n) * 100.0) * (n / i) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n + Float64(0.5 * Float64(i * n)))) tmp = 0.0 if (n <= -8.4e-106) tmp = t_0; elseif (n <= 2.3e-122) tmp = Float64(Float64(Float64(Float64(n / i) * n) * 100.0) * Float64(n / i)); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (n + (0.5 * (i * n))); tmp = 0.0; if (n <= -8.4e-106) tmp = t_0; elseif (n <= 2.3e-122) tmp = (((n / i) * n) * 100.0) * (n / i); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n + N[(0.5 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -8.4e-106], t$95$0, If[LessEqual[n, 2.3e-122], N[(N[(N[(N[(n / i), $MachinePrecision] * n), $MachinePrecision] * 100.0), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n + 0.5 \cdot \left(i \cdot n\right)\right)\\
\mathbf{if}\;n \leq -8.4 \cdot 10^{-106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.3 \cdot 10^{-122}:\\
\;\;\;\;\left(\left(\frac{n}{i} \cdot n\right) \cdot 100\right) \cdot \frac{n}{i}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -8.40000000000000013e-106 or 2.30000000000000007e-122 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6455.4
Applied rewrites55.4%
if -8.40000000000000013e-106 < n < 2.30000000000000007e-122Initial program 27.9%
Taylor expanded in n around 0
lower-*.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-*.f64N/A
lower-fma.f64N/A
Applied rewrites16.7%
Applied rewrites20.6%
Taylor expanded in i around 0
lower-/.f6425.1
Applied rewrites25.1%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (+ n (* 0.5 (* i n))))))
(if (<= n -8.4e-106)
t_0
(if (<= n 1.2e-205) (* 100.0 (/ (- 1.0 1.0) (/ i n))) t_0))))
double code(double i, double n) {
double t_0 = 100.0 * (n + (0.5 * (i * n)));
double tmp;
if (n <= -8.4e-106) {
tmp = t_0;
} else if (n <= 1.2e-205) {
tmp = 100.0 * ((1.0 - 1.0) / (i / n));
} else {
tmp = t_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(i, n)
use fmin_fmax_functions
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * (n + (0.5d0 * (i * n)))
if (n <= (-8.4d-106)) then
tmp = t_0
else if (n <= 1.2d-205) then
tmp = 100.0d0 * ((1.0d0 - 1.0d0) / (i / n))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (n + (0.5 * (i * n)));
double tmp;
if (n <= -8.4e-106) {
tmp = t_0;
} else if (n <= 1.2e-205) {
tmp = 100.0 * ((1.0 - 1.0) / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (n + (0.5 * (i * n))) tmp = 0 if n <= -8.4e-106: tmp = t_0 elif n <= 1.2e-205: tmp = 100.0 * ((1.0 - 1.0) / (i / n)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(n + Float64(0.5 * Float64(i * n)))) tmp = 0.0 if (n <= -8.4e-106) tmp = t_0; elseif (n <= 1.2e-205) tmp = Float64(100.0 * Float64(Float64(1.0 - 1.0) / Float64(i / n))); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (n + (0.5 * (i * n))); tmp = 0.0; if (n <= -8.4e-106) tmp = t_0; elseif (n <= 1.2e-205) tmp = 100.0 * ((1.0 - 1.0) / (i / n)); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n + N[(0.5 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -8.4e-106], t$95$0, If[LessEqual[n, 1.2e-205], N[(100.0 * N[(N[(1.0 - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(n + 0.5 \cdot \left(i \cdot n\right)\right)\\
\mathbf{if}\;n \leq -8.4 \cdot 10^{-106}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 1.2 \cdot 10^{-205}:\\
\;\;\;\;100 \cdot \frac{1 - 1}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -8.40000000000000013e-106 or 1.2000000000000001e-205 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6455.4
Applied rewrites55.4%
if -8.40000000000000013e-106 < n < 1.2000000000000001e-205Initial program 27.9%
Taylor expanded in i around 0
Applied rewrites17.6%
(FPCore (i n)
:precision binary64
(if (<= n -350000000.0)
(* 100.0 (/ (* n i) i))
(if (<= n 8.2e-11)
(* 100.0 (/ i (/ i n)))
(* 100.0 (+ n (* 0.5 (* i n)))))))
double code(double i, double n) {
double tmp;
if (n <= -350000000.0) {
tmp = 100.0 * ((n * i) / i);
} else if (n <= 8.2e-11) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = 100.0 * (n + (0.5 * (i * n)));
}
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(i, n)
use fmin_fmax_functions
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: tmp
if (n <= (-350000000.0d0)) then
tmp = 100.0d0 * ((n * i) / i)
else if (n <= 8.2d-11) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = 100.0d0 * (n + (0.5d0 * (i * n)))
end if
code = tmp
end function
public static double code(double i, double n) {
double tmp;
if (n <= -350000000.0) {
tmp = 100.0 * ((n * i) / i);
} else if (n <= 8.2e-11) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = 100.0 * (n + (0.5 * (i * n)));
}
return tmp;
}
def code(i, n): tmp = 0 if n <= -350000000.0: tmp = 100.0 * ((n * i) / i) elif n <= 8.2e-11: tmp = 100.0 * (i / (i / n)) else: tmp = 100.0 * (n + (0.5 * (i * n))) return tmp
function code(i, n) tmp = 0.0 if (n <= -350000000.0) tmp = Float64(100.0 * Float64(Float64(n * i) / i)); elseif (n <= 8.2e-11) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = Float64(100.0 * Float64(n + Float64(0.5 * Float64(i * n)))); end return tmp end
function tmp_2 = code(i, n) tmp = 0.0; if (n <= -350000000.0) tmp = 100.0 * ((n * i) / i); elseif (n <= 8.2e-11) tmp = 100.0 * (i / (i / n)); else tmp = 100.0 * (n + (0.5 * (i * n))); end tmp_2 = tmp; end
code[i_, n_] := If[LessEqual[n, -350000000.0], N[(100.0 * N[(N[(n * i), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 8.2e-11], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(0.5 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -350000000:\\
\;\;\;\;100 \cdot \frac{n \cdot i}{i}\\
\mathbf{elif}\;n \leq 8.2 \cdot 10^{-11}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n + 0.5 \cdot \left(i \cdot n\right)\right)\\
\end{array}
\end{array}
if n < -3.5e8Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
Applied rewrites50.2%
if -3.5e8 < n < 8.2000000000000001e-11Initial program 27.9%
Taylor expanded in i around 0
Applied rewrites43.4%
if 8.2000000000000001e-11 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f6455.4
Applied rewrites55.4%
(FPCore (i n) :precision binary64 (let* ((t_0 (* 100.0 (/ (* n i) i)))) (if (<= n -350000000.0) t_0 (if (<= n 4e-8) (* 100.0 (/ i (/ i n))) t_0))))
double code(double i, double n) {
double t_0 = 100.0 * ((n * i) / i);
double tmp;
if (n <= -350000000.0) {
tmp = t_0;
} else if (n <= 4e-8) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = t_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(i, n)
use fmin_fmax_functions
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * ((n * i) / i)
if (n <= (-350000000.0d0)) then
tmp = t_0
else if (n <= 4d-8) then
tmp = 100.0d0 * (i / (i / n))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * ((n * i) / i);
double tmp;
if (n <= -350000000.0) {
tmp = t_0;
} else if (n <= 4e-8) {
tmp = 100.0 * (i / (i / n));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((n * i) / i) tmp = 0 if n <= -350000000.0: tmp = t_0 elif n <= 4e-8: tmp = 100.0 * (i / (i / n)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(n * i) / i)) tmp = 0.0 if (n <= -350000000.0) tmp = t_0; elseif (n <= 4e-8) tmp = Float64(100.0 * Float64(i / Float64(i / n))); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * ((n * i) / i); tmp = 0.0; if (n <= -350000000.0) tmp = t_0; elseif (n <= 4e-8) tmp = 100.0 * (i / (i / n)); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(n * i), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -350000000.0], t$95$0, If[LessEqual[n, 4e-8], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n \cdot i}{i}\\
\mathbf{if}\;n \leq -350000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 4 \cdot 10^{-8}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -3.5e8 or 4.0000000000000001e-8 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
Applied rewrites50.2%
if -3.5e8 < n < 4.0000000000000001e-8Initial program 27.9%
Taylor expanded in i around 0
Applied rewrites43.4%
(FPCore (i n) :precision binary64 (let* ((t_0 (* 100.0 (/ (* n i) i)))) (if (<= n -2.2e+103) t_0 (if (<= n 1e-30) (* 100.0 (* i (/ n i))) t_0))))
double code(double i, double n) {
double t_0 = 100.0 * ((n * i) / i);
double tmp;
if (n <= -2.2e+103) {
tmp = t_0;
} else if (n <= 1e-30) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = t_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(i, n)
use fmin_fmax_functions
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * ((n * i) / i)
if (n <= (-2.2d+103)) then
tmp = t_0
else if (n <= 1d-30) then
tmp = 100.0d0 * (i * (n / i))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * ((n * i) / i);
double tmp;
if (n <= -2.2e+103) {
tmp = t_0;
} else if (n <= 1e-30) {
tmp = 100.0 * (i * (n / i));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * ((n * i) / i) tmp = 0 if n <= -2.2e+103: tmp = t_0 elif n <= 1e-30: tmp = 100.0 * (i * (n / i)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(Float64(n * i) / i)) tmp = 0.0 if (n <= -2.2e+103) tmp = t_0; elseif (n <= 1e-30) tmp = Float64(100.0 * Float64(i * Float64(n / i))); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * ((n * i) / i); tmp = 0.0; if (n <= -2.2e+103) tmp = t_0; elseif (n <= 1e-30) tmp = 100.0 * (i * (n / i)); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(n * i), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.2e+103], t$95$0, If[LessEqual[n, 1e-30], N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n \cdot i}{i}\\
\mathbf{if}\;n \leq -2.2 \cdot 10^{+103}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 10^{-30}:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.19999999999999992e103 or 1e-30 < n Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
Applied rewrites50.2%
if -2.19999999999999992e103 < n < 1e-30Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
lower-*.f6441.7
Applied rewrites41.7%
(FPCore (i n)
:precision binary64
(let* ((t_0 (* 100.0 (* i (/ n i)))))
(if (<= i -3.2e-42)
t_0
(if (<= i 9.4e-38) (* 100.0 (+ n (* i -0.5))) t_0))))
double code(double i, double n) {
double t_0 = 100.0 * (i * (n / i));
double tmp;
if (i <= -3.2e-42) {
tmp = t_0;
} else if (i <= 9.4e-38) {
tmp = 100.0 * (n + (i * -0.5));
} else {
tmp = t_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(i, n)
use fmin_fmax_functions
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 100.0d0 * (i * (n / i))
if (i <= (-3.2d-42)) then
tmp = t_0
else if (i <= 9.4d-38) then
tmp = 100.0d0 * (n + (i * (-0.5d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double i, double n) {
double t_0 = 100.0 * (i * (n / i));
double tmp;
if (i <= -3.2e-42) {
tmp = t_0;
} else if (i <= 9.4e-38) {
tmp = 100.0 * (n + (i * -0.5));
} else {
tmp = t_0;
}
return tmp;
}
def code(i, n): t_0 = 100.0 * (i * (n / i)) tmp = 0 if i <= -3.2e-42: tmp = t_0 elif i <= 9.4e-38: tmp = 100.0 * (n + (i * -0.5)) else: tmp = t_0 return tmp
function code(i, n) t_0 = Float64(100.0 * Float64(i * Float64(n / i))) tmp = 0.0 if (i <= -3.2e-42) tmp = t_0; elseif (i <= 9.4e-38) tmp = Float64(100.0 * Float64(n + Float64(i * -0.5))); else tmp = t_0; end return tmp end
function tmp_2 = code(i, n) t_0 = 100.0 * (i * (n / i)); tmp = 0.0; if (i <= -3.2e-42) tmp = t_0; elseif (i <= 9.4e-38) tmp = 100.0 * (n + (i * -0.5)); else tmp = t_0; end tmp_2 = tmp; end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(i * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -3.2e-42], t$95$0, If[LessEqual[i, 9.4e-38], N[(100.0 * N[(n + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 100 \cdot \left(i \cdot \frac{n}{i}\right)\\
\mathbf{if}\;i \leq -3.2 \cdot 10^{-42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;i \leq 9.4 \cdot 10^{-38}:\\
\;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if i < -3.20000000000000025e-42 or 9.39999999999999996e-38 < i Initial program 27.9%
Taylor expanded in n around inf
lower-/.f64N/A
lower-*.f64N/A
lower-expm1.f6471.0
Applied rewrites71.0%
Taylor expanded in i around 0
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
lower-*.f6441.7
Applied rewrites41.7%
if -3.20000000000000025e-42 < i < 9.39999999999999996e-38Initial program 27.9%
Taylor expanded in i around 0
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower-/.f6455.2
Applied rewrites55.2%
Taylor expanded in n around 0
Applied rewrites48.7%
(FPCore (i n) :precision binary64 (* 100.0 n))
double code(double i, double n) {
return 100.0 * n;
}
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(i, n)
use fmin_fmax_functions
real(8), intent (in) :: i
real(8), intent (in) :: n
code = 100.0d0 * n
end function
public static double code(double i, double n) {
return 100.0 * n;
}
def code(i, n): return 100.0 * n
function code(i, n) return Float64(100.0 * n) end
function tmp = code(i, n) tmp = 100.0 * n; end
code[i_, n_] := N[(100.0 * n), $MachinePrecision]
\begin{array}{l}
\\
100 \cdot n
\end{array}
Initial program 27.9%
Taylor expanded in i around 0
Applied rewrites49.6%
(FPCore (i n)
:precision binary64
(let* ((t_0 (+ 1.0 (/ i n))))
(*
100.0
(/
(-
(exp
(*
n
(if (== t_0 1.0)
(/ i n)
(/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
1.0)
(/ i n)))))
double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
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(i, n)
use fmin_fmax_functions
real(8), intent (in) :: i
real(8), intent (in) :: n
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (i / n)
if (t_0 == 1.0d0) then
tmp = i / n
else
tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
end if
code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
double t_0 = 1.0 + (i / n);
double tmp;
if (t_0 == 1.0) {
tmp = i / n;
} else {
tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
}
return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n): t_0 = 1.0 + (i / n) tmp = 0 if t_0 == 1.0: tmp = i / n else: tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0) return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n) t_0 = Float64(1.0 + Float64(i / n)) tmp = 0.0 if (t_0 == 1.0) tmp = Float64(i / n); else tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0)); end return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n))) end
function tmp_2 = code(i, n) t_0 = 1.0 + (i / n); tmp = 0.0; if (t_0 == 1.0) tmp = i / n; else tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0); end tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n)); end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\
\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}
herbie shell --seed 2025156
(FPCore (i n)
:name "Compound Interest"
:precision binary64
:alt
(! :herbie-platform c (let ((lnbase (if (== (+ 1 (/ i n)) 1) (/ i n) (/ (* (/ i n) (log (+ 1 (/ i n)))) (- (+ (/ i n) 1) 1))))) (* 100 (/ (- (exp (* n lnbase)) 1) (/ i n)))))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))