https://bugs.documentfoundation.org/show_bug.cgi?id=140909

            Bug ID: 140909
           Summary: calc: calculation: basic macro: wrapping function
                    (rawsubtract) wrong result - different than use in
                    sheet
           Product: LibreOffice
           Version: 6.2.8.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: newbie...@gmx.de

Description:
hello, 

i'm trying to do some 'exact' calculations with calc, and 'rawsubtract'
sometimes helps me to avoid idiosyncratic 'rounding' of calc, 
now i wanted to automate something like this the other day, and 'rawsubtract'
is unfortunately not available in basic macros, 
but you can 'wrap' it in a 'unoservice-function-access-call' like in the
example below, and then use it in basic macros (i'd read somewhere and it works
fine so far, for other functions as well as for rawsubtract), 
but for certain values e.g. 
'=RAWSUBTRACT_A(33,0000000000001;3,0000000000001)' delivers 
29,99999999999990000000 as result, while 
'=RAWSUBTRACT_A(33,0000000000001;3,0000000000001)' correctly calculates to 
30,00000000000000000000  
so there is a worm in there somewhere, but i can't find where :-( 
since it's an elementary worm - elementary functions don't work - i think it's
important to get rid of it and would be happy if a dev would look for it ... 

------------ 
function rawsubtract_a (ByVal darg1 as Double, darg2 as Double)
'bs: 2021-03-09
'make "RAWSUBTRACT" functionality accessible from basic macros, 
oFunctionAccess = createUnoService( "com.sun.star.sheet.FunctionAccess")
result = oFunctionAccess.callFunction( "RAWSUBTRACT", array(darg1, darg2)) 
rawsubtract_a = result
end function 'rawsubtract_a
------------

yet investigated: args look well in basic, result is wrong in already in macro,
thus less likely a 'handover problem'? result is exactly 1E-13 off while having
capa (granularity) to store values with 1E-14 precision (in the bits / digits
not shown in the sheet but accessible with appr. 'rawsubtract'), 

Steps to Reproduce:
1. place the macro in your macro collection, 
2. key '=RAWSUBTRACT(33,0000000000001;3,0000000000001)' in a cell, 
3. observe result: 30,00000000000000000000, correct
4. key '=RAWSUBTRACT_A(33,0000000000001;3,0000000000001)' in a cell, 
5. observe result: 29,99999999999990000000, wrong

Actual Results:
29,99999999999990000000

Expected Results:
30,00000000000000000000


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 722ec600e85cca2e94e82e69f8d13773061172b9
CPU threads: 8; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: default;
VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc:

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to