Menu

#3 Complex numbers test

2.0-Libre
open
nobody
None
2014-11-03
2014-11-02
lintense
No

I have been trying the complex number examples from the file:
Taodyne/Tao3D/doc/fr/html/xlref.html
(Please note this was my first attempt with XLR language)

--- Runtime Error! in Tao.exe

complex -> type (re:real, im:real)
Z1:complex + Z2:complex -> (Z1 . re + Z2 . re, Z1 . im + Z2 . im)
A -> (3.4, 5.2)
B -> (0.4, 2.22)
A + B

--- Runtime Error! in Tao.exe

complex -> type (re:real, im:real)
Z1:complex + Z2:complex -> (Z1 . re + Z2 . re, Z1 . im + Z2 . im)
Z3 -> (3.4 + 3.4, 5.2 + 4.5)
do Z3

--- Runtime Error! in Tao.exe

// Normal form for the complex type
complex -> type (re:real, im:real)
complex_real a:complex -> (re)
Z3 -> (3.4, 5.2)
shape
text_box 0, 0, 400, 100, text text (complex_real Z3)

--- No rewrite candidate for '(3.4, 5.2) + (0.4, 2.22)'

complex -> type (re:real, im:real)
Z1:complex + Z2:complex -> (Z1 . re + Z2 . re, Z1 . im + Z2 . im)
(3.4, 5.2) + (0.4, 2.22)

--- No rewrite candidate for 'complex (3.4, 5.2) + complex (0.4, 2.22)'

complex -> type complex (re:real, im:real)
a:complex + b:complex -> (a . re + b . re, a . im + b . im)
complex (3.4, 5.2) + complex (0.4, 2.22)

Discussion

  • lintense

    lintense - 2014-11-02

    Système d'exploitation Microsoft Windows XP Professionnel
    Version 5.1.2600 Service Pack 2 Nu 2600
    Fabricant NVIDIA
    Modèle AWRDACPI
    Type X86-based PC
    Processeur x86 Family 15 Model 75 Stepping 2 AuthenticAMD ~2210 Mhz
    Processeur x86 Family 15 Model 75 Stepping 2 AuthenticAMD ~2210 Mhz
    Version du BIOS/Date Phoenix Technologies, LTD 6.00 PG, 2006-06-02
    Version SMBIOS 2.2
    Répertoire Windows C:\WINDOWS
    Répertoire système C:\WINDOWS\system32
    Périphérique de démarrage \Device\HarddiskVolume1
    Option régionale France
    Couche d'abstraction matérielle Version = "5.1.2600.2562 (xpsp.040919-1030)"
    Mémoire physique totale 3 072,00 Mo
    Mémoire physique disponible 2,48 Go
    Mémoire virtuelle totale 2,00 Go
    Mémoire virtuelle disponible 1,92 Go
    Espace pour le fichier d'échange 2,84 Go

     
  • Christophe de Dinechin

    Well, sorry about that. That won't work for a while.

    I need to explain a bit of context here. XLR is a language that is still under development. Tao3D uses it as a document description language, and that "froze" a number of things, e.g. for compatibility reasons. It also takes a lot of my development time.

    So if you look inside XLR, you'll see two very different compilers. One is running by default, and used by Tao3D. It has no type system, no type inference, can't call C code directly, etc. The other is activated when you use -O3. It is technically more advanced, does much better optimisations, can call C code, has a way to directly use LLVM opcodes, etc. But it's not even halfway finished.

    Many aspects of the XL reference manual describe where I want to go, not where I currently am in particular with the -O1 compiler. The type system is one of them. Guards don't work either. Closures are broken when creating local functions. Assignments only work for integer, real and text. And so on.

    The XL reference manual tries to be clear about that. Maybe it's not clear enough.

     

Log in to post a comment.

MongoDB Logo MongoDB