@zigc/lib 0.16.0 → 0.17.0-dev.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/c/math.zig +20 -7
- package/compiler/test_runner.zig +1 -1
- package/compiler_rt/divmodei4.zig +40 -17
- package/compiler_rt/exp.zig +1 -4
- package/compiler_rt/exp2.zig +1 -4
- package/compiler_rt/exp_f128.zig +377 -0
- package/compiler_rt/limb64.zig +875 -15
- package/compiler_rt/mulXi3.zig +1 -1
- package/compiler_rt/ssp.zig +1 -1
- package/compiler_rt/udivmodei4.zig +28 -0
- package/package.json +1 -1
- package/std/Io/Writer.zig +41 -41
- package/std/os/emscripten.zig +1 -1
- package/std/os/linux/arc.zig +144 -0
- package/std/os/linux.zig +14 -2
- package/libc/mingw/math/fdiml.c +0 -24
- package/libc/musl/src/math/fdimf.c +0 -10
- package/libc/musl/src/math/fdiml.c +0 -18
package/compiler_rt/mulXi3.zig
CHANGED
|
@@ -63,7 +63,7 @@ fn DoubleInt(comptime T: type) type {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
fn muldXi(comptime T: type, a: T, b: T) DoubleInt(T) {
|
|
66
|
+
pub fn muldXi(comptime T: type, a: T, b: T) DoubleInt(T) {
|
|
67
67
|
const DT = DoubleInt(T);
|
|
68
68
|
const word_t = compiler_rt.HalveInt(DT, false);
|
|
69
69
|
const bits_in_word_2 = @sizeOf(T) * 8 / 2;
|
package/compiler_rt/ssp.zig
CHANGED
|
@@ -24,7 +24,7 @@ extern fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.c) ?[*]u8
|
|
|
24
24
|
comptime {
|
|
25
25
|
@export(&__stack_chk_fail, .{ .name = if (builtin.os.tag == .openbsd) "__stack_smash_handler" else "__stack_chk_fail", .linkage = compiler_rt.linkage, .visibility = compiler_rt.visibility });
|
|
26
26
|
symbol(&__chk_fail, "__chk_fail");
|
|
27
|
-
symbol(&__stack_chk_guard, "__stack_chk_guard");
|
|
27
|
+
symbol(&__stack_chk_guard, if (builtin.os.tag == .openbsd) "__guard_local" else "__stack_chk_guard");
|
|
28
28
|
symbol(&__strcpy_chk, "__strcpy_chk");
|
|
29
29
|
symbol(&__strncpy_chk, "__strncpy_chk");
|
|
30
30
|
symbol(&__strcat_chk, "__strcat_chk");
|
|
@@ -13,6 +13,8 @@ const max_limbs = std.math.divCeil(usize, 65535, 32) catch unreachable; // max s
|
|
|
13
13
|
comptime {
|
|
14
14
|
symbol(&__udivei4, "__udivei4");
|
|
15
15
|
symbol(&__umodei4, "__umodei4");
|
|
16
|
+
symbol(&__udivei5, "__udivei5");
|
|
17
|
+
symbol(&__umodei5, "__umodei5");
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
/// Get the value of a limb.
|
|
@@ -132,6 +134,32 @@ pub fn __umodei4(r_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, bits: usize) ca
|
|
|
132
134
|
@call(.always_inline, divmod, .{ null, r, u, v }) catch unreachable;
|
|
133
135
|
}
|
|
134
136
|
|
|
137
|
+
pub fn __udivei5(q_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, t_p: [*]u8, bits: usize) callconv(.c) void {
|
|
138
|
+
@setRuntimeSafety(compiler_rt.test_safety);
|
|
139
|
+
const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));
|
|
140
|
+
const q: []u32 = @ptrCast(@alignCast(q_p[0..byte_size]));
|
|
141
|
+
const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size]));
|
|
142
|
+
const v: []const u32 = @ptrCast(@alignCast(v_p[0..byte_size]));
|
|
143
|
+
const tu: []u32 = @ptrCast(@alignCast(t_p[0..byte_size]));
|
|
144
|
+
_ = tu;
|
|
145
|
+
const tv: []u32 = @ptrCast(@alignCast(t_p[byte_size..][0..byte_size]));
|
|
146
|
+
_ = tv;
|
|
147
|
+
@call(.always_inline, divmod, .{ q, null, u, v }) catch unreachable;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
pub fn __umodei5(r_p: [*]u8, u_p: [*]const u8, v_p: [*]const u8, t_p: [*]u8, bits: usize) callconv(.c) void {
|
|
151
|
+
@setRuntimeSafety(compiler_rt.test_safety);
|
|
152
|
+
const byte_size = std.zig.target.intByteSize(&builtin.target, @intCast(bits));
|
|
153
|
+
const r: []u32 = @ptrCast(@alignCast(r_p[0..byte_size]));
|
|
154
|
+
const u: []const u32 = @ptrCast(@alignCast(u_p[0..byte_size]));
|
|
155
|
+
const v: []const u32 = @ptrCast(@alignCast(v_p[0..byte_size]));
|
|
156
|
+
const tu: []u32 = @ptrCast(@alignCast(t_p[0..byte_size]));
|
|
157
|
+
_ = tu;
|
|
158
|
+
const tv: []u32 = @ptrCast(@alignCast(t_p[byte_size..][0..byte_size]));
|
|
159
|
+
_ = tv;
|
|
160
|
+
@call(.always_inline, divmod, .{ null, r, u, v }) catch unreachable;
|
|
161
|
+
}
|
|
162
|
+
|
|
135
163
|
test "__udivei4/__umodei4" {
|
|
136
164
|
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
|
137
165
|
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
package/package.json
CHANGED
package/std/Io/Writer.zig
CHANGED
|
@@ -551,64 +551,64 @@ pub fn writeAll(w: *Writer, bytes: []const u8) Error!void {
|
|
|
551
551
|
while (index < bytes.len) index += try w.write(bytes[index..]);
|
|
552
552
|
}
|
|
553
553
|
|
|
554
|
-
/// Renders fmt string with args
|
|
555
|
-
/// If `writer` returns an error, the error is returned from `format` and
|
|
556
|
-
/// `writer` is not called again.
|
|
554
|
+
/// Renders `fmt` string with `args`, calling `w` with slices of bytes.
|
|
557
555
|
///
|
|
558
|
-
/// The format string must be comptime-known and may contain placeholders
|
|
559
|
-
/// this format:
|
|
560
|
-
///
|
|
556
|
+
/// The format string must be comptime-known and may contain placeholders
|
|
557
|
+
/// following this format:
|
|
558
|
+
/// ```
|
|
559
|
+
/// {[argument][specifier]:[fill][alignment][width].[precision]}
|
|
560
|
+
/// ```
|
|
561
561
|
///
|
|
562
|
-
/// Above, each word including its surrounding [ and ] is a parameter
|
|
562
|
+
/// Above, each word including its surrounding [ and ] is a parameter to be replaced with:
|
|
563
563
|
///
|
|
564
|
-
/// -
|
|
565
|
-
/// -
|
|
566
|
-
/// brackets, e.g. {[score]...} as opposed to the numeric index form which can be written e.g. {2...}
|
|
567
|
-
/// -
|
|
568
|
-
/// -
|
|
569
|
-
/// -
|
|
564
|
+
/// - **argument** is either the numeric index or the field name of the argument that should be inserted.
|
|
565
|
+
/// - When using a field name, the field name (an identifier) must be enclosed in square
|
|
566
|
+
/// brackets, e.g. `{[score]...}` as opposed to the numeric index form which can be written e.g. `{2...}`.
|
|
567
|
+
/// - **specifier** is a type-dependent formatting option that determines how a type should formatted (see below).
|
|
568
|
+
/// - **fill** is a single byte which is used to pad formatted numbers.
|
|
569
|
+
/// - **alignment** is one of the three bytes '<', '^', or '>' to make numbers
|
|
570
570
|
/// left, center, or right-aligned, respectively.
|
|
571
571
|
/// - Not all specifiers support alignment.
|
|
572
|
-
/// - Alignment is not Unicode-aware; appropriate only when used with raw
|
|
573
|
-
///
|
|
574
|
-
/// -
|
|
572
|
+
/// - Alignment is not Unicode-aware; appropriate only when used with raw
|
|
573
|
+
/// bytes or ASCII.
|
|
574
|
+
/// - **width** is the total size of the field in bytes, only applicable to
|
|
575
|
+
/// number formatting.
|
|
576
|
+
/// - **precision** specifies how many decimals a formatted number should have.
|
|
575
577
|
///
|
|
576
|
-
///
|
|
577
|
-
///
|
|
578
|
-
/// separator are omitted.
|
|
578
|
+
/// Most of the parameters are optional and may be omitted. The separators (':'
|
|
579
|
+
/// and '.') may be omitted when all parameters afterwards are omitted.
|
|
579
580
|
///
|
|
580
|
-
///
|
|
581
|
-
/// required at the same time as
|
|
582
|
-
///
|
|
583
|
-
/// *width*, not *fill*.
|
|
581
|
+
/// The **fill** parameter is an exception. If a non-zero **fill** character is
|
|
582
|
+
/// required at the same time as **width** is specified, **alignment** is
|
|
583
|
+
/// required, otherwise the digit following ':' is interpreted as **width**.
|
|
584
584
|
///
|
|
585
|
-
///
|
|
586
|
-
/// - `x` and `X`:
|
|
585
|
+
/// **specifier** supports:
|
|
586
|
+
/// - `x` and `X`: numeric value in hexadecimal notation, or string in hexadecimal bytes
|
|
587
587
|
/// - `s`:
|
|
588
588
|
/// - for pointer-to-many and C pointers of u8, print as a C-string using zero-termination
|
|
589
589
|
/// - for slices of u8, print the entire slice as a string without zero-termination
|
|
590
590
|
/// - `t`:
|
|
591
591
|
/// - for enums and tagged unions: prints the tag name
|
|
592
592
|
/// - for error sets: prints the error name
|
|
593
|
-
/// - `b64`:
|
|
594
|
-
/// - `e`:
|
|
595
|
-
/// - `d`:
|
|
596
|
-
/// - `b`:
|
|
597
|
-
/// - `o`:
|
|
598
|
-
/// - `c`:
|
|
599
|
-
/// - `u`:
|
|
600
|
-
/// - `
|
|
601
|
-
/// - `
|
|
602
|
-
/// - `
|
|
603
|
-
/// -
|
|
604
|
-
/// -
|
|
605
|
-
/// -
|
|
606
|
-
/// - `any`: output a value of any type using its default format.
|
|
593
|
+
/// - `b64`: string as standard base64
|
|
594
|
+
/// - `e`: floating point value in scientific notation
|
|
595
|
+
/// - `d`: numeric value in decimal notation
|
|
596
|
+
/// - `b`: integer value in binary notation
|
|
597
|
+
/// - `o`: integer value in octal notation
|
|
598
|
+
/// - `c`: integer as an ASCII character. Integer type must have 8 bits at max.
|
|
599
|
+
/// - `u`: integer as an UTF-8 sequence. Integer type must have 21 bits at max.
|
|
600
|
+
/// - `B`: bytes in SI units (decimal)
|
|
601
|
+
/// - `Bi`: bytes in IEC units (binary)
|
|
602
|
+
/// - `?`: optional value as either the unwrapped value, or `null`; may be followed by a format specifier for the underlying value.
|
|
603
|
+
/// - `!`: error union value as either the unwrapped value, or the formatted error value; may be followed by a format specifier for the underlying value.
|
|
604
|
+
/// - `*`: the address of the value instead of the value itself.
|
|
605
|
+
/// - `any`: a value of any type using its default format.
|
|
607
606
|
/// - `f`: delegates to a method on the type named "format" with the signature `fn (*Writer, args: anytype) Writer.Error!void`.
|
|
608
607
|
///
|
|
609
|
-
/// A user type may be a
|
|
608
|
+
/// A user type may be a struct, vector, union or enum type.
|
|
610
609
|
///
|
|
611
|
-
///
|
|
610
|
+
/// Literal curly braces can be escaped in the format string via doubling, e.g.
|
|
611
|
+
/// `{{` or `}}`.
|
|
612
612
|
pub fn print(w: *Writer, comptime fmt: []const u8, args: anytype) Error!void {
|
|
613
613
|
const ArgsType = @TypeOf(args);
|
|
614
614
|
const args_type_info = @typeInfo(ArgsType);
|
package/std/os/emscripten.zig
CHANGED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
const builtin = @import("builtin");
|
|
2
|
+
const std = @import("../../std.zig");
|
|
3
|
+
const SYS = std.os.linux.SYS;
|
|
4
|
+
|
|
5
|
+
pub fn syscall0(number: SYS) u32 {
|
|
6
|
+
return asm volatile ("trap_s 0"
|
|
7
|
+
: [ret] "={r0}" (-> u32),
|
|
8
|
+
: [number] "{r8}" (@intFromEnum(number)),
|
|
9
|
+
: .{ .memory = true });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
pub fn syscall1(number: SYS, arg1: u32) u32 {
|
|
13
|
+
return asm volatile ("trap_s 0"
|
|
14
|
+
: [ret] "={r0}" (-> u32),
|
|
15
|
+
: [number] "{r8}" (@intFromEnum(number)),
|
|
16
|
+
[arg1] "{r0}" (arg1),
|
|
17
|
+
: .{ .memory = true });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
pub fn syscall2(number: SYS, arg1: u32, arg2: u32) u32 {
|
|
21
|
+
return asm volatile ("trap_s 0"
|
|
22
|
+
: [ret] "={r0}" (-> u32),
|
|
23
|
+
: [number] "{r8}" (@intFromEnum(number)),
|
|
24
|
+
[arg1] "{r0}" (arg1),
|
|
25
|
+
[arg2] "{r1}" (arg2),
|
|
26
|
+
: .{ .memory = true });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
pub fn syscall3(number: SYS, arg1: u32, arg2: u32, arg3: u32) u32 {
|
|
30
|
+
return asm volatile ("trap_s 0"
|
|
31
|
+
: [ret] "={r0}" (-> u32),
|
|
32
|
+
: [number] "{r8}" (@intFromEnum(number)),
|
|
33
|
+
[arg1] "{r0}" (arg1),
|
|
34
|
+
[arg2] "{r1}" (arg2),
|
|
35
|
+
[arg3] "{r2}" (arg3),
|
|
36
|
+
: .{ .memory = true });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
pub fn syscall4(number: SYS, arg1: u32, arg2: u32, arg3: u32, arg4: u32) u32 {
|
|
40
|
+
return asm volatile ("trap_s 0"
|
|
41
|
+
: [ret] "={r0}" (-> u32),
|
|
42
|
+
: [number] "{r8}" (@intFromEnum(number)),
|
|
43
|
+
[arg1] "{r0}" (arg1),
|
|
44
|
+
[arg2] "{r1}" (arg2),
|
|
45
|
+
[arg3] "{r2}" (arg3),
|
|
46
|
+
[arg4] "{r3}" (arg4),
|
|
47
|
+
: .{ .memory = true });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
pub fn syscall5(number: SYS, arg1: u32, arg2: u32, arg3: u32, arg4: u32, arg5: u32) u32 {
|
|
51
|
+
return asm volatile ("trap_s 0"
|
|
52
|
+
: [ret] "={r0}" (-> u32),
|
|
53
|
+
: [number] "{r8}" (@intFromEnum(number)),
|
|
54
|
+
[arg1] "{r0}" (arg1),
|
|
55
|
+
[arg2] "{r1}" (arg2),
|
|
56
|
+
[arg3] "{r2}" (arg3),
|
|
57
|
+
[arg4] "{r3}" (arg4),
|
|
58
|
+
[arg5] "{r4}" (arg5),
|
|
59
|
+
: .{ .memory = true });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
pub fn syscall6(
|
|
63
|
+
number: SYS,
|
|
64
|
+
arg1: u32,
|
|
65
|
+
arg2: u32,
|
|
66
|
+
arg3: u32,
|
|
67
|
+
arg4: u32,
|
|
68
|
+
arg5: u32,
|
|
69
|
+
arg6: u32,
|
|
70
|
+
) u32 {
|
|
71
|
+
return asm volatile ("trap_s 0"
|
|
72
|
+
: [ret] "={r0}" (-> u32),
|
|
73
|
+
: [number] "{r8}" (@intFromEnum(number)),
|
|
74
|
+
[arg1] "{r0}" (arg1),
|
|
75
|
+
[arg2] "{r1}" (arg2),
|
|
76
|
+
[arg3] "{r2}" (arg3),
|
|
77
|
+
[arg4] "{r3}" (arg4),
|
|
78
|
+
[arg5] "{r4}" (arg5),
|
|
79
|
+
[arg6] "{r5}" (arg6),
|
|
80
|
+
: .{ .memory = true });
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
pub fn clone() callconv(.naked) u32 {
|
|
84
|
+
// __clone(func, stack, flags, arg, ptid, tls, ctid)
|
|
85
|
+
// r0, r1, r2, r3, r4, r5, r6
|
|
86
|
+
//
|
|
87
|
+
// syscall(SYS_clone, flags, stack, ptid, tls, ctid)
|
|
88
|
+
// r8 r0, r1, r2, r3, r4
|
|
89
|
+
asm volatile (
|
|
90
|
+
\\ // Align stack pointer
|
|
91
|
+
\\ and r1, r1, -16
|
|
92
|
+
\\ mov r10, r0
|
|
93
|
+
\\ mov r11, r3
|
|
94
|
+
\\ // Setup the arguments
|
|
95
|
+
\\ mov r0, r2
|
|
96
|
+
\\ mov r2, r4
|
|
97
|
+
\\ mov r3, r5
|
|
98
|
+
\\ mov r4, r6
|
|
99
|
+
\\ mov r8, 220 // SYS_clone
|
|
100
|
+
\\ trap_s 0
|
|
101
|
+
\\ cmp r0, 0
|
|
102
|
+
\\ beq 1f
|
|
103
|
+
\\ j [blink]
|
|
104
|
+
\\ // Child
|
|
105
|
+
\\ 1:
|
|
106
|
+
);
|
|
107
|
+
if (builtin.unwind_tables != .none or !builtin.strip_debug_info) asm volatile (
|
|
108
|
+
\\ .cfi_undefined blink
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
asm volatile (
|
|
112
|
+
\\ mov fp, 0
|
|
113
|
+
\\ mov blink, 0
|
|
114
|
+
\\
|
|
115
|
+
\\ mov r0, r11
|
|
116
|
+
\\ jl [r10]
|
|
117
|
+
\\
|
|
118
|
+
\\ // Exit
|
|
119
|
+
\\ mov r8, 93 // SYS_exit
|
|
120
|
+
\\ trap_s 0
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
pub const restore = restore_rt;
|
|
125
|
+
|
|
126
|
+
pub fn restore_rt() callconv(.naked) noreturn {
|
|
127
|
+
switch (builtin.zig_backend) {
|
|
128
|
+
.stage2_c => asm volatile (
|
|
129
|
+
\\ mov r8, %[number]
|
|
130
|
+
\\ trap_s 0
|
|
131
|
+
:
|
|
132
|
+
: [number] "I" (@intFromEnum(SYS.rt_sigreturn)),
|
|
133
|
+
),
|
|
134
|
+
else => asm volatile (
|
|
135
|
+
\\ trap_s 0
|
|
136
|
+
:
|
|
137
|
+
: [number] "{r8}" (@intFromEnum(SYS.rt_sigreturn)),
|
|
138
|
+
),
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
pub const time_t = i64;
|
|
143
|
+
|
|
144
|
+
pub const VDSO = void;
|
package/std/os/linux.zig
CHANGED
|
@@ -31,6 +31,7 @@ test {
|
|
|
31
31
|
|
|
32
32
|
const arch_bits = switch (native_arch) {
|
|
33
33
|
.aarch64, .aarch64_be => @import("linux/aarch64.zig"),
|
|
34
|
+
.arc, .arceb => @import("linux/arc.zig"),
|
|
34
35
|
.arm, .armeb, .thumb, .thumbeb => @import("linux/arm.zig"),
|
|
35
36
|
.hexagon => @import("linux/hexagon.zig"),
|
|
36
37
|
.loongarch32 => @import("linux/loongarch32.zig"),
|
|
@@ -274,7 +275,13 @@ pub const MAP = switch (native_arch) {
|
|
|
274
275
|
UNINITIALIZED: bool = false,
|
|
275
276
|
_: u5 = 0,
|
|
276
277
|
},
|
|
277
|
-
.
|
|
278
|
+
.arc,
|
|
279
|
+
.arceb,
|
|
280
|
+
.hexagon,
|
|
281
|
+
.m68k,
|
|
282
|
+
.or1k,
|
|
283
|
+
.s390x,
|
|
284
|
+
=> packed struct(u32) {
|
|
278
285
|
TYPE: MAP_TYPE,
|
|
279
286
|
FIXED: bool = false,
|
|
280
287
|
ANONYMOUS: bool = false,
|
|
@@ -451,7 +458,12 @@ pub const O = switch (native_arch) {
|
|
|
451
458
|
TMPFILE: bool = false,
|
|
452
459
|
_23: u9 = 0,
|
|
453
460
|
},
|
|
454
|
-
.
|
|
461
|
+
.arc,
|
|
462
|
+
.arceb,
|
|
463
|
+
.hexagon,
|
|
464
|
+
.or1k,
|
|
465
|
+
.s390x,
|
|
466
|
+
=> packed struct(u32) {
|
|
455
467
|
ACCMODE: ACCMODE = .RDONLY,
|
|
456
468
|
_2: u4 = 0,
|
|
457
469
|
CREAT: bool = false,
|
package/libc/mingw/math/fdiml.c
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file has no copyright assigned and is placed in the Public Domain.
|
|
3
|
-
* This file is part of the mingw-w64 runtime package.
|
|
4
|
-
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
|
5
|
-
*/
|
|
6
|
-
#include <errno.h>
|
|
7
|
-
#include <math.h>
|
|
8
|
-
|
|
9
|
-
long double
|
|
10
|
-
fdiml (long double x, long double y)
|
|
11
|
-
{
|
|
12
|
-
int cx = fpclassify (x), cy = fpclassify (y);
|
|
13
|
-
long double r;
|
|
14
|
-
|
|
15
|
-
if (cx == FP_NAN || cy == FP_NAN
|
|
16
|
-
|| (y < 0 && cx == FP_INFINITE && cy == FP_INFINITE))
|
|
17
|
-
return x - y; /* Take care invalid flag is raised. */
|
|
18
|
-
if (x <= y)
|
|
19
|
-
return 0.0;
|
|
20
|
-
r = x - y;
|
|
21
|
-
if (fpclassify (r) == FP_INFINITE)
|
|
22
|
-
errno = ERANGE;
|
|
23
|
-
return r;
|
|
24
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#include <math.h>
|
|
2
|
-
#include <float.h>
|
|
3
|
-
|
|
4
|
-
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
|
|
5
|
-
long double fdiml(long double x, long double y)
|
|
6
|
-
{
|
|
7
|
-
return fdim(x, y);
|
|
8
|
-
}
|
|
9
|
-
#else
|
|
10
|
-
long double fdiml(long double x, long double y)
|
|
11
|
-
{
|
|
12
|
-
if (isnan(x))
|
|
13
|
-
return x;
|
|
14
|
-
if (isnan(y))
|
|
15
|
-
return y;
|
|
16
|
-
return x > y ? x - y : 0;
|
|
17
|
-
}
|
|
18
|
-
#endif
|