Closed Bug 696675 Opened 13 years ago Closed 13 years ago

float4 < operation is not correct

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED INVALID

People

(Reporter: brbaker, Assigned: virgilp)

References

Details

Using the < operator on float4 values does not produce the expected results. This happens in both interp and jit

print(float4(1f) < float4(2f));

Output:
    false

Expected: 
    true


Testmedia: as3/Types/Float4/flt4_5_5_5.as
Flags: in-testsuite+
Flags: flashplayer-triage+
Flags: flashplayer-qrb+
Flags: flashplayer-bug-
These tests produce the wrong results:

float4(1f) < float4(2f)
float4(2f) > float4(1f)
float4(2f) <= float4(1f)
float4(1f) >= float4(2f)
If I am reading the ABC spec correctly:

4.4.3 Abstract relational comparison
6. If Type(num1) is float4 or Type(num2) is float4 then return undefined

So all of the tests in as3/Types/Float4/flt4_5_5_5.as should return 'undefined'
But observe that "undefined" returned from the abstract operation is converted to "false" by the concrete operations.  This is probably less obvious than it seems, you need to look to the AS3 Expressions spec (8.4.1 through 8.4.4).

That is, "false" is the expected result for all relational operators on two float4 values.

(Given how complex and interdependent the specs are becoming I see myself writing some summary "for programmers" very, very soon.)
This actually works "as specified".
(it is however a bug that the compiler doesn't give strict mode errors on the comparisons, it would be nice if you can log an ASC bug for it as our users are likely to be surprised by the behaviour of relational operators, too).
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
OK there is still issue here, but they appear to be ASC related:

print(float4(1f) <= float4(2f));
print(float4(2f) <= float4(2f));
print(float4(2f) >= float4(1f));
print(float4(2f) >= float4(2f));

These should all produce "false" but they produce "true". If I do the same code via a function call, the runtime produces the correct results. 

ASC issue logged as https://bugs.adobe.com/jira/browse/ASC-4364
Status: RESOLVED → VERIFIED
(In reply to Virgil Palanciuc from comment #4)
> This actually works "as specified".
> (it is however a bug that the compiler doesn't give strict mode errors on
> the comparisons, it would be nice if you can log an ASC bug for it as our
> users are likely to be surprised by the behaviour of relational operators,
> too).

ASC bug logged for strict mode errors not happening:
https://bugs.adobe.com/jira/browse/ASC-4365
You need to log in before you can comment on or make changes to this bug.