Skip to content

Commit 7db61e9

Browse files
authored
Fix lcm signature (#957)
The result can be +inf.0, for example: (lcm 3E307 5E307) (lcm #e3E999 1.0)
1 parent a1bfb95 commit 7db61e9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

mats/5_3.ms

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,6 +2592,14 @@
25922592
(eqv? (lcm 10.0 0.0 0.0 0.0) 0.0)
25932593
(eqv? (lcm 0.0 6.0 7.0 10.0) 0.0)
25942594
(eqv? (lcm 10.0 6.0 7.0 0.0) 0.0)
2595+
(eqv? (lcm 3E307 5E307) +inf.0)
2596+
(eqv? (lcm #e3E999 1.0) +inf.0)
2597+
(begin
2598+
;; make sure the optimizer doesn't assume an integer result
2599+
(define ($lcm-result x) (if (integer? (lcm x 1.0)) 'int 'non-int))
2600+
#t)
2601+
(eq? ($lcm-result 5) 'int)
2602+
(eq? ($lcm-result #e3E999) 'non-int)
25952603
)
25962604
25972605
(mat expt

s/primdata.ss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
(div0 [sig [(real real) -> (real)]] [flags arith-op mifoldable discard])
224224
(mod0 [sig [(real real) -> (real)]] [flags arith-op mifoldable discard])
225225
(gcd [sig [(integer ...) -> (integer)]] [flags arith-op mifoldable discard ieee r5rs])
226-
(lcm [sig [(integer ...) -> (integer)]] [flags arith-op mifoldable discard ieee r5rs])
226+
(lcm [sig [(integer ...) -> (real)]] [flags arith-op mifoldable discard ieee r5rs]) ; uinteger or +inf.0
227227
(numerator [sig [(rational) -> (integer)]] [flags arith-op mifoldable discard ieee r5rs])
228228
(denominator [sig [(rational) -> (integer)]] [flags arith-op mifoldable discard ieee r5rs])
229229
(floor [sig [(real) -> (real)]] [flags arith-op mifoldable discard safeongoodargs ieee r5rs])

0 commit comments

Comments
 (0)