
(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 13 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.048616635278871e-28)
t_0
(if (<= y 2.4520640965510156e-27) (* (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.048616635278871e-28) {
tmp = t_0;
} else if (y <= 2.4520640965510156e-27) {
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.048616635278871e-28) {
tmp = t_0;
} else if (y <= 2.4520640965510156e-27) {
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.048616635278871e-28: tmp = t_0 elif y <= 2.4520640965510156e-27: 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.048616635278871e-28) tmp = t_0; elseif (y <= 2.4520640965510156e-27) 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.048616635278871e-28], t$95$0, If[LessEqual[y, 2.4520640965510156e-27], 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 <= (245206409655101562430941493959943172426255612604679907674416304549911186337618484998301937594078481197357177734375e-140)) THEN (((exp(x)) - (1)) * (y * c)) ELSE t_0 ENDIF IN LET tmp = IF (y <= (-10486166352788709956328927053122569613359305365757206269481419355865418007421607793361317817470990121364593505859375e-143)) 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.048616635278871 \cdot 10^{-28}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.4520640965510156 \cdot 10^{-27}:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -1.048616635278871e-28 or 2.4520640965510156e-27 < y Initial program 41.0%
Applied rewrites93.2%
if -1.048616635278871e-28 < y < 2.4520640965510156e-27Initial program 41.0%
Taylor expanded in y around 0
Applied rewrites73.9%
Applied rewrites77.3%
(FPCore (c x y)
:precision binary64
:pre TRUE
(if (<= y -3.841611067012462e+52)
(* c (log (fma y (expm1 x) 1.0)))
(if (<= y 99.55376154833478)
(* (expm1 x) (* y c))
(* c (log1p (* y x))))))double code(double c, double x, double y) {
double tmp;
if (y <= -3.841611067012462e+52) {
tmp = c * log(fma(y, expm1(x), 1.0));
} else if (y <= 99.55376154833478) {
tmp = expm1(x) * (y * c);
} else {
tmp = c * log1p((y * x));
}
return tmp;
}
function code(c, x, y) tmp = 0.0 if (y <= -3.841611067012462e+52) tmp = Float64(c * log(fma(y, expm1(x), 1.0))); elseif (y <= 99.55376154833478) tmp = Float64(expm1(x) * Float64(y * c)); else tmp = Float64(c * log1p(Float64(y * x))); end return tmp end
code[c_, x_, y_] := If[LessEqual[y, -3.841611067012462e+52], N[(c * N[Log[N[(y * N[(Exp[x] - 1), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 99.55376154833478], N[(N[(Exp[x] - 1), $MachinePrecision] * N[(y * c), $MachinePrecision]), $MachinePrecision], N[(c * N[Log[1 + N[(y * x), $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 = LET tmp_1 = IF (y <= (995537615483347764211430330760776996612548828125e-46)) THEN (((exp(x)) - (1)) * (y * c)) ELSE (c * (ln(((y * x) + (1))))) ENDIF IN LET tmp = IF (y <= (-38416110670124621050889811552578715003109317791449088)) THEN (c * (ln(((y * ((exp(x)) - (1))) + (1))))) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;y \leq -3.841611067012462 \cdot 10^{+52}:\\
\;\;\;\;c \cdot \log \left(\mathsf{fma}\left(y, \mathsf{expm1}\left(x\right), 1\right)\right)\\
\mathbf{elif}\;y \leq 99.55376154833478:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot \mathsf{log1p}\left(y \cdot x\right)\\
\end{array}
if y < -3.8416110670124621e52Initial program 41.0%
Applied rewrites50.5%
if -3.8416110670124621e52 < y < 99.553761548334776Initial program 41.0%
Taylor expanded in y around 0
Applied rewrites73.9%
Applied rewrites77.3%
if 99.553761548334776 < y Initial program 41.0%
Taylor expanded in x around 0
Applied rewrites39.1%
Applied rewrites66.1%
(FPCore (c x y)
:precision binary64
:pre TRUE
(if (<= y -1.702178233584973e+54)
(* c (log (* (expm1 x) y)))
(if (<= y 99.55376154833478)
(* (expm1 x) (* y c))
(* c (log1p (* y x))))))double code(double c, double x, double y) {
double tmp;
if (y <= -1.702178233584973e+54) {
tmp = c * log((expm1(x) * y));
} else if (y <= 99.55376154833478) {
tmp = expm1(x) * (y * c);
} else {
tmp = c * log1p((y * x));
}
return tmp;
}
public static double code(double c, double x, double y) {
double tmp;
if (y <= -1.702178233584973e+54) {
tmp = c * Math.log((Math.expm1(x) * y));
} else if (y <= 99.55376154833478) {
tmp = Math.expm1(x) * (y * c);
} else {
tmp = c * Math.log1p((y * x));
}
return tmp;
}
def code(c, x, y): tmp = 0 if y <= -1.702178233584973e+54: tmp = c * math.log((math.expm1(x) * y)) elif y <= 99.55376154833478: tmp = math.expm1(x) * (y * c) else: tmp = c * math.log1p((y * x)) return tmp
function code(c, x, y) tmp = 0.0 if (y <= -1.702178233584973e+54) tmp = Float64(c * log(Float64(expm1(x) * y))); elseif (y <= 99.55376154833478) tmp = Float64(expm1(x) * Float64(y * c)); else tmp = Float64(c * log1p(Float64(y * x))); end return tmp end
code[c_, x_, y_] := If[LessEqual[y, -1.702178233584973e+54], N[(c * N[Log[N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 99.55376154833478], N[(N[(Exp[x] - 1), $MachinePrecision] * N[(y * c), $MachinePrecision]), $MachinePrecision], N[(c * N[Log[1 + N[(y * x), $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 = LET tmp_1 = IF (y <= (995537615483347764211430330760776996612548828125e-46)) THEN (((exp(x)) - (1)) * (y * c)) ELSE (c * (ln(((y * x) + (1))))) ENDIF IN LET tmp = IF (y <= (-1702178233584973081484216886645222720931570583538237440)) THEN (c * (ln((((exp(x)) - (1)) * y)))) ELSE tmp_1 ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;y \leq -1.702178233584973 \cdot 10^{+54}:\\
\;\;\;\;c \cdot \log \left(\mathsf{expm1}\left(x\right) \cdot y\right)\\
\mathbf{elif}\;y \leq 99.55376154833478:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot \mathsf{log1p}\left(y \cdot x\right)\\
\end{array}
if y < -1.7021782335849731e54Initial program 41.0%
Taylor expanded in y around -inf
Applied rewrites14.9%
Applied rewrites20.2%
if -1.7021782335849731e54 < y < 99.553761548334776Initial program 41.0%
Taylor expanded in y around 0
Applied rewrites73.9%
Applied rewrites77.3%
if 99.553761548334776 < y Initial program 41.0%
Taylor expanded in x around 0
Applied rewrites39.1%
Applied rewrites66.1%
(FPCore (c x y)
:precision binary64
:pre TRUE
(let* ((t_0 (* c (log1p (* y x)))))
(if (<= y -7.393422949122487e+43)
t_0
(if (<= y 99.55376154833478) (* (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 <= -7.393422949122487e+43) {
tmp = t_0;
} else if (y <= 99.55376154833478) {
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 <= -7.393422949122487e+43) {
tmp = t_0;
} else if (y <= 99.55376154833478) {
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 <= -7.393422949122487e+43: tmp = t_0 elif y <= 99.55376154833478: 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 <= -7.393422949122487e+43) tmp = t_0; elseif (y <= 99.55376154833478) 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, -7.393422949122487e+43], t$95$0, If[LessEqual[y, 99.55376154833478], 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 <= (995537615483347764211430330760776996612548828125e-46)) THEN (((exp(x)) - (1)) * (y * c)) ELSE t_0 ENDIF IN LET tmp = IF (y <= (-73934229491224872077948044753781179279212544)) 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 -7.393422949122487 \cdot 10^{+43}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 99.55376154833478:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -7.3934229491224872e43 or 99.553761548334776 < y Initial program 41.0%
Taylor expanded in x around 0
Applied rewrites39.1%
Applied rewrites66.1%
if -7.3934229491224872e43 < y < 99.553761548334776Initial program 41.0%
Taylor expanded in y around 0
Applied rewrites73.9%
Applied rewrites77.3%
(FPCore (c x y)
:precision binary64
:pre TRUE
(let* ((t_0 (* c (log (fma y x 1.0)))))
(if (<= y -3.841611067012462e+52)
t_0
(if (<= y 1.0328160200308696e-7)
(* (expm1 x) (* y c))
(if (<= y 2.160478424677013e+222)
(* c (/ 1.0 (+ (/ 1.0 (* x y)) 0.5)))
t_0)))))double code(double c, double x, double y) {
double t_0 = c * log(fma(y, x, 1.0));
double tmp;
if (y <= -3.841611067012462e+52) {
tmp = t_0;
} else if (y <= 1.0328160200308696e-7) {
tmp = expm1(x) * (y * c);
} else if (y <= 2.160478424677013e+222) {
tmp = c * (1.0 / ((1.0 / (x * y)) + 0.5));
} 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 <= -3.841611067012462e+52) tmp = t_0; elseif (y <= 1.0328160200308696e-7) tmp = Float64(expm1(x) * Float64(y * c)); elseif (y <= 2.160478424677013e+222) tmp = Float64(c * Float64(1.0 / Float64(Float64(1.0 / Float64(x * y)) + 0.5))); 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, -3.841611067012462e+52], t$95$0, If[LessEqual[y, 1.0328160200308696e-7], N[(N[(Exp[x] - 1), $MachinePrecision] * N[(y * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.160478424677013e+222], N[(c * N[(1.0 / N[(N[(1.0 / N[(x * y), $MachinePrecision]), $MachinePrecision] + 0.5), $MachinePrecision]), $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 <= (2160478424677012846016742697099393352274972871161688613699057620255834107666802404002579458789716541521724638036479113449945799823899942166468080351632740731200320379640256799779719631904874743434200681136401303357437771776)) THEN (c * ((1) / (((1) / (x * y)) + (5e-1)))) ELSE t_0 ENDIF IN LET tmp_1 = IF (y <= (10328160200308695549376047408129952742683599353767931461334228515625e-74)) THEN (((exp(x)) - (1)) * (y * c)) ELSE tmp_2 ENDIF IN LET tmp = IF (y <= (-38416110670124621050889811552578715003109317791449088)) 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 -3.841611067012462 \cdot 10^{+52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.0328160200308696 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{elif}\;y \leq 2.160478424677013 \cdot 10^{+222}:\\
\;\;\;\;c \cdot \frac{1}{\frac{1}{x \cdot y} + 0.5}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -3.8416110670124621e52 or 2.1604784246770128e222 < y Initial program 41.0%
Applied rewrites50.5%
Taylor expanded in x around 0
Applied rewrites39.1%
Applied rewrites39.1%
if -3.8416110670124621e52 < y < 1.0328160200308696e-7Initial program 41.0%
Taylor expanded in y around 0
Applied rewrites73.9%
Applied rewrites77.3%
if 1.0328160200308696e-7 < y < 2.1604784246770128e222Initial program 41.0%
Applied rewrites50.5%
Taylor expanded in y around 0
Applied rewrites75.5%
Applied rewrites75.5%
Taylor expanded in x around 0
Applied rewrites57.6%
(FPCore (c x y)
:precision binary64
:pre TRUE
(let* ((t_0 (* c (log (fma y x 1.0)))))
(if (<= y -3.841611067012462e+52)
t_0
(if (<= y 2.1727156459338237e+31)
(* (expm1 x) (* y c))
(if (<= y 2.160478424677013e+222)
(/ c (+ (/ 1.0 (* x y)) 0.5))
t_0)))))double code(double c, double x, double y) {
double t_0 = c * log(fma(y, x, 1.0));
double tmp;
if (y <= -3.841611067012462e+52) {
tmp = t_0;
} else if (y <= 2.1727156459338237e+31) {
tmp = expm1(x) * (y * c);
} else if (y <= 2.160478424677013e+222) {
tmp = c / ((1.0 / (x * y)) + 0.5);
} 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 <= -3.841611067012462e+52) tmp = t_0; elseif (y <= 2.1727156459338237e+31) tmp = Float64(expm1(x) * Float64(y * c)); elseif (y <= 2.160478424677013e+222) tmp = Float64(c / Float64(Float64(1.0 / Float64(x * y)) + 0.5)); 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, -3.841611067012462e+52], t$95$0, If[LessEqual[y, 2.1727156459338237e+31], N[(N[(Exp[x] - 1), $MachinePrecision] * N[(y * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.160478424677013e+222], N[(c / N[(N[(1.0 / N[(x * y), $MachinePrecision]), $MachinePrecision] + 0.5), $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 <= (2160478424677012846016742697099393352274972871161688613699057620255834107666802404002579458789716541521724638036479113449945799823899942166468080351632740731200320379640256799779719631904874743434200681136401303357437771776)) THEN (c / (((1) / (x * y)) + (5e-1))) ELSE t_0 ENDIF IN LET tmp_1 = IF (y <= (21727156459338237462671414788096)) THEN (((exp(x)) - (1)) * (y * c)) ELSE tmp_2 ENDIF IN LET tmp = IF (y <= (-38416110670124621050889811552578715003109317791449088)) 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 -3.841611067012462 \cdot 10^{+52}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.1727156459338237 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{elif}\;y \leq 2.160478424677013 \cdot 10^{+222}:\\
\;\;\;\;\frac{c}{\frac{1}{x \cdot y} + 0.5}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -3.8416110670124621e52 or 2.1604784246770128e222 < y Initial program 41.0%
Applied rewrites50.5%
Taylor expanded in x around 0
Applied rewrites39.1%
Applied rewrites39.1%
if -3.8416110670124621e52 < y < 2.1727156459338237e31Initial program 41.0%
Taylor expanded in y around 0
Applied rewrites73.9%
Applied rewrites77.3%
if 2.1727156459338237e31 < y < 2.1604784246770128e222Initial program 41.0%
Applied rewrites50.5%
Taylor expanded in y around 0
Applied rewrites75.5%
Applied rewrites75.5%
Taylor expanded in x around 0
Applied rewrites57.6%
(FPCore (c x y)
:precision binary64
:pre TRUE
(let* ((t_0 (/ c (+ (/ 1.0 (* x y)) 0.5))))
(if (<= y -936934.8727253214)
t_0
(if (<= y 2.1727156459338237e+31) (* (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 <= -936934.8727253214) {
tmp = t_0;
} else if (y <= 2.1727156459338237e+31) {
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 <= -936934.8727253214) {
tmp = t_0;
} else if (y <= 2.1727156459338237e+31) {
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 <= -936934.8727253214: tmp = t_0 elif y <= 2.1727156459338237e+31: 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 <= -936934.8727253214) tmp = t_0; elseif (y <= 2.1727156459338237e+31) 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, -936934.8727253214], t$95$0, If[LessEqual[y, 2.1727156459338237e+31], 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 <= (21727156459338237462671414788096)) THEN (((exp(x)) - (1)) * (y * c)) ELSE t_0 ENDIF IN LET tmp = IF (y <= (-9369348727253214456140995025634765625e-31)) 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 -936934.8727253214:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 2.1727156459338237 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y < -936934.87272532145 or 2.1727156459338237e31 < y Initial program 41.0%
Applied rewrites50.5%
Taylor expanded in y around 0
Applied rewrites75.5%
Applied rewrites75.5%
Taylor expanded in x around 0
Applied rewrites57.6%
if -936934.87272532145 < y < 2.1727156459338237e31Initial program 41.0%
Taylor expanded in y around 0
Applied rewrites73.9%
Applied rewrites77.3%
(FPCore (c x y) :precision binary64 :pre TRUE (if (<= y 99.55376154833478) (* (expm1 x) (* y c)) (* c (* x y))))
double code(double c, double x, double y) {
double tmp;
if (y <= 99.55376154833478) {
tmp = expm1(x) * (y * c);
} else {
tmp = c * (x * y);
}
return tmp;
}
public static double code(double c, double x, double y) {
double tmp;
if (y <= 99.55376154833478) {
tmp = Math.expm1(x) * (y * c);
} else {
tmp = c * (x * y);
}
return tmp;
}
def code(c, x, y): tmp = 0 if y <= 99.55376154833478: tmp = math.expm1(x) * (y * c) else: tmp = c * (x * y) return tmp
function code(c, x, y) tmp = 0.0 if (y <= 99.55376154833478) tmp = Float64(expm1(x) * Float64(y * c)); else tmp = Float64(c * Float64(x * y)); end return tmp end
code[c_, x_, y_] := If[LessEqual[y, 99.55376154833478], N[(N[(Exp[x] - 1), $MachinePrecision] * N[(y * c), $MachinePrecision]), $MachinePrecision], 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 = LET tmp = IF (y <= (995537615483347764211430330760776996612548828125e-46)) THEN (((exp(x)) - (1)) * (y * c)) ELSE (c * (x * y)) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;y \leq 99.55376154833478:\\
\;\;\;\;\mathsf{expm1}\left(x\right) \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(x \cdot y\right)\\
\end{array}
if y < 99.553761548334776Initial program 41.0%
Taylor expanded in y around 0
Applied rewrites73.9%
Applied rewrites77.3%
if 99.553761548334776 < y Initial program 41.0%
Taylor expanded in x around 0
Applied rewrites56.1%
(FPCore (c x y) :precision binary64 :pre TRUE (* c (* y (expm1 x))))
double code(double c, double x, double y) {
return c * (y * expm1(x));
}
public static double code(double c, double x, double y) {
return c * (y * Math.expm1(x));
}
def code(c, x, y): return c * (y * math.expm1(x))
function code(c, x, y) return Float64(c * Float64(y * expm1(x))) end
code[c_, x_, y_] := N[(c * N[(y * N[(Exp[x] - 1), $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 * (y * ((exp(x)) - (1))) END code
c \cdot \left(y \cdot \mathsf{expm1}\left(x\right)\right)
Initial program 41.0%
Taylor expanded in y around 0
Applied rewrites73.9%
(FPCore (c x y) :precision binary64 :pre TRUE (* (copysign 1.0 c) (if (<= (fabs c) 9.39689729946558e+89) (* x (* y (fabs c))) (* y (* x (fabs c))))))
double code(double c, double x, double y) {
double tmp;
if (fabs(c) <= 9.39689729946558e+89) {
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) <= 9.39689729946558e+89) {
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) <= 9.39689729946558e+89: 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) <= 9.39689729946558e+89) 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) <= 9.39689729946558e+89) 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], 9.39689729946558e+89], 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 9.39689729946558 \cdot 10^{+89}:\\
\;\;\;\;x \cdot \left(y \cdot \left|c\right|\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \left|c\right|\right)\\
\end{array}
if c < 9.3968972994655796e89Initial program 41.0%
Taylor expanded in x around 0
Applied rewrites56.1%
Applied rewrites62.2%
if 9.3968972994655796e89 < c Initial program 41.0%
Taylor expanded in x around 0
Applied rewrites56.1%
Applied rewrites59.3%
(FPCore (c x y) :precision binary64 :pre TRUE (if (<= y 2.4520640965510156e-27) (* x (* y c)) (* c (* x y))))
double code(double c, double x, double y) {
double tmp;
if (y <= 2.4520640965510156e-27) {
tmp = x * (y * c);
} else {
tmp = c * (x * y);
}
return tmp;
}
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
real(8) :: tmp
if (y <= 2.4520640965510156d-27) then
tmp = x * (y * c)
else
tmp = c * (x * y)
end if
code = tmp
end function
public static double code(double c, double x, double y) {
double tmp;
if (y <= 2.4520640965510156e-27) {
tmp = x * (y * c);
} else {
tmp = c * (x * y);
}
return tmp;
}
def code(c, x, y): tmp = 0 if y <= 2.4520640965510156e-27: tmp = x * (y * c) else: tmp = c * (x * y) return tmp
function code(c, x, y) tmp = 0.0 if (y <= 2.4520640965510156e-27) tmp = Float64(x * Float64(y * c)); else tmp = Float64(c * Float64(x * y)); end return tmp end
function tmp_2 = code(c, x, y) tmp = 0.0; if (y <= 2.4520640965510156e-27) tmp = x * (y * c); else tmp = c * (x * y); end tmp_2 = tmp; end
code[c_, x_, y_] := If[LessEqual[y, 2.4520640965510156e-27], N[(x * N[(y * c), $MachinePrecision]), $MachinePrecision], 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 = LET tmp = IF (y <= (245206409655101562430941493959943172426255612604679907674416304549911186337618484998301937594078481197357177734375e-140)) THEN (x * (y * c)) ELSE (c * (x * y)) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;y \leq 2.4520640965510156 \cdot 10^{-27}:\\
\;\;\;\;x \cdot \left(y \cdot c\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(x \cdot y\right)\\
\end{array}
if y < 2.4520640965510156e-27Initial program 41.0%
Taylor expanded in x around 0
Applied rewrites56.1%
Applied rewrites62.2%
if 2.4520640965510156e-27 < y Initial program 41.0%
Taylor expanded in x around 0
Applied rewrites56.1%
(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.0%
Taylor expanded in x around 0
Applied rewrites56.1%
(FPCore (c x y) :precision binary64 :pre TRUE (/ c 0.5))
double code(double c, double x, double y) {
return c / 0.5;
}
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 / 0.5d0
end function
public static double code(double c, double x, double y) {
return c / 0.5;
}
def code(c, x, y): return c / 0.5
function code(c, x, y) return Float64(c / 0.5) end
function tmp = code(c, x, y) tmp = c / 0.5; end
code[c_, x_, y_] := N[(c / 0.5), $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 / (5e-1) END code
\frac{c}{0.5}
Initial program 41.0%
Applied rewrites50.5%
Taylor expanded in y around 0
Applied rewrites75.5%
Applied rewrites75.5%
Taylor expanded in y around inf
Applied rewrites6.3%
(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 2026084
(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)))))