Re: [Vala] Extended floating types



May this even better, by using a specialized math library written in C with
bindings for Vala.

We can wrap this library in GObject classes, then create Vala bindings and
GObject Introspection ones for other languages like Python.

If Vala bindings exists, we can create GObject wrappers written in Vala,
like we do at GXml for libxml2.
El may. 24, 2016 10:01 AM, "ben" <iofelben gmail com> escribió:

This does not work. The C code has: typedef float float128_t;

You could map it to gcc's 128 bit floating point type (https://gcc.gnu.
org/onlinedocs/gcc/Floating-Types.html) or use the 80-bit long double
type (https://stackoverflow.com/questions/13516476/long-double-gcc-spec
ific-and-float128)

Neither of these options are standard. For arbitrary precision math in
C I like to use https://gmplib.org/.



On Mon, 2016-05-23 at 21:26 -0500, Guillaume Poirier-Morency wrote:
It's possible to declare these types if you need to use them.

https://wiki.gnome.org/Projects/Vala/Manual/Attributes#FloatingType_A
tt
ribute

    [CCode (has_type_id = false)]
    [FloatingType (decimal = false, rank = 12, width = 128]
    struct float128_t {}

Like Daniel said, Vala primitive types are mapped to GLib's type with
the GType system, so it's not really the language's fault if there is
no support for 128 bit floating points. It's not a common use case
either way.

With 'has_type_id = false', the compiler knows that there's no type
information to retreive.

Rank 12 does not really exist, but that would be the appropriate
value
since 10 and 11 are for signed and unsigned 64 bit types.

It might be handy to have a VAPI for that in 'vala-extra-vapis'.

Cheers and best luck,

Le lundi 23 mai 2016 à 09:59 +0300, Vitaly V. Ch a écrit :
Ok, Thanks.

It clarifies the situation.

With best regards,

Vitaly Chernooky

On Mon, May 23, 2016 at 4:51 AM, Daniel Espinosa <esodan gmail com>
wrote:

May you should be able to create your own basic type.

May should be a guide to do so.

GLib should have this types too, before you are able to create
your
basic
types. This means you should define a GType for a basic type, in
this case
your long double.

May we can create a library to define this math basic types, to
be
used in
other libraries. This is not a GLib interest, I think, because is
not a
primary Math library.

I was working a little in that, but may you should ask to gtk-
list
for
help on defining this new types.

In other ideas, is required to use that types or is possible to
use
some
structs holding your information in a way to be used in other
methods, that
may take that structs an do calculations using that types
internally,
written in C with Vala bindings [1], then return again that
structs.

[] See git.gnome.org/browse/gxml it uses simple C methods and
Vala
bindings to be used in Vala code for xlibxml
El may. 22, 2016 3:23 PM, "Vitaly V. Ch" <vitaly v ch gmail com>
escribió:

Hi All!

Some time ago Vala has pulled my attention as a way to solve some
kind of
math problems. But some time later I realized that this cozy and
beautiful
staff does not have extended floating datatypes such as long
double
or
float128_t. This fact disappointed me and I'm interested in some
comments.

With best regards,

Vitaly Chernooky
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list


_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]