Skip to content

Commit 00e3cbe

Browse files
authored
Merge pull request #1327 from herbie-fp/codex/update-herbie10-and-herbie20-platforms
Refactor platforms to use `#:fpcore`
2 parents 5e35cae + 251b1f7 commit 00e3cbe

File tree

2 files changed

+270
-262
lines changed

2 files changed

+270
-262
lines changed

src/platforms/herbie10.rkt

Lines changed: 131 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -34,73 +34,75 @@
3434
[<=.f32 #:spec (<= x y) #:impl <= #:cost 0]
3535
[>=.f32 #:spec (>= x y) #:impl >= #:cost 0])
3636

37-
(parameterize ([fpcore-context '(:precision binary32)])
38-
(define-operations () <binary32>
39-
[PI.f32 #:spec (PI) #:impl (const (flsingle pi)) #:fpcore PI #:cost 0]
40-
[E.f32 #:spec (E) #:impl (const (flsingle (exp 1))) #:fpcore E #:cost 0]
41-
[INFINITY.f32 #:spec (INFINITY) #:impl (const +inf.0) #:fpcore INFINITY #:cost 0]
42-
[NAN.f32 #:spec (NAN) #:impl (const +nan.0) #:fpcore NAN #:cost 0])
37+
(define-operations () <binary32> #:fpcore (:precision binary32)
38+
[PI.f32 #:spec (PI) #:impl (const (flsingle pi)) #:fpcore PI #:cost 0]
39+
[E.f32 #:spec (E) #:impl (const (flsingle (exp 1))) #:fpcore E #:cost 0]
40+
[INFINITY.f32 #:spec (INFINITY) #:impl (const +inf.0) #:fpcore INFINITY #:cost 0]
41+
[NAN.f32 #:spec (NAN) #:impl (const +nan.0) #:fpcore NAN #:cost 0])
42+
43+
(define-operation (neg.f32 [x <binary32>]) <binary32>
44+
#:spec (neg x) #:impl (compose flsingle -)
45+
#:fpcore (! :precision binary32 (- x)) #:cost 0)
4346

44-
(define-operation (neg.f32 [x <binary32>]) <binary32>
45-
#:spec (neg x) #:impl (compose flsingle -) #:fpcore (- x) #:cost 0)
47+
(define-operations ([x <binary32>] [y <binary32>]) <binary32> #:fpcore (:precision binary32)
48+
[+.f32 #:spec (+ x y) #:impl (compose flsingle +) #:cost 0]
49+
[-.f32 #:spec (- x y) #:impl (compose flsingle -) #:cost 0]
50+
[*.f32 #:spec (* x y) #:impl (compose flsingle *) #:cost 0]
51+
[/.f32 #:spec (/ x y) #:impl (compose flsingle /) #:cost 0])
52+
53+
(define-operations ([x <binary32>]) <binary32> #:fpcore (:precision binary32)
54+
[fabs.f32 #:spec (fabs x) #:impl (from-libm 'fabsf) #:cost 0]
55+
[sin.f32 #:spec (sin x) #:impl (from-libm 'sinf) #:cost 0]
56+
[cos.f32 #:spec (cos x) #:impl (from-libm 'cosf) #:cost 0]
57+
[tan.f32 #:spec (tan x) #:impl (from-libm 'tanf) #:cost 0]
58+
[sinh.f32 #:spec (sinh x) #:impl (from-libm 'sinhf) #:cost 0]
59+
[cosh.f32 #:spec (cosh x) #:impl (from-libm 'coshf) #:cost 0]
60+
[acos.f32 #:spec (acos x) #:impl (from-libm 'acosf) #:cost 0]
61+
[acosh.f32 #:spec (acosh x) #:impl (from-libm 'acoshf) #:cost 0]
62+
[asin.f32 #:spec (asin x) #:impl (from-libm 'asinf) #:cost 0]
63+
[asinh.f32 #:spec (asinh x) #:impl (from-libm 'asinhf) #:cost 0]
64+
[atan.f32 #:spec (atan x) #:impl (from-libm 'atanf) #:cost 0]
65+
[atanh.f32 #:spec (atanh x) #:impl (from-libm 'atanhf) #:cost 0]
66+
[cbrt.f32 #:spec (cbrt x) #:impl (from-libm 'cbrtf) #:cost 0]
67+
[ceil.f32 #:spec (ceil x) #:impl (from-libm 'ceilf) #:cost 0]
68+
[erf.f32 #:spec (erf x) #:impl (from-libm 'erff) #:cost 0]
69+
[exp.f32 #:spec (exp x) #:impl (from-libm 'expf) #:cost 0]
70+
[exp2.f32 #:spec (exp2 x) #:impl (from-libm 'exp2f) #:cost 0]
71+
[floor.f32 #:spec (floor x) #:impl (from-libm 'floorf) #:cost 0]
72+
[lgamma.f32 #:spec (lgamma x) #:impl (from-libm 'lgammaf) #:cost 0]
73+
[log.f32 #:spec (log x) #:impl (from-libm 'logf) #:cost 0]
74+
[log10.f32 #:spec (log10 x) #:impl (from-libm 'log10f) #:cost 0]
75+
[log2.f32 #:spec (log2 x) #:impl (from-libm 'log2f) #:cost 0]
76+
[logb.f32 #:spec (logb x) #:impl (from-libm 'logbf) #:cost 0]
77+
[rint.f32 #:spec (rint x) #:impl (from-libm 'rintf) #:cost 0]
78+
[round.f32 #:spec (round x) #:impl (from-libm 'roundf) #:cost 0]
79+
[sqrt.f32 #:spec (sqrt x) #:impl (from-libm 'sqrtf) #:cost 0]
80+
[tanh.f32 #:spec (tanh x) #:impl (from-libm 'tanhf) #:cost 0]
81+
[tgamma.f32 #:spec (tgamma x) #:impl (from-libm 'tgammaf) #:cost 0]
82+
[trunc.f32 #:spec (trunc x) #:impl (from-libm 'truncf) #:cost 0])
4683

47-
(define-operations ([x <binary32>] [y <binary32>]) <binary32>
48-
[+.f32 #:spec (+ x y) #:impl (compose flsingle +) #:cost 0]
49-
[-.f32 #:spec (- x y) #:impl (compose flsingle -) #:cost 0]
50-
[*.f32 #:spec (* x y) #:impl (compose flsingle *) #:cost 0]
51-
[/.f32 #:spec (/ x y) #:impl (compose flsingle /) #:cost 0])
84+
(define-operations ([x <binary32>] [y <binary32>]) <binary32> #:fpcore (:precision binary32)
85+
[pow.f32 #:spec (pow x y) #:impl (from-libm 'powf) #:cost 0]
86+
[atan2.f32 #:spec (atan2 x y) #:impl (from-libm 'atan2f) #:cost 0]
87+
[copysign.f32 #:spec (copysign x y) #:impl (from-libm 'copysignf) #:cost 0]
88+
[fdim.f32 #:spec (fdim x y) #:impl (from-libm 'fdimf) #:cost 0]
89+
[fmax.f32 #:spec (fmax x y) #:impl (from-libm 'fmaxf) #:cost 0]
90+
[fmin.f32 #:spec (fmin x y) #:impl (from-libm 'fminf) #:cost 0]
91+
[fmod.f32 #:spec (fmod x y) #:impl (from-libm 'fmodf) #:cost 0]
92+
[remainder.f32 #:spec (remainder x y) #:impl (from-libm 'remainderf) #:cost 0])
5293

53-
(define-operations ([x <binary32>]) <binary32>
54-
[fabs.f32 #:spec (fabs x) #:impl (from-libm 'fabsf) #:cost 0]
55-
[sin.f32 #:spec (sin x) #:impl (from-libm 'sinf) #:cost 0]
56-
[cos.f32 #:spec (cos x) #:impl (from-libm 'cosf) #:cost 0]
57-
[tan.f32 #:spec (tan x) #:impl (from-libm 'tanf) #:cost 0]
58-
[sinh.f32 #:spec (sinh x) #:impl (from-libm 'sinhf) #:cost 0]
59-
[cosh.f32 #:spec (cosh x) #:impl (from-libm 'coshf) #:cost 0]
60-
[acos.f32 #:spec (acos x) #:impl (from-libm 'acosf) #:cost 0]
61-
[acosh.f32 #:spec (acosh x) #:impl (from-libm 'acoshf) #:cost 0]
62-
[asin.f32 #:spec (asin x) #:impl (from-libm 'asinf) #:cost 0]
63-
[asinh.f32 #:spec (asinh x) #:impl (from-libm 'asinhf) #:cost 0]
64-
[atan.f32 #:spec (atan x) #:impl (from-libm 'atanf) #:cost 0]
65-
[atanh.f32 #:spec (atanh x) #:impl (from-libm 'atanhf) #:cost 0]
66-
[cbrt.f32 #:spec (cbrt x) #:impl (from-libm 'cbrtf) #:cost 0]
67-
[ceil.f32 #:spec (ceil x) #:impl (from-libm 'ceilf) #:cost 0]
68-
[erf.f32 #:spec (erf x) #:impl (from-libm 'erff) #:cost 0]
69-
[exp.f32 #:spec (exp x) #:impl (from-libm 'expf) #:cost 0]
70-
[exp2.f32 #:spec (exp2 x) #:impl (from-libm 'exp2f) #:cost 0]
71-
[floor.f32 #:spec (floor x) #:impl (from-libm 'floorf) #:cost 0]
72-
[lgamma.f32 #:spec (lgamma x) #:impl (from-libm 'lgammaf) #:cost 0]
73-
[log.f32 #:spec (log x) #:impl (from-libm 'logf) #:cost 0]
74-
[log10.f32 #:spec (log10 x) #:impl (from-libm 'log10f) #:cost 0]
75-
[log2.f32 #:spec (log2 x) #:impl (from-libm 'log2f) #:cost 0]
76-
[logb.f32 #:spec (logb x) #:impl (from-libm 'logbf) #:cost 0]
77-
[rint.f32 #:spec (rint x) #:impl (from-libm 'rintf) #:cost 0]
78-
[round.f32 #:spec (round x) #:impl (from-libm 'roundf) #:cost 0]
79-
[sqrt.f32 #:spec (sqrt x) #:impl (from-libm 'sqrtf) #:cost 0]
80-
[tanh.f32 #:spec (tanh x) #:impl (from-libm 'tanhf) #:cost 0]
81-
[tgamma.f32 #:spec (tgamma x) #:impl (from-libm 'tgammaf) #:cost 0]
82-
[trunc.f32 #:spec (trunc x) #:impl (from-libm 'truncf) #:cost 0])
94+
(define-operations ([x <binary32>]) <binary32> #:fpcore (:precision binary32)
95+
[erfc.f32 #:spec (- 1 (erf x)) #:impl (from-libm 'erfcf) #:fpcore (erfc x) #:cost 0]
96+
[expm1.f32 #:spec (- (exp x) 1) #:impl (from-libm 'expm1f) #:fpcore (expm1 x) #:cost 0]
97+
[log1p.f32 #:spec (log (+ 1 x)) #:impl (from-libm 'log1pf) #:fpcore (log1p x) #:cost 0])
8398

84-
(define-operations ([x <binary32>] [y <binary32>]) <binary32>
85-
[pow.f32 #:spec (pow x y) #:impl (from-libm 'powf) #:cost 0]
86-
[atan2.f32 #:spec (atan2 x y) #:impl (from-libm 'atan2f) #:cost 0]
87-
[copysign.f32 #:spec (copysign x y) #:impl (from-libm 'copysignf) #:cost 0]
88-
[fdim.f32 #:spec (fdim x y) #:impl (from-libm 'fdimf) #:cost 0]
89-
[fmax.f32 #:spec (fmax x y) #:impl (from-libm 'fmaxf) #:cost 0]
90-
[fmin.f32 #:spec (fmin x y) #:impl (from-libm 'fminf) #:cost 0]
91-
[fmod.f32 #:spec (fmod x y) #:impl (from-libm 'fmodf) #:cost 0]
92-
[remainder.f32 #:spec (remainder x y) #:impl (from-libm 'remainderf) #:cost 0])
93-
94-
(define-operations ([x <binary32>]) <binary32>
95-
[erfc.f32 #:spec (- 1 (erf x)) #:impl (from-libm 'erfcf) #:fpcore (erfc x) #:cost 0]
96-
[expm1.f32 #:spec (- (exp x) 1) #:impl (from-libm 'expm1f) #:fpcore (expm1 x) #:cost 0]
97-
[log1p.f32 #:spec (log (+ 1 x)) #:impl (from-libm 'log1pf) #:fpcore (log1p x) #:cost 0])
98-
99-
(define-operation (hypot.f32 [x <binary32>] [y <binary32>]) <binary32>
100-
#:spec (sqrt (+ (* x x) (* y y))) #:impl (from-libm 'hypotf) #:fpcore (hypot x y) #:cost 0)
101-
102-
(define-operation (fma.f32 [x <binary32>] [y <binary32>] [z <binary32>]) <binary32>
103-
#:spec (+ (* x y) z) #:impl (from-libm 'fmaf) #:fpcore (fma x y z) #:cost 0))
99+
(define-operation (hypot.f32 [x <binary32>] [y <binary32>]) <binary32>
100+
#:spec (sqrt (+ (* x x) (* y y))) #:impl (from-libm 'hypotf)
101+
#:fpcore (! :precision binary32 (hypot x y)) #:cost 0)
102+
103+
(define-operation (fma.f32 [x <binary32>] [y <binary32>] [z <binary32>]) <binary32>
104+
#:spec (+ (* x y) z) #:impl (from-libm 'fmaf)
105+
#:fpcore (! :precision binary32 (fma x y z)) #:cost 0)
104106

105107
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; BINARY 64 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
106108

@@ -114,73 +116,75 @@
114116
[<=.f64 #:spec (<= x y) #:impl <= #:cost 0]
115117
[>=.f64 #:spec (>= x y) #:impl >= #:cost 0])
116118

117-
(parameterize ([fpcore-context '(:precision binary64)])
118-
(define-operations () <binary64>
119-
[PI.f64 #:spec (PI) #:impl (const pi) #:fpcore PI #:cost 0]
120-
[E.f64 #:spec (E) #:impl (const (exp 1)) #:fpcore E #:cost 0]
121-
[INFINITY #:spec (INFINITY) #:impl (const +inf.0) #:fpcore INFINITY #:cost 0]
122-
[NAN.f64 #:spec (NAN) #:impl (const +nan.0) #:fpcore NAN #:cost 0])
123-
124-
(define-operations ([x <binary64>] [y <binary64>]) <binary64>
125-
[+.f64 #:spec (+ x y) #:impl + #:cost 0]
126-
[-.f64 #:spec (- x y) #:impl - #:cost 0]
127-
[*.f64 #:spec (* x y) #:impl * #:cost 0]
128-
[/.f64 #:spec (/ x y) #:impl / #:cost 0])
129-
130-
(define-operation (neg.f64 [x <binary64>]) <binary64>
131-
#:spec (neg x) #:impl - #:fpcore (- x) #:cost 0)
132-
133-
(define-operations ([x <binary64>]) <binary64>
134-
[fabs.f64 #:spec (fabs x) #:impl (from-libm 'fabs) #:cost 0]
135-
[sin.f64 #:spec (sin x) #:impl (from-libm 'sin) #:cost 0]
136-
[cos.f64 #:spec (cos x) #:impl (from-libm 'cos) #:cost 0]
137-
[tan.f64 #:spec (tan x) #:impl (from-libm 'tan) #:cost 0]
138-
[sinh.f64 #:spec (sinh x) #:impl (from-libm 'sinh) #:cost 0]
139-
[cosh.f64 #:spec (cosh x) #:impl (from-libm 'cosh) #:cost 0]
140-
[acos.f64 #:spec (acos x) #:impl (from-libm 'acos) #:cost 0]
141-
[acosh.f64 #:spec (acosh x) #:impl (from-libm 'acosh) #:cost 0]
142-
[asin.f64 #:spec (asin x) #:impl (from-libm 'asin) #:cost 0]
143-
[asinh.f64 #:spec (asinh x) #:impl (from-libm 'asinh) #:cost 0]
144-
[atan.f64 #:spec (atan x) #:impl (from-libm 'atan) #:cost 0]
145-
[atanh.f64 #:spec (atanh x) #:impl (from-libm 'atanh) #:cost 0]
146-
[cbrt.f64 #:spec (cbrt x) #:impl (from-libm 'cbrt) #:cost 0]
147-
[ceil.f64 #:spec (ceil x) #:impl (from-libm 'ceil) #:cost 0]
148-
[erf.f64 #:spec (erf x) #:impl (from-libm 'erf) #:cost 0]
149-
[exp.f64 #:spec (exp x) #:impl (from-libm 'exp) #:cost 0]
150-
[exp2.f64 #:spec (exp2 x) #:impl (from-libm 'exp2) #:cost 0]
151-
[floor.f64 #:spec (floor x) #:impl (from-libm 'floor) #:cost 0]
152-
[lgamma.f64 #:spec (lgamma x) #:impl (from-libm 'lgamma) #:cost 0]
153-
[log.f64 #:spec (log x) #:impl (from-libm 'log) #:cost 0]
154-
[log10.f64 #:spec (log10 x) #:impl (from-libm 'log10) #:cost 0]
155-
[log2.f64 #:spec (log2 x) #:impl (from-libm 'log2) #:cost 0]
156-
[logb.f64 #:spec (logb x) #:impl (from-libm 'logb) #:cost 0]
157-
[rint.f64 #:spec (rint x) #:impl (from-libm 'rint) #:cost 0]
158-
[round.f64 #:spec (round x) #:impl (from-libm 'round) #:cost 0]
159-
[sqrt.f64 #:spec (sqrt x) #:impl (from-libm 'sqrt) #:cost 0]
160-
[tanh.f64 #:spec (tanh x) #:impl (from-libm 'tanh) #:cost 0]
161-
[tgamma.f64 #:spec (tgamma x) #:impl (from-libm 'tgamma) #:cost 0]
162-
[trunc.f64 #:spec (trunc x) #:impl (from-libm 'trunc) #:cost 0])
163-
164-
(define-operations ([x <binary64>] [y <binary64>]) <binary64>
165-
[pow.f64 #:spec (pow x y) #:impl (from-libm 'pow) #:cost 0]
166-
[atan2.f64 #:spec (atan2 x y) #:impl (from-libm 'atan2) #:cost 0]
167-
[copysign.f64 #:spec (copysign x y) #:impl (from-libm 'copysign) #:cost 0]
168-
[fdim.f64 #:spec (fdim x y) #:impl (from-libm 'fdim) #:cost 0]
169-
[fmax.f64 #:spec (fmax x y) #:impl (from-libm 'fmax) #:cost 0]
170-
[fmin.f64 #:spec (fmin x y) #:impl (from-libm 'fmin) #:cost 0]
171-
[fmod.f64 #:spec (fmod x y) #:impl (from-libm 'fmod) #:cost 0]
172-
[remainder.f64 #:spec (remainder x y) #:impl (from-libm 'remainder) #:cost 0])
119+
(define-operations () <binary64> #:fpcore (:precision binary64)
120+
[PI.f64 #:spec (PI) #:impl (const pi) #:fpcore PI #:cost 0]
121+
[E.f64 #:spec (E) #:impl (const (exp 1)) #:fpcore E #:cost 0]
122+
[INFINITY #:spec (INFINITY) #:impl (const +inf.0) #:fpcore INFINITY #:cost 0]
123+
[NAN.f64 #:spec (NAN) #:impl (const +nan.0) #:fpcore NAN #:cost 0])
124+
125+
(define-operations ([x <binary64>] [y <binary64>]) <binary64> #:fpcore (:precision binary64)
126+
[+.f64 #:spec (+ x y) #:impl + #:cost 0]
127+
[-.f64 #:spec (- x y) #:impl - #:cost 0]
128+
[*.f64 #:spec (* x y) #:impl * #:cost 0]
129+
[/.f64 #:spec (/ x y) #:impl / #:cost 0])
130+
131+
(define-operation (neg.f64 [x <binary64>]) <binary64>
132+
#:spec (neg x) #:impl -
133+
#:fpcore (! :precision binary64 (- x)) #:cost 0)
173134

174-
(define-operations ([x <binary64>]) <binary64>
175-
[erfc.f64 #:spec (- 1 (erf x)) #:impl (from-libm 'erfc) #:fpcore (erfc x) #:cost 0]
176-
[expm1.f64 #:spec (- (exp x) 1) #:impl (from-libm 'expm1) #:fpcore (expm1 x) #:cost 0]
177-
[log1p.f64 #:spec (log (+ 1 x)) #:impl (from-libm 'log1p) #:fpcore (log1p x) #:cost 0])
135+
(define-operations ([x <binary64>]) <binary64> #:fpcore (:precision binary64)
136+
[fabs.f64 #:spec (fabs x) #:impl (from-libm 'fabs) #:cost 0]
137+
[sin.f64 #:spec (sin x) #:impl (from-libm 'sin) #:cost 0]
138+
[cos.f64 #:spec (cos x) #:impl (from-libm 'cos) #:cost 0]
139+
[tan.f64 #:spec (tan x) #:impl (from-libm 'tan) #:cost 0]
140+
[sinh.f64 #:spec (sinh x) #:impl (from-libm 'sinh) #:cost 0]
141+
[cosh.f64 #:spec (cosh x) #:impl (from-libm 'cosh) #:cost 0]
142+
[acos.f64 #:spec (acos x) #:impl (from-libm 'acos) #:cost 0]
143+
[acosh.f64 #:spec (acosh x) #:impl (from-libm 'acosh) #:cost 0]
144+
[asin.f64 #:spec (asin x) #:impl (from-libm 'asin) #:cost 0]
145+
[asinh.f64 #:spec (asinh x) #:impl (from-libm 'asinh) #:cost 0]
146+
[atan.f64 #:spec (atan x) #:impl (from-libm 'atan) #:cost 0]
147+
[atanh.f64 #:spec (atanh x) #:impl (from-libm 'atanh) #:cost 0]
148+
[cbrt.f64 #:spec (cbrt x) #:impl (from-libm 'cbrt) #:cost 0]
149+
[ceil.f64 #:spec (ceil x) #:impl (from-libm 'ceil) #:cost 0]
150+
[erf.f64 #:spec (erf x) #:impl (from-libm 'erf) #:cost 0]
151+
[exp.f64 #:spec (exp x) #:impl (from-libm 'exp) #:cost 0]
152+
[exp2.f64 #:spec (exp2 x) #:impl (from-libm 'exp2) #:cost 0]
153+
[floor.f64 #:spec (floor x) #:impl (from-libm 'floor) #:cost 0]
154+
[lgamma.f64 #:spec (lgamma x) #:impl (from-libm 'lgamma) #:cost 0]
155+
[log.f64 #:spec (log x) #:impl (from-libm 'log) #:cost 0]
156+
[log10.f64 #:spec (log10 x) #:impl (from-libm 'log10) #:cost 0]
157+
[log2.f64 #:spec (log2 x) #:impl (from-libm 'log2) #:cost 0]
158+
[logb.f64 #:spec (logb x) #:impl (from-libm 'logb) #:cost 0]
159+
[rint.f64 #:spec (rint x) #:impl (from-libm 'rint) #:cost 0]
160+
[round.f64 #:spec (round x) #:impl (from-libm 'round) #:cost 0]
161+
[sqrt.f64 #:spec (sqrt x) #:impl (from-libm 'sqrt) #:cost 0]
162+
[tanh.f64 #:spec (tanh x) #:impl (from-libm 'tanh) #:cost 0]
163+
[tgamma.f64 #:spec (tgamma x) #:impl (from-libm 'tgamma) #:cost 0]
164+
[trunc.f64 #:spec (trunc x) #:impl (from-libm 'trunc) #:cost 0])
178165

179-
(define-operation (hypot.f64 [x <binary64>] [y <binary64>]) <binary64>
180-
#:spec (sqrt (+ (* x x) (* y y))) #:impl (from-libm 'hypot) #:fpcore (hypot x y) #:cost 0)
166+
(define-operations ([x <binary64>] [y <binary64>]) <binary64> #:fpcore (:precision binary64)
167+
[pow.f64 #:spec (pow x y) #:impl (from-libm 'pow) #:cost 0]
168+
[atan2.f64 #:spec (atan2 x y) #:impl (from-libm 'atan2) #:cost 0]
169+
[copysign.f64 #:spec (copysign x y) #:impl (from-libm 'copysign) #:cost 0]
170+
[fdim.f64 #:spec (fdim x y) #:impl (from-libm 'fdim) #:cost 0]
171+
[fmax.f64 #:spec (fmax x y) #:impl (from-libm 'fmax) #:cost 0]
172+
[fmin.f64 #:spec (fmin x y) #:impl (from-libm 'fmin) #:cost 0]
173+
[fmod.f64 #:spec (fmod x y) #:impl (from-libm 'fmod) #:cost 0]
174+
[remainder.f64 #:spec (remainder x y) #:impl (from-libm 'remainder) #:cost 0])
181175

182-
(define-operation (fma.f64 [x <binary64>] [y <binary64>] [z <binary64>]) <binary64>
183-
#:spec (+ (* x y) z) #:impl (from-libm 'fma) #:fpcore (fma x y z) #:cost 0))
176+
(define-operations ([x <binary64>]) <binary64> #:fpcore (:precision binary64)
177+
[erfc.f64 #:spec (- 1 (erf x)) #:impl (from-libm 'erfc) #:fpcore (erfc x) #:cost 0]
178+
[expm1.f64 #:spec (- (exp x) 1) #:impl (from-libm 'expm1) #:fpcore (expm1 x) #:cost 0]
179+
[log1p.f64 #:spec (log (+ 1 x)) #:impl (from-libm 'log1p) #:fpcore (log1p x) #:cost 0])
180+
181+
(define-operation (hypot.f64 [x <binary64>] [y <binary64>]) <binary64>
182+
#:spec (sqrt (+ (* x x) (* y y))) #:impl (from-libm 'hypot)
183+
#:fpcore (! :precision binary64 (hypot x y)) #:cost 0)
184+
185+
(define-operation (fma.f64 [x <binary64>] [y <binary64>] [z <binary64>]) <binary64>
186+
#:spec (+ (* x y) z) #:impl (from-libm 'fma)
187+
#:fpcore (! :precision binary64 (fma x y z)) #:cost 0)
184188

185189
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; CASTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
186190

0 commit comments

Comments
 (0)