Bug 132508 - Libre calc - The COS function seems not to give the right result
Summary: Libre calc - The COS function seems not to give the right result
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.1.6.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-29 00:49 UTC by Ramdan
Modified: 2020-04-29 12:10 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshots of some cells illustrating the cos (and sin ) function (119.77 KB, image/png)
2020-04-29 00:54 UTC, Ramdan
Details
LibreOffice 6.1 and the result of Cosinus(180) (41.72 KB, image/png)
2020-04-29 02:33 UTC, Bart
Details
LibreOffice 7.0 and the result of Cosinus(180) (44.34 KB, image/png)
2020-04-29 02:34 UTC, Bart
Details
Cells with COS and SIN functions for some numbers (part1) (35.53 KB, image/png)
2020-04-29 04:39 UTC, Ramdan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ramdan 2020-04-29 00:49:19 UTC
Description:
I applied to some cells the COS and even SIN function (i do no try other trigonometric function) and i was surprised by the outputs ! Very annoying !!! 
So I'm wondering if there is something I'm missing that any of you would care to fill in for me ?
I noticed that on two different distros ! 

Steps to Reproduce:
1.Choose a cell
2.type i;e; "=COS(180)" or "=COS(any cell filled by a number)"
3.Enter

Actual Results:
-0,5984600691


Expected Results:
-1


Reproducible: Always


User Profile Reset: No



Additional Info:
Is that happened only on my machine, or someone can confirm that's a bug ? Thanks.
I've just tried SIN and it seems the same thing as COS !

Version: 5.1.6.2
Build ID: 1:5.1.6~rc2-0ubuntu1~xenial10
Threads CPU : 8; Version de l'OS :Linux 4.4; UI Render : par défaut; 
Locale : fr-FR (fr_FR.UTF-8); Calc: group
Comment 1 Ramdan 2020-04-29 00:54:29 UTC
Created attachment 160049 [details]
Screenshots of some cells illustrating the cos (and sin ) function
Comment 2 Bart 2020-04-29 02:30:50 UTC
I followed Ramdan's steps and I can confirm that I had the same result in LibreOffice 6.1 and LibreOffice 7.0

PS: 
I'm not a developer. I submitted a few bugs and I thought I'd help by trying to confirm other bugs. ;-)

				~~~

Version: 6.1.5.2
Build ID: 1:6.1.5-3+deb10u5
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk2; 
Locale: en-US (en_US.UTF-8); Calc: group threaded

Version: 7.0.0.0.alpha0+
Build ID: 4d03bd252274308f64332e7c0523068c38ac684a
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2020-04-26_05:59:56
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded
Comment 3 Bart 2020-04-29 02:33:37 UTC
Created attachment 160051 [details]
LibreOffice 6.1 and the result of Cosinus(180)
Comment 4 Bart 2020-04-29 02:34:49 UTC
Created attachment 160052 [details]
LibreOffice 7.0 and the result of Cosinus(180)
Comment 5 Ming Hua 2020-04-29 04:19:58 UTC
Well, trignometric functions in Calc use radians instead of degrees for its angle parameters.  So for the cosine of 180 degrees you need "COS(RADIANS(180))" which gives the correct result -1.

This is well documented in both the tooltip information for Calc functions, and Help documentation.  I believe MS Excel has the same behavior.

I know there is a bug with more detailed information on this bugzilla, but I can't find it right now.  Regardless, this is either NOTABUG or WONTFIX.
Comment 6 Ramdan 2020-04-29 04:39:17 UTC
Created attachment 160053 [details]
Cells with COS and SIN functions for some numbers (part1)
Comment 7 Ramdan 2020-04-29 04:56:31 UTC
Ming Hua you're right, i missed this. In my mind it was degrees based. I'm reassured. Thanks a lot Bart and Ming Hua.
Then now, as i'm not, like Bart, a developper what may i do to close this non-bug ?
Anyway i can suggest that when you enter the cos function with fx, that we should be able to choose between degrees or radians to be more appropriate and permit non expert people to directly check degrees or radians, no ? Maybe is it too tedious ? Should i fill a "new bug" with enhancement option to suggest this ?
Thanks both.
Comment 8 Bart 2020-04-29 12:00:41 UTC
One thing is for sure ...

we probably want to prevent that someone creates a spreadsheet with a cell containing a "=cos(1)", save it with LibreOffice Calc as a .xls, while LibreOffice Calc has been interpreting the 1 as a degree, but then MS Excel is interpreting the same 1 as a radius ... ;-)

If that user is a civil engineer, we could get funny bridges. :-D
Comment 9 Ming Hua 2020-04-29 12:10:25 UTC
(In reply to Ramdan from comment #7)
> Anyway i can suggest that when you enter the cos function with fx, that we
> should be able to choose between degrees or radians to be more appropriate
> and permit non expert people to directly check degrees or radians, no ?
> Maybe is it too tedious ? Should i fill a "new bug" with enhancement option
> to suggest this ?
I'm not a developer either, just doing some QA work on bugzilla.

From my experience, while your suggestion is reasonable, it would require a lot of work and without an interested developer, such discussions are usually fruitless.  Still, you are free to make your argument, either here or as a new "request for enhancement" bug, but make sure to search the bugzilla to see if such request has been made before.