You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
3.1 KiB

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Rational numbers · Literate.jl</title><link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/4.2.0/normalize.min.css" rel="stylesheet" type="text/css"/><link href="https://fonts.googleapis.com/css?family=Lato|Roboto+Mono" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL="../.."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.2.0/require.min.js" data-main="../../assets/documenter.js"></script><script src="../../siteinfo.js"></script><script src="../../../versions.js"></script><link href="../../assets/documenter.css" rel="stylesheet" type="text/css"/><link href="../../assets/custom.css" rel="stylesheet" type="text/css"/></head><body><nav class="toc"><a href="../../"><img class="logo" src="../../assets/logo.png" alt="Literate.jl logo"/></a><h1>Literate.jl</h1><select id="version-selector" onChange="window.location.href=this.value" style="visibility: hidden"></select><form class="search" id="search-form" action="../../search/"><input id="search-query" name="q" type="text" placeholder="Search docs"/></form><ul><li><a class="toctext" href="../../"><strong>1.</strong> Introduction</a></li><li><a class="toctext" href="../../fileformat/"><strong>2.</strong> File Format</a></li><li><a class="toctext" href="../../pipeline/"><strong>3.</strong> Processing pipeline</a></li><li><a class="toctext" href="../../outputformats/"><strong>4.</strong> Output Formats</a></li><li><a class="toctext" href="../../customprocessing/"><strong>5.</strong> Custom pre- and post-processing</a></li><li><a class="toctext" href="../../documenter/"><strong>6.</strong> Interaction with Documenter.jl</a></li><li><a class="toctext" href="../example/"><strong>7.</strong> Example</a></li></ul></nav><article id="docs"><header><nav><ul><li><a href>Rational numbers</a></li></ul><a class="edit-page" href="https://github.com/fredrikekre/Literate.jl/blob/master/docs/src/outputformats.jl"><span class="fa"></span> Edit on GitHub</a></nav><hr/><div id="topbar"><span>Rational numbers</span><a class="fa fa-bars" href="#"></a></div></header><h1><a class="nav-anchor" id="Rational-numbers-1" href="#Rational-numbers-1">Rational numbers</a></h1><p>In julia rational numbers can be constructed with the <code>//</code> operator. Lets define two rational numbers, <code>x</code> and <code>y</code>:</p><pre><code class="language-julia">x = 1//3</code></pre><pre><code class="language-none">1//3</code></pre><pre><code class="language-julia">y = 2//5</code></pre><pre><code class="language-none">2//5</code></pre><p>When adding <code>x</code> and <code>y</code> together we obtain a new rational number:</p><pre><code class="language-julia">z = x + y</code></pre><pre><code class="language-none">11//15</code></pre><footer><hr/></footer></article></body></html>