Rational

Aus JACK Wiki
Zur Navigation springen Zur Suche springen

Beschreibung

rational gibt die Dezimalbruchdarstellung zweier Zahlen zurück.

Syntax

 rational(a,b)

Parameter

Return Value

Die Rückgabe ist abhängig von der Eingabe. Dabei wird soweit wie möglich die Eingabe ausgerechnet.

Beispiele

<math>rational(2,5)</math>    --> returns <math>\frac{2}{5}</math> 
<math>rational(2,a)</math>    --> returns <math>\frac{2}{a}</math> 
<math>rational(a,b)</math>    --> returns <math>\frac{a}{b}</math> 
<math>rational(sin(a),b)</math>    --> returns <math>\frac{sin(a)}{b}</math>
<math>rational(cos(0),a)</math>    --> returns <math>\frac{1}{a}</math> 


Hinweise

  • Mit equal ("==") lässt sich das Ergebnis anschließend ebenfalls mit einem anderem Objekt vergleichen.
  • rational(a,b) und divide(a,b) (oder a/b) sind nicht immer gleich