Improve integer powers of 10 - ( relevant for rounding, truncing, flooring ... and thus for nearly all math )
If use of some mem- and disk-space is tolerable I'd propose to enlarge the pow10-tables in goffice/goffice/math/go-math.c/pow10 and ~pow10l.
pro: speedy and correct integer powers of ten. ( As of now gnumeric-long-std. has some 800++ fails among ~9800 powers, see attached sheets. )
powers by 'power( 10, i )' - t0613d_power10.gnumeric
powers by '10^i' - t0613e_power10.gnumeric
patches see below, change goffice/goffice/math/go-math.c and re- 'make', re- 'make install' of goffice is sufficient to get them into effect.
table_for_pow10.txt
table_for_pow10l.txt
contra: the patches boost go-math.o from ~85,056 to ~318,184 bytes. evtl. someone can make the loading conditional acc. the datatype in use?
[edit 2022-10-11 subject and tests]
additional thoughts and explanation: Click to expand
motivation and impact: Morten made go_pow10: improve accuracy. for gnumeric issue #591, deco-Math project, step 00_a: exact bin and dec 'ranges' (in gnumeric). - enhancement request -.
That doesn't cover the full range of values, as I consider correct powers important reg. use in other corrective functions I added some 'string-math improved' powers in goffice and worked with them for some time.
With below tests I saw them slow by ~1.5 sec. vs. ~1.0 sec. in std.-gnumeric. ( The tests calculate some ~75k powers and respond with the time it took to re-calculate the sheets. Place the sample sheets in a new subdir 'deco-math' in 'samples' to run the tests. ) ( don't be surprised about the somewhat weak performance of my system, it completely runs from an USB stick. )
testing and timing 'power( 10, x )' - t0613d-power10.pl
testing and timing '10^x' - t0613e-power10.pl
I tried to enlarge the tables and see competitive speed while only one binary wasting some space.
There is some stray in the timing results, but I see them precise enough to have '10^i' a little faster than 'power( 10, i )' in most tries - longer code path - and see the patched tables sometimes a little but neglectable slower than c-code 'pow', but with better accuracy.
Made a new issue as the original question was in git-gnumeric and I found no issue# in goffice corresponding to the patch from Morten.