Move Devel::PPPort from ext/ to cpan/
[p5sagit/p5-mst-13.2.git] / cpan / Devel-PPPort / parts / inc / format
CommitLineData
adfe19db 1################################################################################
2##
51d6c659 3## $Revision: 9 $
adfe19db 4## $Author: mhx $
51d6c659 5## $Date: 2009/01/18 14:10:55 +0100 $
adfe19db 6##
7################################################################################
8##
51d6c659 9## Version 3.x, Copyright (C) 2004-2009, Marcus Holland-Moritz.
adfe19db 10## Version 2.x, Copyright (C) 2001, Paul Marquess.
11## Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
12##
13## This program is free software; you can redistribute it and/or
14## modify it under the same terms as Perl itself.
15##
16################################################################################
17
18=provides
19
20/^#\s*define\s+(\w+)/
21
22=implementation
23
24#ifndef IVdf
25# if IVSIZE == LONGSIZE
26# define IVdf "ld"
27# define UVuf "lu"
28# define UVof "lo"
29# define UVxf "lx"
30# define UVXf "lX"
31# else
32# if IVSIZE == INTSIZE
33# define IVdf "d"
34# define UVuf "u"
35# define UVof "o"
36# define UVxf "x"
37# define UVXf "X"
38# endif
39# endif
40#endif
41
42#ifndef NVef
43# if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && \
1d175cda 44 defined(PERL_PRIfldbl) && { VERSION != 5.6.0 }
45 /* Not very likely, but let's try anyway. */
adfe19db 46# define NVef PERL_PRIeldbl
47# define NVff PERL_PRIfldbl
48# define NVgf PERL_PRIgldbl
49# else
50# define NVef "e"
51# define NVff "f"
52# define NVgf "g"
53# endif
54#endif
55
1d175cda 56=xsubs
57
58void
59croak_NVgf(num)
60 NV num
61 PPCODE:
62 Perl_croak(aTHX_ "%.20" NVgf "\n", num);
63
64=tests plan => 1
65
66my $num = 1.12345678901234567890;
67
68eval { Devel::PPPort::croak_NVgf($num) };
69ok($@ =~ /^1.1234567890/);
70