user2385: re: https://plutus.readthedocs.io/en/latest/plutus/tutorials/basic-apps.html
Given that the explanation is ""The validator checks that the transaction, represented by scriptContextTxInfo, pays half the specified amount to each recipient.", why does the code not simply use ==half in both cases?
validateSplit :: SplitData -> () -> ScriptContext -> Bool
validateSplit SplitData{recipient1, recipient2, amount} _ ScriptContext{scriptContextTxInfo} =
    let half = Ada.divide amount 2 in
    Ada.fromValue (valuePaidTo scriptContextTxInfo recipient1) >= half &&
    Ada.fromValue (valuePaidTo scriptContextTxInfo recipient2) >= (amount - half)```


user1130: Ada is an integer under the hood and divide rounds down.
So, if amount is 5, half would be 2 and (amount - half) would be 3 (totaling to 5).

2385: <p>re: <a href="https://plutus.readthedocs.io/en/latest/plutus/tutorials/basic-apps.html" rel="nofollow noreferrer">https://plutus.readthedocs.io/en/latest/plutus/tutorials/basic-apps.html</a></p>
<p>Given that the explanation is &quot;&quot;The validator checks that the transaction, represented by scriptContextTxInfo, pays half the specified amount to each recipient.&quot;, why does the code not simply use <code>==half</code> in both cases?</p>
<pre><code>validateSplit :: SplitData -&gt; () -&gt; ScriptContext -&gt; Bool
validateSplit SplitData{recipient1, recipient2, amount} _ ScriptContext{scriptContextTxInfo} =
    let half = Ada.divide amount 2 in
    Ada.fromValue (valuePaidTo scriptContextTxInfo recipient1) &gt;= half &amp;&amp;
    Ada.fromValue (valuePaidTo scriptContextTxInfo recipient2) &gt;= (amount - half)```
</code></pre>
 1130: <p><code>Ada</code> is an integer under the hood and <a href="https://alpha.marlowe.iohkdev.io/doc/haddock/plutus-tx/html/PlutusTx-Prelude.html#v:divide" rel="nofollow noreferrer"><code>divide</code> rounds down</a>.</p>
<p>So, if <code>amount</code> is <code>5</code>, <code>half</code> would be <code>2</code> and <code>(amount - half)</code> would be <code>3</code> (totaling to <code>5</code>).</p>
