Shorten: Unterschied zwischen den Versionen

Aus JACK Wiki
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „===Beschreibung=== Die Funktion ''shorten'' kürzt eine rationale Zahl. ===Syntax=== shorten(a) ===Parameter=== * '''a''' - Objekt (rationale Z…“)
 
Zeile 13: Zeile 13:


===Beispiele===
===Beispiele===
  <math>shorten(rational(5,10))</math>   --> returns <math>\frac{1}{2}</math>  
  shorten(rational(5,10))    --> returns <math>\frac{1}{2}</math>  


  <math>shorten(rational(1,2))</math>   --> returns <math>\frac{1}{2}</math>  
  shorten(rational(1,2))    --> returns <math>\frac{1}{2}</math>  


  <math>shorten(rational(10.2))</math>   --> returns <math>10.2</math>
  shorten(rational(10.2))    --> returns 10.2
 
<math>shorten(rational(4*a,2))</math>    --> returns <math>2*a</math>


shorten(rational(4*a,2))    --> returns 2*a


===Hinweise===
===Hinweise===

Version vom 25. September 2018, 10:24 Uhr

Beschreibung

Die Funktion shorten kürzt eine rationale Zahl.

Syntax

 shorten(a)

Parameter

Return Value

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

Beispiele

shorten(rational(5,10))    --> returns <math>\frac{1}{2}</math> 
shorten(rational(1,2))    --> returns <math>\frac{1}{2}</math> 
shorten(rational(10.2))    --> returns 10.2
shorten(rational(4*a,2))    --> returns 2*a

Hinweise

  • Mit equal ("==") lässt sich das Ergebnis anschließend ebenfalls mit einem anderem Objekt vergleichen.