Average Error: 0.1 → 0.1
Time: 6.0s
Precision: binary64
Cost: 6784
$\frac{{d}^{3}}{3} + d$
$d + \frac{{d}^{3}}{3}$
(FPCore (d) :precision binary64 (+ (/ (pow d 3.0) 3.0) d))
(FPCore (d) :precision binary64 (+ d (/ (pow d 3.0) 3.0)))
double code(double d) {
return (pow(d, 3.0) / 3.0) + d;
}

double code(double d) {
return d + (pow(d, 3.0) / 3.0);
}

real(8) function code(d)
real(8), intent (in) :: d
code = ((d ** 3.0d0) / 3.0d0) + d
end function

real(8) function code(d)
real(8), intent (in) :: d
code = d + ((d ** 3.0d0) / 3.0d0)
end function

public static double code(double d) {
return (Math.pow(d, 3.0) / 3.0) + d;
}

public static double code(double d) {
return d + (Math.pow(d, 3.0) / 3.0);
}

def code(d):
return (math.pow(d, 3.0) / 3.0) + d

def code(d):
return d + (math.pow(d, 3.0) / 3.0)

function code(d)
return Float64(Float64((d ^ 3.0) / 3.0) + d)
end

function code(d)
return Float64(d + Float64((d ^ 3.0) / 3.0))
end

function tmp = code(d)
tmp = ((d ^ 3.0) / 3.0) + d;
end

function tmp = code(d)
tmp = d + ((d ^ 3.0) / 3.0);
end

code[d_] := N[(N[(N[Power[d, 3.0], $MachinePrecision] / 3.0),$MachinePrecision] + d), $MachinePrecision]  code[d_] := N[(d + N[(N[Power[d, 3.0],$MachinePrecision] / 3.0), $MachinePrecision]),$MachinePrecision]

\frac{{d}^{3}}{3} + d

d + \frac{{d}^{3}}{3}


Try it out

Results

 In Out
Enter valid numbers for all inputs

Derivation

1. Initial program 0.1

$\frac{{d}^{3}}{3} + d$
2. Simplified0.1

$\leadsto \color{blue}{d + \frac{{d}^{3}}{3}}$
3. Final simplification0.1

$\leadsto d + \frac{{d}^{3}}{3}$

Alternatives

Alternative 1
Error0.1
Cost576
$d \cdot \left(\left(d \cdot d\right) \cdot 0.3333333333333333 + 1\right)$
Alternative 2
Error0.1
Cost576
$d + d \cdot \left(\left(d \cdot d\right) \cdot 0.3333333333333333\right)$
Alternative 3
Error0.1
Cost576
$d + \left(d \cdot d\right) \cdot \left(d \cdot 0.3333333333333333\right)$
Alternative 4
Error15.0
Cost64
$d$

Reproduce

herbie shell --seed 1
(FPCore (d)
:name "d^3/3 + d "
:precision binary64
(+ (/ (pow d 3.0) 3.0) d))