Nervous ticks in C - a reminder of the cruel logic of logic [Software]

posted by mittyri – Russia, 2018-03-15 12:55 (2504 d 03:42 ago) – Posting: # 18552
Views: 7,481

Hi ElMaestro,

very strange
using your code
#include <stdio.h>
int Test10001(double x, double dx)
{
    double xmax;
    xmax=dx*ceil(x/dx);
    x=0.0;
    while (x<=xmax)
    {
        printf("x=%f\n",x);
        x=x+dx;
    }
    return(0);
}

int main()
{
    double x = 0.234567;
    double dx = 0.05;
    Test10001(x, dx);
    return(0);
}


in
https://www.onlinegdb.com/online_c_compiler

I got
x=0.000000
x=0.050000
x=0.100000
x=0.150000
x=0.200000
x=0.250000
as it should be
:confused:

Kind regards,
Mittyri

Complete thread:

UA Flag
Activity
 Admin contact
23,363 posts in 4,906 threads, 1,675 registered users;
133 visitors (0 registered, 133 guests [including 14 identified bots]).
Forum time: 16:38 CET (Europe/Vienna)

The combination of some data and an aching desire
for an answer does not ensure that a reasonable answer
can be extracted from a given body of data.    John W. Tukey

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5