Question: Before anything, I'll show you my table:

![post_tags](https://i.stack.imgur.com/OnHoi.png)

(In the context of PHP)  

I'd like to create a multidimensional array via a query - So that a group of *tags* with the same *id* will end up in the same place:

```
<?php

  // Given the above example table, it would essentially produce this:

  $my_1 = array
            ( array('ect'),
              array('123', 'tag'),
              array('lolly', 'hat')
            );

```

Is that a possibility? I've achieved the same result by looping through queries, but it's terribly inefficient.

Answer: 
Truncation vs. rounding.

Due to subtle rounding effect of FP arithmetic, the product `nol * noc` may be slightly less than an integer value. Conversion to `int` results in fractional truncation. Suggest rounding before conversion to `int`.

```
#include <math.h>

int result = (int) roundf(nol * noc);

```
```
the significant problem(s) are:
1) mixing floating point and double with integer math
   --so the compiler promotes all the math to float (or double)
2) not all numbers can be expressed exactly in float
3) --the initialization of min, max, step are taking double literals 
   and converting them to float  
   --even double cannot express all values exactly
   --some precision is lost when performing the conversion from double to float 
4) this code excerpt:  (rank + 1) / total is always = 1
   --(although the many conversions may result in being 'not exactly' 1)
5) argc and argv are not referenced in your code.
   --this, given that all warnings are enabled, will rise two warnings
     at compile time about unused parameters
6) this line in your code is not correct syntax 
   --(although the compiler might not complain) #include<stdio.h>  
   --it should be #include <stdio.h>
   --sometimes spaces count, sometimes they dont

```