Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 520087 Details for
Bug 733372
three-dotted range using floats doesn't work properly on i386
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh92 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
updated Vit's reproducer - more generic solution
bz733372.c (text/plain), 2.77 KB, created by
Aleš Mareček
on 2011-08-26 13:14:18 UTC
(
hide
)
Description:
updated Vit's reproducer - more generic solution
Filename:
MIME Type:
Creator:
Aleš Mareček
Created:
2011-08-26 13:14:18 UTC
Size:
2.77 KB
patch
obsolete
>/* > * Description: It tests behaviour of "ruby's range" > * Author: Vit Ondruch <vondruch@redhat.com> > * Updates: Ales Marecek <amarecek@redhat.com> > * > * INSTALLATION: > * Standard compilation (should reproduce the bug): gcc -lm bz733372.c -o bz733372 > * FLOAT_STORE compilation (should pass everytime): gcc -lm -ffloat-store bz733372.c -o bz733372 > * RUN: > * ./bz733372 > * ./bz733372 <end value> <step> > * > * Copyright (c) 2011 Red Hat, Inc. All rights reserved. > * > * This copyrighted material is made available to anyone wishing > * to use, modify, copy, or redistribute it subject to the terms > * and conditions of the GNU General Public License version 2. > * > * This program is distributed in the hope that it will be > * useful, but WITHOUT ANY WARRANTY; without even the implied > * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR > * PURPOSE. See the GNU General Public License for more details. > * > * You should have received a copy of the GNU General Public > * License along with this program; if not, write to the Free > * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, > * Boston, MA 02110-1301, USA. > */ > >#include <float.h> >#include <math.h> >#include <stdio.h> >#include <stdlib.h> > >int main(int argc, char** argv) >{ > const double epsilon = DBL_EPSILON; > double beg = 1.0; > double end = 9.4; > double unit = 1.2; > double n = 0.0, n_raw = 0.0; > double err = (fabs(beg) + fabs(end) + fabs(end-beg)) / fabs(unit) * epsilon; > double i = 1.0; > int counter = 1, n_counter = 0; > > if (argc > 1 && ((strcmp(*(argv + 1), "--help") == 0) || (strcmp(*(argv + 1), "-h") == 0))) { > fprintf(stdout, "Usage: %s [<end> <step>]\n", *argv); > return(0); > } > if (argc > 2) { > end = atof(*(argv + 1)); > unit = atof(*(argv + 2)); > } else if (argc > 1) { > end = atof(*(argv + 1)); > } > if (end < unit) { > fprintf(stderr, "ERROR: The step value is greater than the end value!\n"); > return(1); > } > n = (end - beg)/unit; > n_raw = n; > n_counter = (int) n; > > printf("epsilon: %.50f\n", epsilon); > printf("begin: %.50f\n", beg); > printf("end: %.50f\n", end); > printf("unit: %.50f\n", unit); > printf("n: %.50f\n", n); > printf("err: %.50f\n", err); > > if (err>0.5) err=0.5; > n = floor(n + err); > > printf("floor n: %.50f\n", n); > printf("long n: %.50f\n", ((long)n)*unit+beg); > > if (((long)n)*unit+beg < end) n++; > > if (n_counter < 1) { > n_counter = 1; > } else if (((int) ((n_raw - n_counter) * 10)) > 0) { > n_counter = (int) n; > } > > printf("corrected n: %.50f\n", n); > printf("\n", n); > > for (i = 0; i < n; i = i + 1.0, counter++) { > printf("%d. %.50f\n", counter, i*unit+beg); > } > counter--; > fprintf(stdout, "\nITERATIONS: %d\n", counter); > if (n_counter != counter) { > fprintf(stdout, "Test FAILED.\n"); > return(1); > } > fprintf(stdout, "Test PASSED.\n"); > return(0); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 733372
:
520039
| 520087 |
520552