[Info-vax] VMS Software Q1 '23 Update

Arne Vajhøj arne at vajhoej.dk
Wed Feb 1 11:25:51 EST 2023


On 2/1/2023 10:40 AM, Jan-Erik Söderholm wrote:
> Den 2023-02-01 kl. 15:11, skrev Arne Vajhøj:
>> On 2/1/2023 8:17 AM, Simon Clubley wrote:
>>> Something just occurred to me while writing this: does the latest 
>>> solution
>>> to everything :-) (ie: Rust) still allow you to directly compare two 
>>> floating
>>> point numbers ?
>>>
>>> Based on a quick search, the answer would appear to be yes, which was
>>> a bit of a surprise...
>>
>> It does but Clippy complains unless you instruct it not to.
>>
>> #[allow(clippy::float_cmp)]
>>
>> fn main() {
>>      let x:f64 = 123.456;
>>      let y:f64 = 123.456;
>>      let eq1:bool = x == y;
>>      println!("{0} = {1} is {2}", x, y, eq1);
>> }
> 
> Is that true for < or > compares also?
> That seems as less of an issue...

Docs says:

<quote>
What it does

Checks for (in-)equality comparisons on floating-point values
</quote>

so I guess only == and !=.

Arne




More information about the Info-vax mailing list