Hi! First of all, I am not at all a crypto expert.

I am trying to compare two numbers of any length. I am doing so by arranging the digits in each number inside a vector of FheUint4 shortints. So, each of these elements goes from 0 to 9, so I don’t use the total range of the 4 bit integer ciphertext.

I use two instances of the PBS feature in Concrete in my code: The OtherLT::set_lowest() and the OtherLT::compare() in the following code:

```
fn operate(number_a: Vec<FheUint4>, number_b: Vec<FheUint4>, client_key: &ClientKey) -> FheUint4 {
let mut order: FheUint4 = (number_a.first().unwrap() * 0u8).clone();
for (digit_a, digit_b) in number_a.iter().zip(number_b.iter()) {
let _order = digit_a.bivariate_function(digit_b, OtherLT::compare);
println!("//\nOrder: {}, Comparing ({},{}), _order: {}", order.decrypt(&client_key), digit_a.decrypt(&client_key), digit_b.decrypt(&client_key), _order.decrypt(&client_key));
order = order.bivariate_function(&_order, OtherLT::set_lowest);
println!("Order: {}\n", order.decrypt(&client_key));
}
order
}
```

Here I go through each pair of digits from left to right and compare them to see which is the bigger one. Then, I store it in the “order” variable which is a way of setting for the rest of the loop which number is the smaller one.

The functions that are being used for the PBS are:

```
fn compare(a: u8, b: u8) -> u8 {
if a > b {
2
} else if a < b {
1
} else {
0
}
}
fn set_lowest(order: u8, _order: u8) -> u8 {
if order != 0 {
order
} else {
_order
}
}
```

The compare LUT evaluation seems to be working correctly, but the set_lowest is not:

Here is a screenshot of some debug messages showing the comparison between the numbers 352 000 010 and 252 000 012. I would expect the "Order: " to print 2 in the second iteration after evaluating the set_lowest() the second time, since in that instance the “order” variable is 2, if 2 != 0 should evaluate to returning the “order” value. The exact same python code (working on unencrypted) data returns the correct results, so I assume that the logic is correct but I am missing something crypto related or Concrete related.

Any help would be much appreciated, Thank you!!