summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/rangen/examples/rangen_fp.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/rangen/examples/rangen_fp.tex')
-rw-r--r--Master/texmf-dist/doc/latex/rangen/examples/rangen_fp.tex24
1 files changed, 24 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/rangen/examples/rangen_fp.tex b/Master/texmf-dist/doc/latex/rangen/examples/rangen_fp.tex
new file mode 100644
index 00000000000..e7e4fcffdaf
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/rangen/examples/rangen_fp.tex
@@ -0,0 +1,24 @@
+\documentclass{article}
+\usepackage[tight,dvipsone,designv,nodirectory]{web}
+\usepackage{insdljs}
+\usepackage[testmode,quiet]{rangen}
+\usepackage{fp}
+
+\parindent0pt\parskip6pt
+
+\begin{document}
+
+\RandomQ{\a}[6]{2}{4}\RandomQ{\b}[6]{2}{4}\RandomS{\thisop}
+\gcd{\dOf\a}{\dOf\b}
+\FPeval\lcd{clip((\dOf\a)*(\dOf\b)/\thegcd)}
+\FPeval\si{clip(\lcd/(\dOf\a))}
+\FPeval\sii{clip(\lcd/(\dOf\b))}\def\thisop{+}
+\if\thisop+\FPeval\finalnum{clip((\si)*(\nOf\a)+(\sii)*(\nOf\b))}
+\else\FPeval\finalnum{clip((\si)*(\nOf\a)-(\sii)*(\nOf\b))}\fi
+\defineQ{\ans}{\finalnum}{\lcd}
+$$
+\ds\a \thisop \ds\b = \frac{(\si)(\nOf\a)+(\sii)(\nOf\b)}{\lcd}
+ = \frac{\finalnum}{\lcd}\ifnum\lcd=\dOf\ans\else =\ds\ans\fi
+$$
+
+\end{document}