## #2654 error in precision

None
closed
nobody
1
2013-11-05
2013-11-01
Jolt
No

fpprec:40\$?fpprec;
solve(bfloat(1.56345645645747363237237010754790112312)=bfloat(x));

i get 'rat' replaced but always precision is wrong. Never x is not exactly my number in any precision.

## Discussion

• Robert Dodier
2013-11-01

bfloat(1.56345645645747363237237010754790112312) will read a float and then create an equivalent bigfloat. So it will have 16 digits precision, despite the additional digits in the input. Maybe you mean 1.56345645645747363237237010754790112312b0.

I can't tell what you're trying to do. Can you please explain in greater detail.

• Jolt
2013-11-01

ok,

(%i4) fpprec:40\$?fpprec;
(%o5) 135
solve(bfloat(1.56345645645747363237237010754790112312)=bfloat(x));
`rat' replaced 1.563456456457473553456338777323253452778B0 by 50742009/32455019 = 1.563456456457474266152794426033150681563B0
50742009
(%o6) [x = --------]
32455019

rat replace
1.563456456457473553456338777323253452778B0 by 50742009/32455019 = 1.563456456457474266152794426033150681563B0

this is not this same number
1.56345645645747 3553456338777323253452778B0
1.56345645645747 4266152794426033150681563B0
______^ different

If I change precision nothing happened. I alvays get different in this same place.

Last edit: Jolt 2013-11-01

• Robert Dodier
2013-11-01

(1) as I said before, bfloat(nnnn.nnn) is not the same as nnnn.nnnb0. I think you want nnnn.nnnb0.

(2) rat observes a value ratepsilon when it converts to rational. Default ratepsilon is 2e-15. Try ratepsilon:0 and try it again.

• Jolt
2013-11-01

How? setup (2)?

I need rationalize with many digit , huge precision

• Robert Dodier
2013-11-04

I don't understand what you're trying to do. Please take this discussion to the Maxima mailing list (maxima@math.utexas.edu; see http://maxima.sf.net/maximalist.html). I'm closing this report as it is not a bug report.

• Robert Dodier
2013-11-04

• labels: --> not-a-bug
• status: open --> closed

• Robert Dodier
2013-11-05

I've thought about it some more and here's my best guess as to what you want.

```(%i1) display2d : false \$
(%i2) ratepsilon : 0 \$
(%i3) fpprec : 300 \$
(%i4) x : 1.56345645645747363237237010754790112312b0 \$
(%i5) rat_x : rat (x);
`rat' replaced 1.56345645645747363237237010754790112312B0 by 19543205705718420404654626344348764039/12500000000000000000000000000000000000 = 1.56345645645747363237237010754790112312B0
(%o5) 19543205705718420404654626344348764039/12500000000000000000000000000000000000
(%i6) is (x = bfloat (rat_x));
(%o6) true
(%i7) x - bfloat (rat_x);
(%o7) 0.0b0
```

Note that `x` has "b0" at the end to show it is a bigfloat.

Hope this helps.