Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: PDL datatype

by moklevat (Priest)
on Nov 29, 2007 at 21:12 UTC ( [id://653978]=note: print w/replies, xml ) Need Help??


in reply to Re^2: PDL datatype
in thread PDL datatype

It turns out it may not be so interesting now that my head is on a bit straighter. Assigning $x=50137.585706 does not create a piddle, as I would have known if I had bothered to print info($x).

I previously looked into adding a new types when the topic of using BigInts in piddles came up a while back, but I had to get back to my actual work. It may be that creating a new type would get you where you want to go.

Replies are listed 'Best First'.
Re^4: PDL datatype
by etj (Deacon) on Jun 07, 2022 at 04:14 UTC
    Adding a new type, as linked above, is a matter of creating extra options in the various places where PDL types live: conversion functions in Perl-land, type-specifiers for various PDL functions in Perl-land, type-qualifiers in PP function signatures, etc. Until about 2.035, it took extra manual stuff to hook up further types, including the (it turned out unnecessary) manually-hardcoded casting between various C types (it turned out the C standard and compiler can handle that all 100% fine).

    With the changes there, those manual activities became minimal, which made it easy(ish) to add further C types like C99 complex numbers, the rest of the integer types, and long doubles. However, and this is quite important, PP only provides text-expansion of provided Code (etc) chunks into parts of switch statements inside the various functions that make up the API of a PDL operation. The expanded text still needs to compile as C.

    This would mean that to support big ints, or MPFR, something would need to turn atomic C operations on C atomic-type (as I am calling them here) numbers (+,-,*,/,etc) into the appropriate version for those non-atomic types. That would involve parsing the actual C and making substitutions. This is not impossible, and using e.g. Pegex would make it manageable, but it would be significant work. On the plus side, it might facilitate moving to using e.g. OpenCL. See https://github.com/PDLPorters/pdl/issues/349 for more and/or to contribute!

Re^4: PDL datatype
by nickschurch (Acolyte) on Dec 03, 2007 at 01:59 UTC
    but $x=pdl(50137.685706) should create a piddle and, as I showed in my previous post, this works and sucessfully hold the whole number?!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://653978]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-25 16:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found