Tropical algebra overloading: Difference between revisions

m
→‎{{header|Raku}}: test relative precedence of ↑ and ⊕
m (→‎{{header|Raku}}: reduce noise)
m (→‎{{header|Raku}}: test relative precedence of ↑ and ⊕)
Line 607:
sub infix:<⊗> (Real $a, Real $b) is equiv(&[×]) { $a + $b }
sub infix:<↑> (Real $a, Int $b) is equiv(&[**]) { [⊗] $a xx $b }
 
use Test;
 
is-deeply( 2 ⊗ -2, 0, '2 ⊗ -2 == 0' );
is-deeply( -0.001 ⊕ -Inf, -0.001, '-0.001 ⊕ -Inf == -0.001' );
Line 616:
is-deeply( -0.5 ⊗ 0, -0.5, '-0.5 ⊗ 0 == -0.5' );
is-deeply( 5 ↑ 7, 35, '5 ↑ 7 == 35' );
is-deeply( 5 ⊗ (8 ⊕ 7), 5 ⊗ 8 ⊕ 5 ⊗ 7, '5 ⊗ (8 ⊕ 7) == 5 ⊗ 8 ⊕ 5 ⊗ 7');</lang>
is-deeply( 5 ↑ 7 ⊕ 6 ↑ 6, 36, '5 ↑ 7 ⊕ 6 ↑ 6 == 36');</lang>
{{out}}
<pre>ok 1 - 2 ⊗ -2 == 0
Line 624 ⟶ 625:
ok 5 - -0.5 ⊗ 0 == -0.5
ok 6 - 5 ↑ 7 == 35
ok 7 - 5 ⊗ (8 ⊕ 7) == 5 ⊗ 8 ⊕ 5 ⊗ 7</pre>
ok 8 - 5 ↑ 7 ⊕ 6 ↑ 6 == 36</pre>
 
=={{header|REXX}}==
10,327

edits