Re: [go-nuts] behavior of %f

2022-10-10 Thread robert engels
He was using that as an example to show that the value contained in the float is not 1, but less than 1, even though the print shows it as 1. > On Oct 10, 2022, at 8:07 PM, Bakul Shah wrote: > > On Oct 10, 2022, at 5:40 PM, Dante Castagnoli > wrote: >> >> Also, if you were to take an int(f),

Re: [go-nuts] behavior of %f

2022-10-10 Thread Bakul Shah
On Oct 10, 2022, at 5:40 PM, Dante Castagnoli wrote: > > Also, if you were to take an int(f), you will note that it returns "0", and > not "1". %0.3f does *rounding*, while int(f) does *truncation*. 1.0 is closer to 0.... than 0.999 is to 0.... -- You received this message because yo

Re: [go-nuts] behavior of %f

2022-10-10 Thread robert engels
I will add that this is why most financial applications using “fixed place” or “integer math” libraries - to have control over these sorts of issues. An example is robaho/fixed > On Oct 10, 2022, at 6:35 PM, Dante Castagnoli > wrote: > > Thanks, Rob, > > As t