daphne-eu / daphne

DAPHNE: An Open and Extensible System Infrastructure for Integrated Data Analysis Pipelines
Apache License 2.0
68 stars 62 forks source link

Warning for data type "mistakes" #805

Open corepointer opened 3 months ago

corepointer commented 3 months ago

I ran into a bug (in my script, not in DAPHNE itself) that could have been prevented with a compiler warning. The following returned 0 instead of 1 because of unintentional behavior due to wrong data types used:

  N = nrow(X); # in my case N is 20
  batch_size = 128;
  iters = ceil(N / batch_size);

Since the division already returned 0 due to integer types used, ceil() did not have any effect. I worked around the problem with batch_size = 128.0;. The compiler could have warned me about the situation. Either on integer division or on putting integer into ceil().

corepointer commented 3 months ago

This could be a similar problem like #776