summary refs log tree commit diff stats
path: root/compiler/parampatterns.nim
Commit message (Expand)AuthorAgeFilesLines
* use strictdefs for compiler (#22365)ringabout2023-08-061-0/+1
* new move analyser2 (#20471)Andreas Rumpf2022-10-011-2/+2
* store full definition AST for consts, fix noRewrite (#20115)metagn2022-09-281-1/+1
* apply changes from #18017 and some fixes (#19571)flywind2022-03-011-29/+31
* fix term rewriting with sideeffect (#19410)flywind2022-01-191-2/+5
* reuse existing toHumanStr (#15674)Timothee Cour2020-10-211-1/+1
* implements https://github.com/nim-lang/RFCs/issues/257 (#15466)Andreas Rumpf2020-10-021-0/+2
* Big compiler Cleanup (#14777)Clyybber2020-08-281-2/+2
* init checks and 'out' parameters (#14521)Andreas Rumpf2020-06-231-3/+3
* fixes #14557 (#14607)Andreas Rumpf2020-06-081-1/+1
* fixes #14498 [backport:1.2] (#14503)Andreas Rumpf2020-05-301-3/+9
* Cosmetic compiler cleanup (#12718)Clyybber2019-11-281-24/+24
* fixes #12224 (#12225)cooldome2019-09-211-3/+5
* sink as lvalueAndrii Riabushenko2019-09-021-3/+3
* [refactoring] remove unused imports in the compiler and in some stdlib modulesAraq2019-07-181-1/+1
* fixes #10942. Lent T bug (#10946)cooldome2019-04-031-5/+12
* fixes #7524Araq2019-01-141-8/+7
* Allow taking address of skForVar variables (#8632)LemonBoy2018-08-141-1/+1
* guards.nim does compileAndreas Rumpf2018-05-111-26/+27
* refactoring: make FileIndex a distinct type; make line information an uint16;...Andreas Rumpf2018-04-211-1/+2
* make tests green againAndreas Rumpf2018-03-241-3/+8
* fixes the 'var T' checkingAndreas Rumpf2018-03-241-5/+2
* more checking for 'var T' as return type; refs #7373Andreas Rumpf2018-03-241-1/+29
* basic 'lent T' test worksAndreas Rumpf2018-01-211-1/+4
* deprecated unary '<'Andreas Rumpf2017-10-291-3/+3
* support the full range of type modifiers when declaring concept vars and test...Zahary Karadjov2017-03-241-0/+7
* fixes #4608Andreas Rumpf2016-10-181-0/+2
* some progress on #3832Andreas Rumpf2016-02-081-0/+3
* preparations for better handling of 'a[i]' in generics; stmt lists can be lva...Araq2015-09-121-1/+4
* added system.unsafeAddrAraq2015-08-041-9/+11
* fix #2585 properlyAraq2015-04-221-1/+3
* fixes #2585Araq2015-04-221-1/+1
* implemented a[^1] notationAraq2015-03-261-3/+4
* fixes #2346Araq2015-03-161-2/+6
* fixes #1809; implements overloading based on 'var T'Araq2015-03-141-19/+22
* nimsuggest improvementsAraq2015-01-301-1/+1
* Nimrod renamed to NimAraq2014-08-281-1/+1
* implemented builtin noncopying sliceAraq2014-05-021-1/+4
* case consistency improvementsAraq2014-01-111-1/+1
* case consistency: next stepsAraq2013-12-291-4/+4
* case consistency part 4Araq2013-12-271-2/+2
* implemented large parts of the 'not nil' checkingAraq2013-06-091-0/+2
* make some tests greenAraq2013-03-031-4/+7
* constraint now part of the parameter symbol and not of the typeAraq2012-12-051-2/+2
* term rewriting improvementsAraq2012-09-081-3/+56
* activated tests for tr macrosAraq2012-09-061-3/+4
* bugfixes and improvements for term rewriting macrosAraq2012-09-041-1/+1
* term rewriting macros fully implemented; still buggyAraq2012-09-031-0/+205
=9460fcfed24aeb75b5e3a1e350bae0052b208337'>^
5abe88046 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58









                                                                 
                                                     


                                                                   
                                                                   

                                                             
                                                                



                                                                            
                                                                           


                                                                           
                                                                   
          
                                                                   

          
                                                                   
          
                                                                   

          
                                                                   
          
                                                                   

          
                                                                   
          
                                                                   

          
                                                                      
          
                                                                      
          
                                                                       
           
                                                                       



                                                                              
                  
#
#
#            Nim's Runtime Library
#        (c) Copyright 2017 Nim contributors
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

## This module offers implementations of common binary operations
## like `+`, `-`, `*`, `/` and comparison operations,
## which work for mixed float/int operands.
## All operations convert the integer operand into the
## type of the float operand. For numerical expressions, the return
## type is always the type of the float involved in the expression,
## i.e., there is no auto conversion from float32 to float64.
##
## **Note:** In general, auto-converting from int to float loses
## information, which is why these operators live in a separate
## module. Use with care.
##
## Regarding binary comparison, this module only provides unequal operators.
## The equality operator `==` is omitted, because depending on the use case
## either casting to float or rounding to int might be preferred, and users
## should make an explicit choice.

func `+`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.inline.} =
  F(i) + f
func `+`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.inline.} =
  f + F(i)

func `-`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.inline.} =
  F(i) - f
func `-`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.inline.} =
  f - F(i)

func `*`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.inline.} =
  F(i) * f
func `*`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.inline.} =
  f * F(i)

func `/`*[I: SomeInteger, F: SomeFloat](i: I, f: F): F {.inline.} =
  F(i) / f
func `/`*[I: SomeInteger, F: SomeFloat](f: F, i: I): F {.inline.} =
  f / F(i)

func `<`*[I: SomeInteger, F: SomeFloat](i: I, f: F): bool {.inline.} =
  F(i) < f
func `<`*[I: SomeInteger, F: SomeFloat](f: F, i: I): bool {.inline.} =
  f < F(i)
func `<=`*[I: SomeInteger, F: SomeFloat](i: I, f: F): bool {.inline.} =
  F(i) <= f
func `<=`*[I: SomeInteger, F: SomeFloat](f: F, i: I): bool {.inline.} =
  f <= F(i)

# Note that we must not defined `>=` and `>`, because system.nim already has a
# template with signature (x, y: untyped): untyped, which would lead to
# ambiguous calls.