# FloatVectorOperations Divide

Can divide operations be added to this library?  I use these quite a bit and it would be nice if it were built in.

```//in BasicOps32

static forcedinline ParallelType div (ParallelType a, ParallelType b) noexcept  { return _mm_div_ps (a, b); }```

```//in BasicOps64

static forcedinline ParallelType div (ParallelType a, ParallelType b) noexcept  { return _mm_div_pd (a, b); }```

```void JUCE_CALLTYPE FloatVectorOperations::copyWithDividend(float* dest, const float* src, float dividend, int num) noexcept

{

#if JUCE_USE_VDSP_FRAMEWORK

vDSP_svdiv(&dividend, src, 1, dest, 1,  (vDSP_Length)num);

#else

JUCE_PERFORM_VEC_OP_SRC_DEST(dest[i] = dividend / src[i], Mode::div(divsd,s),

#endif

}```

```void JUCE_CALLTYPE FloatVectorOperations::copyWithDivide (float* dest, const float* src, float divisor, int num) noexcept

{

#if JUCE_USE_VDSP_FRAMEWORK

vDSP_vsdiv(src, 1, &divisor, dest, 1, (vDSP_Length)num);

#else

JUCE_PERFORM_VEC_OP_SRC_DEST(dest[i] = src[i] / divisor, Mode::div( s,divs),

#endif

}```

```void JUCE_CALLTYPE FloatVectorOperations::divide(float* dest, const float* src1, const float* src2, int num) noexcept

{

#if JUCE_USE_VDSP_FRAMEWORK

vDSP_vdiv(src2,1,src1,1,dest,1, (vDSP_Length) num);

#else

JUCE_PERFORM_VEC_OP_SRC1_SRC2_DEST(dest[i] = src2[i] / src1[i], Mode::div(s1, s2), JUCE_LOAD_SRC1_SRC2, JUCE_INCREMENT_SRC1_SRC2_DEST, )

#endif

}```

Thanks,

Darren

Thanks - yes, we're planning on adding a lot more DSP functionality soon!

bump… would really love to have an optimized buffer division in floatVectorOperations.

1 Like

+1
And optimized buffer trunc, modf please:
my post

+1!

Should be moved into the new category `Feature Requests`, so people can vote for it…