
(FPCore (c x y) :precision binary64 :pre TRUE (* c (log (+ 1.0 (* (- (pow E x) 1.0) y)))))
double code(double c, double x, double y) {
return c * log((1.0 + ((pow(((double) M_E), x) - 1.0) * y)));
}
public static double code(double c, double x, double y) {
return c * Math.log((1.0 + ((Math.pow(Math.E, x) - 1.0) * y)));
}
def code(c, x, y): return c * math.log((1.0 + ((math.pow(math.e, x) - 1.0) * y)))
function code(c, x, y) return Float64(c * log(Float64(1.0 + Float64(Float64((exp(1) ^ x) - 1.0) * y)))) end
function tmp = code(c, x, y) tmp = c * log((1.0 + (((2.71828182845904523536 ^ x) - 1.0) * y))); end
code[c_, x_, y_] := N[(c * N[Log[N[(1.0 + N[(N[(N[Power[E, x], $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = c * (ln(((1) + (((exp(1) ^ x) - (1)) * y)))) END code
c \cdot \log \left(1 + \left({e}^{x} - 1\right) \cdot y\right)
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c x y) :precision binary64 :pre TRUE (* c (log (+ 1.0 (* (- (pow E x) 1.0) y)))))
double code(double c, double x, double y) {
return c * log((1.0 + ((pow(((double) M_E), x) - 1.0) * y)));
}
public static double code(double c, double x, double y) {
return c * Math.log((1.0 + ((Math.pow(Math.E, x) - 1.0) * y)));
}
def code(c, x, y): return c * math.log((1.0 + ((math.pow(math.e, x) - 1.0) * y)))
function code(c, x, y) return Float64(c * log(Float64(1.0 + Float64(Float64((exp(1) ^ x) - 1.0) * y)))) end
function tmp = code(c, x, y) tmp = c * log((1.0 + (((2.71828182845904523536 ^ x) - 1.0) * y))); end
code[c_, x_, y_] := N[(c * N[Log[N[(1.0 + N[(N[(N[Power[E, x], $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = c * (ln(((1) + (((exp(1) ^ x) - (1)) * y)))) END code
c \cdot \log \left(1 + \left({e}^{x} - 1\right) \cdot y\right)
(FPCore (c x y)
:precision binary64
:pre TRUE
(let* ((t_0 (* c (log1p (* y (expm1 x))))))
(if (<= y -1.991547631016478e-10)
t_0
(if (<= y 1.2324994052440526e-38) (* (expm1 x) (* y c)) t_0))))double code(double c, double x, double y) {
double t_0 = c * log1p((y * expm1(x)));
double tmp;
if (y <= -1.991547631016478e-10) {
tmp = t_0;
} else if (y <= 1.2324994052440526e-38) {
tmp = expm1(x) * (y * c);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double c, double x, double y) {
double t_0 = c * Math.log1p((y * Math.expm1(x)));
double tmp;
if (y <= -1.991547631016478e-10) {
tmp = t_0;
} else if (y <= 1.2324994052440526e-38) {
tmp = Math.expm1(x) * (y * c);
} else {
tmp = t_0;
}
return tmp;
}
def code(c, x, y): t_0 = c * math.log1p((y * math.expm1(x))) tmp = 0 if y <= -1.991547631016478e-10: tmp = t_0 elif y <= 1.2324994052440526e-38: tmp = math.expm1(x) * (y * c) else: tmp = t_0 return tmp
function code(c, x, y) t_0 = Float64(c * log1p(Float64(y * expm1(x)))) tmp = 0.0 if (y <= -1.991547631016478e-10) tmp = t_0; elseif (y <= 1.2324994052440526e-38) tmp = Float64(expm1(x) * Float64(y * c)); else tmp = t_0; end return tmp end
code[c_, x_, y_] := Block[{t$95$0 = N[(c * N[Log[1 + N[(y * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.991547631016478e-10], t$95$0, If[LessEqual[y, 1.2324994052440526e-38], N[(N[(Exp[x] - 1), $MachinePrecision] * N[(y * c), $MachinePrecision]), $MachinePrecision], t$95$0]]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET t_0 = (c * (ln(((y * ((exp(x)) - (1))) + (1))))) IN LET tmp_1 = IF (y <= (123249940524405264961872942357537548734018527742303289855099320193522277173652859614108300161352724765018162855767513974569737911224365234375e-178)) THEN (((exp(x)) - (1)) * (y * c)) ELSE t_0 ENDIF IN LET tmp = IF (y <= (-19915476310164780037345717440540153464478834166584420017898082733154296875e-83)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := c \cdot \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right)\\
\mathbf{if}\;y \leq -1.991547631016478 \cdot 10^{-10}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.2324994052440526 \cdot 10^{-38}:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -1.991547631016478e-10 or 1.2324994052440526e-38 < y Initial program 41.6%
Applied rewrites93.5%
if -1.991547631016478e-10 < y < 1.2324994052440526e-38Initial program 41.6%
Taylor expanded in y around 0
Applied rewrites73.7%
Applied rewrites76.5%
(FPCore (c x y)
:precision binary64
:pre TRUE
(let* ((t_0 (* c (log1p (* y x)))))
(if (<= y -2.087628285077399e+228)
(* c (log (fma y (expm1 x) 1.0)))
(if (<= y -0.0008096185976492347)
t_0
(if (<= y 6644.452441570779) (* (expm1 x) (* y c)) t_0)))))double code(double c, double x, double y) {
double t_0 = c * log1p((y * x));
double tmp;
if (y <= -2.087628285077399e+228) {
tmp = c * log(fma(y, expm1(x), 1.0));
} else if (y <= -0.0008096185976492347) {
tmp = t_0;
} else if (y <= 6644.452441570779) {
tmp = expm1(x) * (y * c);
} else {
tmp = t_0;
}
return tmp;
}
function code(c, x, y) t_0 = Float64(c * log1p(Float64(y * x))) tmp = 0.0 if (y <= -2.087628285077399e+228) tmp = Float64(c * log(fma(y, expm1(x), 1.0))); elseif (y <= -0.0008096185976492347) tmp = t_0; elseif (y <= 6644.452441570779) tmp = Float64(expm1(x) * Float64(y * c)); else tmp = t_0; end return tmp end
code[c_, x_, y_] := Block[{t$95$0 = N[(c * N[Log[1 + N[(y * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.087628285077399e+228], N[(c * N[Log[N[(y * N[(Exp[x] - 1), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -0.0008096185976492347], t$95$0, If[LessEqual[y, 6644.452441570779], N[(N[(Exp[x] - 1), $MachinePrecision] * N[(y * c), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET t_0 = (c * (ln(((y * x) + (1))))) IN LET tmp_2 = IF (y <= (66444524415707792286411859095096588134765625e-40)) THEN (((exp(x)) - (1)) * (y * c)) ELSE t_0 ENDIF IN LET tmp_1 = IF (y <= (-809618597649234693520992056647855861228890717029571533203125e-63)) THEN t_0 ELSE tmp_2 ENDIF IN LET tmp = IF (y <= (-2087628285077398909365043005680871304653081370935109603867186804745254721485389277248837133477176579156355933442397368149484137816682811839001184916221765139024287203298881970186108319062489407065633833026409594397514141450371072)) THEN (c * (ln(((y * ((exp(x)) - (1))) + (1))))) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := c \cdot \mathsf{log1p}\left(y \cdot x\right)\\
\mathbf{if}\;y \leq -2.087628285077399 \cdot 10^{+228}:\\
\;\;\;\;c \cdot \log \left(\mathsf{fma}\left(y, \mathsf{expm1}\left(x\right), 1\right)\right)\\
\mathbf{elif}\;y \leq -0.0008096185976492347:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 6644.452441570779:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -2.0876282850773989e228Initial program 41.6%
Applied rewrites51.3%
if -2.0876282850773989e228 < y < -8.0961859764923469e-4 or 6644.4524415707792 < y Initial program 41.6%
Taylor expanded in x around 0
Applied rewrites39.7%
Applied rewrites65.9%
if -8.0961859764923469e-4 < y < 6644.4524415707792Initial program 41.6%
Taylor expanded in y around 0
Applied rewrites73.7%
Applied rewrites76.5%
(FPCore (c x y)
:precision binary64
:pre TRUE
(let* ((t_0 (* c (log1p (* y x)))))
(if (<= y -0.0008096185976492347)
t_0
(if (<= y 6644.452441570779) (* (expm1 x) (* y c)) t_0))))double code(double c, double x, double y) {
double t_0 = c * log1p((y * x));
double tmp;
if (y <= -0.0008096185976492347) {
tmp = t_0;
} else if (y <= 6644.452441570779) {
tmp = expm1(x) * (y * c);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double c, double x, double y) {
double t_0 = c * Math.log1p((y * x));
double tmp;
if (y <= -0.0008096185976492347) {
tmp = t_0;
} else if (y <= 6644.452441570779) {
tmp = Math.expm1(x) * (y * c);
} else {
tmp = t_0;
}
return tmp;
}
def code(c, x, y): t_0 = c * math.log1p((y * x)) tmp = 0 if y <= -0.0008096185976492347: tmp = t_0 elif y <= 6644.452441570779: tmp = math.expm1(x) * (y * c) else: tmp = t_0 return tmp
function code(c, x, y) t_0 = Float64(c * log1p(Float64(y * x))) tmp = 0.0 if (y <= -0.0008096185976492347) tmp = t_0; elseif (y <= 6644.452441570779) tmp = Float64(expm1(x) * Float64(y * c)); else tmp = t_0; end return tmp end
code[c_, x_, y_] := Block[{t$95$0 = N[(c * N[Log[1 + N[(y * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.0008096185976492347], t$95$0, If[LessEqual[y, 6644.452441570779], N[(N[(Exp[x] - 1), $MachinePrecision] * N[(y * c), $MachinePrecision]), $MachinePrecision], t$95$0]]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET t_0 = (c * (ln(((y * x) + (1))))) IN LET tmp_1 = IF (y <= (66444524415707792286411859095096588134765625e-40)) THEN (((exp(x)) - (1)) * (y * c)) ELSE t_0 ENDIF IN LET tmp = IF (y <= (-809618597649234693520992056647855861228890717029571533203125e-63)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := c \cdot \mathsf{log1p}\left(y \cdot x\right)\\
\mathbf{if}\;y \leq -0.0008096185976492347:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 6644.452441570779:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -8.0961859764923469e-4 or 6644.4524415707792 < y Initial program 41.6%
Taylor expanded in x around 0
Applied rewrites39.7%
Applied rewrites65.9%
if -8.0961859764923469e-4 < y < 6644.4524415707792Initial program 41.6%
Taylor expanded in y around 0
Applied rewrites73.7%
Applied rewrites76.5%
(FPCore (c x y)
:precision binary64
:pre TRUE
(let* ((t_0 (* c (log (fma y x 1.0)))))
(if (<= y -1.3599697383708069e+228)
t_0
(if (<= y -0.0008096185976492347)
(* c (/ 1.0 (+ (/ 1.0 (* x y)) 0.5)))
(if (<= y 1.1630894454192719e+71) (* (expm1 x) (* y c)) t_0)))))double code(double c, double x, double y) {
double t_0 = c * log(fma(y, x, 1.0));
double tmp;
if (y <= -1.3599697383708069e+228) {
tmp = t_0;
} else if (y <= -0.0008096185976492347) {
tmp = c * (1.0 / ((1.0 / (x * y)) + 0.5));
} else if (y <= 1.1630894454192719e+71) {
tmp = expm1(x) * (y * c);
} else {
tmp = t_0;
}
return tmp;
}
function code(c, x, y) t_0 = Float64(c * log(fma(y, x, 1.0))) tmp = 0.0 if (y <= -1.3599697383708069e+228) tmp = t_0; elseif (y <= -0.0008096185976492347) tmp = Float64(c * Float64(1.0 / Float64(Float64(1.0 / Float64(x * y)) + 0.5))); elseif (y <= 1.1630894454192719e+71) tmp = Float64(expm1(x) * Float64(y * c)); else tmp = t_0; end return tmp end
code[c_, x_, y_] := Block[{t$95$0 = N[(c * N[Log[N[(y * x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.3599697383708069e+228], t$95$0, If[LessEqual[y, -0.0008096185976492347], N[(c * N[(1.0 / N[(N[(1.0 / N[(x * y), $MachinePrecision]), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1630894454192719e+71], N[(N[(Exp[x] - 1), $MachinePrecision] * N[(y * c), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET t_0 = (c * (ln(((y * x) + (1))))) IN LET tmp_2 = IF (y <= (116308944541927187625143853642057620106871860990636610321749410377105408)) THEN (((exp(x)) - (1)) * (y * c)) ELSE t_0 ENDIF IN LET tmp_1 = IF (y <= (-809618597649234693520992056647855861228890717029571533203125e-63)) THEN (c * ((1) / (((1) / (x * y)) + (5e-1)))) ELSE tmp_2 ENDIF IN LET tmp = IF (y <= (-1359969738370806896755562926410279769371882555973511806330008815111289759090866078305668990140742241100522568836907406445566249585868569804121709139677793429604246124562270667741646162146483579952971505296713271917748543920537600)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := c \cdot \log \left(\mathsf{fma}\left(y, x, 1\right)\right)\\
\mathbf{if}\;y \leq -1.3599697383708069 \cdot 10^{+228}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -0.0008096185976492347:\\
\;\;\;\;c \cdot \frac{1}{\frac{1}{x \cdot y} + 0.5}\\
\mathbf{elif}\;y \leq 1.1630894454192719 \cdot 10^{+71}:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -1.3599697383708069e228 or 1.1630894454192719e71 < y Initial program 41.6%
Applied rewrites51.3%
Applied rewrites51.3%
Taylor expanded in x around 0
Applied rewrites39.7%
Applied rewrites39.7%
if -1.3599697383708069e228 < y < -8.0961859764923469e-4Initial program 41.6%
Applied rewrites51.3%
Taylor expanded in y around 0
Applied rewrites75.3%
Applied rewrites75.3%
Taylor expanded in x around 0
Applied rewrites57.3%
if -8.0961859764923469e-4 < y < 1.1630894454192719e71Initial program 41.6%
Taylor expanded in y around 0
Applied rewrites73.7%
Applied rewrites76.5%
(FPCore (c x y)
:precision binary64
:pre TRUE
(let* ((t_0 (* c (log (fma y x 1.0)))))
(if (<= y -1.3599697383708069e+228)
t_0
(if (<= y -0.0008096185976492347)
(/ c (+ (/ 1.0 (* x y)) 0.5))
(if (<= y 1.1630894454192719e+71) (* (expm1 x) (* y c)) t_0)))))double code(double c, double x, double y) {
double t_0 = c * log(fma(y, x, 1.0));
double tmp;
if (y <= -1.3599697383708069e+228) {
tmp = t_0;
} else if (y <= -0.0008096185976492347) {
tmp = c / ((1.0 / (x * y)) + 0.5);
} else if (y <= 1.1630894454192719e+71) {
tmp = expm1(x) * (y * c);
} else {
tmp = t_0;
}
return tmp;
}
function code(c, x, y) t_0 = Float64(c * log(fma(y, x, 1.0))) tmp = 0.0 if (y <= -1.3599697383708069e+228) tmp = t_0; elseif (y <= -0.0008096185976492347) tmp = Float64(c / Float64(Float64(1.0 / Float64(x * y)) + 0.5)); elseif (y <= 1.1630894454192719e+71) tmp = Float64(expm1(x) * Float64(y * c)); else tmp = t_0; end return tmp end
code[c_, x_, y_] := Block[{t$95$0 = N[(c * N[Log[N[(y * x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.3599697383708069e+228], t$95$0, If[LessEqual[y, -0.0008096185976492347], N[(c / N[(N[(1.0 / N[(x * y), $MachinePrecision]), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.1630894454192719e+71], N[(N[(Exp[x] - 1), $MachinePrecision] * N[(y * c), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET t_0 = (c * (ln(((y * x) + (1))))) IN LET tmp_2 = IF (y <= (116308944541927187625143853642057620106871860990636610321749410377105408)) THEN (((exp(x)) - (1)) * (y * c)) ELSE t_0 ENDIF IN LET tmp_1 = IF (y <= (-809618597649234693520992056647855861228890717029571533203125e-63)) THEN (c / (((1) / (x * y)) + (5e-1))) ELSE tmp_2 ENDIF IN LET tmp = IF (y <= (-1359969738370806896755562926410279769371882555973511806330008815111289759090866078305668990140742241100522568836907406445566249585868569804121709139677793429604246124562270667741646162146483579952971505296713271917748543920537600)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := c \cdot \log \left(\mathsf{fma}\left(y, x, 1\right)\right)\\
\mathbf{if}\;y \leq -1.3599697383708069 \cdot 10^{+228}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq -0.0008096185976492347:\\
\;\;\;\;\frac{c}{\frac{1}{x \cdot y} + 0.5}\\
\mathbf{elif}\;y \leq 1.1630894454192719 \cdot 10^{+71}:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -1.3599697383708069e228 or 1.1630894454192719e71 < y Initial program 41.6%
Applied rewrites51.3%
Applied rewrites51.3%
Taylor expanded in x around 0
Applied rewrites39.7%
Applied rewrites39.7%
if -1.3599697383708069e228 < y < -8.0961859764923469e-4Initial program 41.6%
Applied rewrites51.3%
Taylor expanded in y around 0
Applied rewrites75.3%
Applied rewrites75.3%
Taylor expanded in x around 0
Applied rewrites57.3%
if -8.0961859764923469e-4 < y < 1.1630894454192719e71Initial program 41.6%
Taylor expanded in y around 0
Applied rewrites73.7%
Applied rewrites76.5%
(FPCore (c x y)
:precision binary64
:pre TRUE
(let* ((t_0 (/ c (+ (/ 1.0 (* x y)) 0.5))))
(if (<= y -0.0008096185976492347)
t_0
(if (<= y 5.040762642470446e+34) (* (expm1 x) (* y c)) t_0))))double code(double c, double x, double y) {
double t_0 = c / ((1.0 / (x * y)) + 0.5);
double tmp;
if (y <= -0.0008096185976492347) {
tmp = t_0;
} else if (y <= 5.040762642470446e+34) {
tmp = expm1(x) * (y * c);
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double c, double x, double y) {
double t_0 = c / ((1.0 / (x * y)) + 0.5);
double tmp;
if (y <= -0.0008096185976492347) {
tmp = t_0;
} else if (y <= 5.040762642470446e+34) {
tmp = Math.expm1(x) * (y * c);
} else {
tmp = t_0;
}
return tmp;
}
def code(c, x, y): t_0 = c / ((1.0 / (x * y)) + 0.5) tmp = 0 if y <= -0.0008096185976492347: tmp = t_0 elif y <= 5.040762642470446e+34: tmp = math.expm1(x) * (y * c) else: tmp = t_0 return tmp
function code(c, x, y) t_0 = Float64(c / Float64(Float64(1.0 / Float64(x * y)) + 0.5)) tmp = 0.0 if (y <= -0.0008096185976492347) tmp = t_0; elseif (y <= 5.040762642470446e+34) tmp = Float64(expm1(x) * Float64(y * c)); else tmp = t_0; end return tmp end
code[c_, x_, y_] := Block[{t$95$0 = N[(c / N[(N[(1.0 / N[(x * y), $MachinePrecision]), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -0.0008096185976492347], t$95$0, If[LessEqual[y, 5.040762642470446e+34], N[(N[(Exp[x] - 1), $MachinePrecision] * N[(y * c), $MachinePrecision]), $MachinePrecision], t$95$0]]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET t_0 = (c / (((1) / (x * y)) + (5e-1))) IN LET tmp_1 = IF (y <= (50407626424704463572145230672035840)) THEN (((exp(x)) - (1)) * (y * c)) ELSE t_0 ENDIF IN LET tmp = IF (y <= (-809618597649234693520992056647855861228890717029571533203125e-63)) THEN t_0 ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
t_0 := \frac{c}{\frac{1}{x \cdot y} + 0.5}\\
\mathbf{if}\;y \leq -0.0008096185976492347:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5.040762642470446 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -8.0961859764923469e-4 or 5.0407626424704464e34 < y Initial program 41.6%
Applied rewrites51.3%
Taylor expanded in y around 0
Applied rewrites75.3%
Applied rewrites75.3%
Taylor expanded in x around 0
Applied rewrites57.3%
if -8.0961859764923469e-4 < y < 5.0407626424704464e34Initial program 41.6%
Taylor expanded in y around 0
Applied rewrites73.7%
Applied rewrites76.5%
(FPCore (c x y) :precision binary64 :pre TRUE (* (expm1 x) (* y c)))
double code(double c, double x, double y) {
return expm1(x) * (y * c);
}
public static double code(double c, double x, double y) {
return Math.expm1(x) * (y * c);
}
def code(c, x, y): return math.expm1(x) * (y * c)
function code(c, x, y) return Float64(expm1(x) * Float64(y * c)) end
code[c_, x_, y_] := N[(N[(Exp[x] - 1), $MachinePrecision] * N[(y * c), $MachinePrecision]), $MachinePrecision]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = ((exp(x)) - (1)) * (y * c) END code
\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)
Initial program 41.6%
Taylor expanded in y around 0
Applied rewrites73.7%
Applied rewrites76.5%
(FPCore (c x y) :precision binary64 :pre TRUE (if (<= x -3.3583653586962114e-61) (* c (* y (expm1 x))) (* x (* y c))))
double code(double c, double x, double y) {
double tmp;
if (x <= -3.3583653586962114e-61) {
tmp = c * (y * expm1(x));
} else {
tmp = x * (y * c);
}
return tmp;
}
public static double code(double c, double x, double y) {
double tmp;
if (x <= -3.3583653586962114e-61) {
tmp = c * (y * Math.expm1(x));
} else {
tmp = x * (y * c);
}
return tmp;
}
def code(c, x, y): tmp = 0 if x <= -3.3583653586962114e-61: tmp = c * (y * math.expm1(x)) else: tmp = x * (y * c) return tmp
function code(c, x, y) tmp = 0.0 if (x <= -3.3583653586962114e-61) tmp = Float64(c * Float64(y * expm1(x))); else tmp = Float64(x * Float64(y * c)); end return tmp end
code[c_, x_, y_] := If[LessEqual[x, -3.3583653586962114e-61], N[(c * N[(y * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * c), $MachinePrecision]), $MachinePrecision]]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = LET tmp = IF (x <= (-3358365358696211364075993439929353152676742891229095553587343713537856402097382277350764561184825511446443545198359313164530463455969328846756081631921321550837689073887304402887821197509765625e-253)) THEN (c * (y * ((exp(x)) - (1)))) ELSE (x * (y * c)) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;x \leq -3.3583653586962114 \cdot 10^{-61}:\\
\;\;\;\;c \cdot \left(y \cdot \mathsf{expm1}\left(x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot c\right)\\
\end{array}
if x < -3.3583653586962114e-61Initial program 41.6%
Taylor expanded in y around 0
Applied rewrites73.7%
if -3.3583653586962114e-61 < x Initial program 41.6%
Taylor expanded in x around 0
Applied rewrites55.8%
Applied rewrites61.3%
(FPCore (c x y) :precision binary64 :pre TRUE (* (copysign 1.0 c) (if (<= (fabs c) 1.9447531344427876e+57) (* x (* y (fabs c))) (* y (* x (fabs c))))))
double code(double c, double x, double y) {
double tmp;
if (fabs(c) <= 1.9447531344427876e+57) {
tmp = x * (y * fabs(c));
} else {
tmp = y * (x * fabs(c));
}
return copysign(1.0, c) * tmp;
}
public static double code(double c, double x, double y) {
double tmp;
if (Math.abs(c) <= 1.9447531344427876e+57) {
tmp = x * (y * Math.abs(c));
} else {
tmp = y * (x * Math.abs(c));
}
return Math.copySign(1.0, c) * tmp;
}
def code(c, x, y): tmp = 0 if math.fabs(c) <= 1.9447531344427876e+57: tmp = x * (y * math.fabs(c)) else: tmp = y * (x * math.fabs(c)) return math.copysign(1.0, c) * tmp
function code(c, x, y) tmp = 0.0 if (abs(c) <= 1.9447531344427876e+57) tmp = Float64(x * Float64(y * abs(c))); else tmp = Float64(y * Float64(x * abs(c))); end return Float64(copysign(1.0, c) * tmp) end
function tmp_2 = code(c, x, y) tmp = 0.0; if (abs(c) <= 1.9447531344427876e+57) tmp = x * (y * abs(c)); else tmp = y * (x * abs(c)); end tmp_2 = (sign(c) * abs(1.0)) * tmp; end
code[c_, x_, y_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[c]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[c], $MachinePrecision], 1.9447531344427876e+57], N[(x * N[(y * N[Abs[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * N[Abs[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, c\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|c\right| \leq 1.9447531344427876 \cdot 10^{+57}:\\
\;\;\;\;x \cdot \left(y \cdot \left|c\right|\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \left|c\right|\right)\\
\end{array}
if c < 1.9447531344427876e57Initial program 41.6%
Taylor expanded in x around 0
Applied rewrites55.8%
Applied rewrites61.3%
if 1.9447531344427876e57 < c Initial program 41.6%
Taylor expanded in x around 0
Applied rewrites55.8%
Applied rewrites59.2%
(FPCore (c x y) :precision binary64 :pre TRUE (* x (* y c)))
double code(double c, double x, double y) {
return x * (y * c);
}
real(8) function code(c, x, y)
use fmin_fmax_functions
real(8), intent (in) :: c
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (y * c)
end function
public static double code(double c, double x, double y) {
return x * (y * c);
}
def code(c, x, y): return x * (y * c)
function code(c, x, y) return Float64(x * Float64(y * c)) end
function tmp = code(c, x, y) tmp = x * (y * c); end
code[c_, x_, y_] := N[(x * N[(y * c), $MachinePrecision]), $MachinePrecision]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = x * (y * c) END code
x \cdot \left(y \cdot c\right)
Initial program 41.6%
Taylor expanded in x around 0
Applied rewrites55.8%
Applied rewrites61.3%
(FPCore (c x y) :precision binary64 :pre TRUE (* c (* x y)))
double code(double c, double x, double y) {
return c * (x * y);
}
real(8) function code(c, x, y)
use fmin_fmax_functions
real(8), intent (in) :: c
real(8), intent (in) :: x
real(8), intent (in) :: y
code = c * (x * y)
end function
public static double code(double c, double x, double y) {
return c * (x * y);
}
def code(c, x, y): return c * (x * y)
function code(c, x, y) return Float64(c * Float64(x * y)) end
function tmp = code(c, x, y) tmp = c * (x * y); end
code[c_, x_, y_] := N[(c * N[(x * y), $MachinePrecision]), $MachinePrecision]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = c * (x * y) END code
c \cdot \left(x \cdot y\right)
Initial program 41.6%
Taylor expanded in x around 0
Applied rewrites55.8%
(FPCore (c x y) :precision binary64 :pre TRUE (* c (log1p (* (expm1 x) y))))
double code(double c, double x, double y) {
return c * log1p((expm1(x) * y));
}
public static double code(double c, double x, double y) {
return c * Math.log1p((Math.expm1(x) * y));
}
def code(c, x, y): return c * math.log1p((math.expm1(x) * y))
function code(c, x, y) return Float64(c * log1p(Float64(expm1(x) * y))) end
code[c_, x_, y_] := N[(c * N[Log[1 + N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
f(c, x, y): c in [-inf, +inf], x in [-inf, +inf], y in [-inf, +inf] code: THEORY BEGIN f(c, x, y: real): real = c * (ln(((((exp(x)) - (1)) * y) + (1)))) END code
c \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right)
herbie shell --seed 2026086
(FPCore (c x y)
:name "Logarithmic Transform"
:precision binary64
:alt
(* c (log1p (* (expm1 x) y)))
(* c (log (+ 1.0 (* (- (pow E x) 1.0) y)))))