Arithmetic/Complex: Difference between revisions

m (→‎{{header|Fortran}}: The syntax highlighter also doesn't recognise imag as a function.)
Line 1,563:
=={{header|Forth}}==
{{libheader|Forth Scientific Library}}
ThereHistorically, there iswas no standard syntax or mechanism for complex numbers. The FSL providesand several implementations suitable for different uses. Thiswere example uses the existing floating point stack, but otherprovided. librariesHowever definelater a separatewordset complex''was'' stackstandardised and/oras a fixed-point implementation suitable for microcontrollers and"Algorithm DSPs#60".
<lang forth>S" fsl-util.fs" REQUIRED
 
<lang forth>includeS" complex.seqfs" REQUIRED
 
: ZNEGATE ( r i -- -r -i ) fswap fnegate fswap fnegate ;
 
zvariable x
Line 1,576 ⟶ 1,574:
x z@ y z@ z+ z.
x z@ y z@ z* z.
1e 0e zconstant 1+0i
1+0i x z@ z/ z.
x z@ znegate z.</lang>
37

edits