Last active
March 5, 2025 16:15
-
-
Save gibson042/0750f82871ff0a62b55b5e438cad074b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" href="https://fred-wang.github.io/MathFonts/STIX/mathfonts.css"> | |
<style> | |
mtd[columnalign=left] { text-align: left; } | |
mtext { display: inline; white-space: pre-wrap; } | |
</style> | |
<h1>Value first</h1> | |
Let <var>final</var> be <math> | |
<mrow> | |
<mo>{</mo> | |
<mtable> | |
<mtr> | |
<mtd> | |
<mn>0</mn> | |
</mtd> | |
<mtd columnalign="left"> | |
<mtext>if </mtext> | |
<mi><var>relativeEnd</var></mi> | |
<mo>=</mo> | |
<mn>−∞</mn> | |
<mtext>, else </mtext> | |
</mtd> | |
</mtr> | |
<mtr> | |
<mtd> | |
<mi>max</mi> | |
<mo>(</mo> | |
<mrow> | |
<mi><var>len</var></mi> | |
<mo>+</mo> | |
<mi><var>relativeEnd</var></mi> | |
</mrow> | |
<mo>,</mo> | |
<mn>0</mn> | |
<mo>)</mo> | |
</mtd> | |
<mtd columnalign="left"> | |
<mtext>if </mtext> | |
<mi><var>relativeEnd</var></mi> | |
<mo><</mo> | |
<mn>0</mn> | |
<mtext>, else </mtext> | |
</mtd> | |
</mtr> | |
<mtr> | |
<mtd> | |
<mi>min</mi> | |
<mo>(</mo> | |
<mi><var>relativeEnd</var></mi> | |
<mo>,</mo> | |
<mi><var>len</var></mi> | |
<mo>)</mo> | |
</mtd> | |
<mtd columnalign="left"> | |
<mtext>otherwise</mtext> | |
</mtd> | |
</mtr> | |
</mtable> | |
<mo>}</mo> | |
</mrow> | |
</math>. | |
<h1>Condition first</h1> | |
Let <var>final</var> be <math> | |
<mrow> | |
<mo>{</mo> | |
<mtable> | |
<mtr> | |
<mtd columnalign="left"> | |
<mtext>if </mtext> | |
<mi><var>relativeEnd</var></mi> | |
<mo>=</mo> | |
<mn>−∞</mn> | |
<mtext>, then </mtext> | |
</mtd> | |
<mtd columnalign="left"> | |
<mn>0</mn> | |
</mtd> | |
</mtr> | |
<mtr> | |
<mtd columnalign="left"> | |
<mtext>else if </mtext> | |
<mi><var>relativeEnd</var></mi> | |
<mo><</mo> | |
<mn>0</mn> | |
<mtext>, then </mtext> | |
</mtd> | |
<mtd columnalign="left"> | |
<mi>max</mi> | |
<mo>(</mo> | |
<mrow> | |
<mi><var>len</var></mi> | |
<mo>+</mo> | |
<mi><var>relativeEnd</var></mi> | |
</mrow> | |
<mo>,</mo> | |
<mn>0</mn> | |
<mo>)</mo> | |
</mtd> | |
</mtr> | |
<mtr> | |
<mtd columnalign="left"> | |
<mtext>else </mtext> | |
</mtd> | |
<mtd columnalign="left"> | |
<mi>min</mi> | |
<mo>(</mo> | |
<mi><var>relativeEnd</var></mi> | |
<mo>,</mo> | |
<mi><var>len</var></mi> | |
<mo>)</mo> | |
</mtd> | |
</mtr> | |
</mtable> | |
<mo>}</mo> | |
</mrow> | |
</math>. | |
<h1>Preserve both braces</h1> | |
Let <var>final</var> be <math> | |
<mrow> | |
<mo>{</mo> | |
<mo>{</mo> | |
<mtable> | |
<mtr> | |
<mtd columnalign="left"> | |
<mtext>if </mtext> | |
<mi><var>relativeEnd</var></mi> | |
<mo>=</mo> | |
<mn>−∞</mn> | |
<mtext>, then </mtext> | |
</mtd> | |
<mtd columnalign="left"> | |
<mn>0</mn> | |
</mtd> | |
</mtr> | |
<mtr> | |
<mtd columnalign="left"> | |
<mtext>else if </mtext> | |
<mi><var>relativeEnd</var></mi> | |
<mo><</mo> | |
<mn>0</mn> | |
<mtext>, then </mtext> | |
</mtd> | |
<mtd columnalign="left"> | |
<mi>max</mi> | |
<mo>(</mo> | |
<mrow> | |
<mi><var>len</var></mi> | |
<mo>+</mo> | |
<mi><var>relativeEnd</var></mi> | |
</mrow> | |
<mo>,</mo> | |
<mn>0</mn> | |
<mo>)</mo> | |
</mtd> | |
</mtr> | |
<mtr> | |
<mtd columnalign="left"> | |
<mtext>else </mtext> | |
</mtd> | |
<mtd columnalign="left"> | |
<mi>min</mi> | |
<mo>(</mo> | |
<mi><var>relativeEnd</var></mi> | |
<mo>,</mo> | |
<mi><var>len</var></mi> | |
<mo>)</mo> | |
</mtd> | |
</mtr> | |
</mtable> | |
<mo>}</mo> | |
<mo>}</mo> | |
</mrow> | |
</math>. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment