Bug 132158 - log function gives wrong value for number more than 10^308
Summary: log function gives wrong value for number more than 10^308
Status: RESOLVED FIXED
Alias: None
Product: kcalc
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Evan Teran
URL:
Keywords:
: 138168 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-08-09 20:36 UTC by Jagadish R
Modified: 2019-06-23 10:22 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 19.08.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jagadish R 2006-08-09 20:36:24 UTC
Version:           2.0.2 (using KDE 3.5.2, Gentoo)
Compiler:          gcc version 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
OS:                Linux (i686) release 2.6.15-gentoo-r1

log(10^m) = m. In kcalc if m is more than 308, log function gives the wrong answer. For example, Log(10^309) gives 1.797693134862315908e+308
Comment 1 Klaus Niederkrüger 2007-01-16 09:27:58 UTC
*** Bug 138168 has been marked as a duplicate of this bug. ***
Comment 2 Markus Grob 2008-02-28 21:17:42 UTC
I think this is, because the result is stored in a double and they have an upper limit from 1.79769313486231 57E+308.
I now, this isn't a solution, but a possible reason.
Comment 3 David Johnson 2008-12-09 05:14:24 UTC
Many functions use standard C math functions taking double values. The fix will require changes to the underlying math engine (currently based on libgmp).
Comment 4 Evan Teran 2013-01-14 22:04:53 UTC
The kcalc which will ship with KDE 4.10 has a newly rewritten knumber core library, which aims to make things simpler and easier to code with.

After the 4.10 release, I will start to work on using MPFR (A high precision math library which can do trig functions with GMP types). Some work has already been done in this area, but I wanted to minimize the changes in this release to make it easier to find any regressions. Hopefully the following release will have support for higher precision trig functions :-).
Comment 5 Christoph Feck 2019-06-23 10:22:49 UTC
Git commit 2a05545830fdc9a2fe6a1d249d9eff52c53b7d1f by Christoph Feck, on behalf of Marcelo Mariano.
Committed on 23/06/2019 at 10:21.
Pushed by cfeck into branch 'master'.

Use MPFR in knumber_float in order to improve floating-point precision
Related: bug 148357, bug 407318
FIXED-IN: 19.08.0

Differential Revision: https://phabricator.kde.org/D21495

M  +8    -0    CMakeLists.txt
M  +2    -2    knumber/knumber.cpp
M  +0    -3    knumber/knumber_base.h
M  +80   -415  knumber/knumber_float.cpp
M  +14   -8    knumber/knumber_float.h
M  +8    -1    knumber/knumber_integer.cpp
M  +3    -2    knumber/tests/CMakeLists.txt

https://commits.kde.org/kcalc/2a05545830fdc9a2fe6a1d249d9eff52c53b7d1f