# Adding two integers vs. adding two floating-point numbers

**URL:** <https://discourse.julialang.org/t/adding-two-integers-vs-adding-two-floating-point-numbers/108494>\
**Category:** General Usage\
**Tags:** question\
**Created:** [January 8, 2024, 2:30am UTC](https://discourse.julialang.org/t/adding-two-integers-vs-adding-two-floating-point-numbers/108494 "2024-01-08T02:30:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiang\_ming\_zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jiang_ming_zhang/32/204063_2.png) [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Post date:** [January 8, 2024, 2:30am UTC](https://discourse.julialang.org/t/adding-two-integers-vs-adding-two-floating-point-numbers/108494/1 "2024-01-08T02:30:28Z")

</div>

According to the julia documents,

**adding two integers is very different from adding two floating-point numbers, both of which are distinct from adding an integer to a floating-point number.**

Is adding two integers faster than adding two floating-point numbers? This question should not be confined to julia.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [January 8, 2024, 2:45am UTC](https://discourse.julialang.org/t/adding-two-integers-vs-adding-two-floating-point-numbers/108494/2 "2024-01-08T02:45:39Z")

</div>

it depends on your processor, but generally yes. for zen4, for example, [integer adds](https://uops.info/html-instr/ADD_01_R64_R64.html) have a latency of 1 cycle, while [floating point](https://uops.info/html-instr/VADDSD_XMM_XMM_XMM.html) adds have a latency of 3
