[Bug c/56651] New: sin() and tan() has different values during compile time and run time.

2013-03-18 Thread sergey.s at samsung dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56651



 Bug #: 56651

   Summary: sin() and tan() has different values during compile

time and run time.

Classification: Unclassified

   Product: gcc

   Version: 4.6.3

Status: UNCONFIRMED

  Severity: minor

  Priority: P3

 Component: c

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: serge...@samsung.com





Created attachment 29689

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29689

Source code with sine test



Sources with test cases are attached.

Current output:

Compile-time value of sine is -2.44929359829470641e-16

Runtime value of sine is -2.44921270764475452e-16



Compile-time value of tangent is -1.63312393531953700e+16

Runtime value of tangent is -1.63317787283838440e+16


[Bug c/56651] sin() and tan() has different values during compile time and run time.

2013-03-18 Thread sergey.s at samsung dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56651



--- Comment #1 from sergey.s at samsung dot com 2013-03-18 09:50:25 UTC ---

Created attachment 29690

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29690

Source code with tangent test


[Bug c/56651] sin() and tan() have different values during compile time and run time.

2013-03-18 Thread sergey.s at samsung dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56651



--- Comment #3 from sergey.s at samsung dot com 2013-03-18 11:06:55 UTC ---

(In reply to comment #2)

> For what target is this?

x86, host also is x86.


[Bug c/70523] New: Inconsistent casting of floats to unsigned short

2016-04-04 Thread sergey.s at samsung dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70523

Bug ID: 70523
   Summary: Inconsistent casting of floats to unsigned short
   Product: gcc
   Version: 4.8.4
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: sergey.s at samsung dot com
  Target Milestone: ---

Created attachment 38171
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38171&action=edit
Test program

Casting of float expression to unsigned short gives different result when cast
is performed via intermediate variable. Specifically:

#include 

int main()
{
float f = 1.7857142687f;
printf("%.10f\n", f);
unsigned short b = 28;
unsigned short a = (unsigned short)(b * f);
printf("%u\n", a);
float temp = b * f;
a = (unsigned short)temp;
printf("%u\n", a);
return 0;
}
Output:
1.7857142687
49
50
Reproduced only for 32-bit compilation.
On 64-bit compilers both outputs are 50.
Optimization level shall be default.
If optimization level is -O2 or higher both outputs are 50.
Similar to bug 47297, but here value of float expression is well within range
of unsigned short, so behaviour should be defined.