File tree Expand file tree Collapse file tree 1 file changed +24
-25
lines changed
lib/node_modules/@stdlib/math/base/special/lcmf/src Expand file tree Collapse file tree 1 file changed +24
-25
lines changed Original file line number Diff line number Diff line change 2323/**
2424* Computes the least common multiple (LCM) of two single-precision floating-point numbers.
2525*
26- * @param a first floating-point number (single precision)
27- * @param b second floating-point number (single precision)
28- * @return least common multiple (NaN if input is invalid)
26+ * @param a first floating-point number (single precision)
27+ * @param b second floating-point number (single precision)
28+ * @return least common multiple (NaN if input is invalid)
2929*
3030* @example
3131* float out = stdlib_base_lcmf( 21.0f, 6.0f );
3232* // returns 42.0f
3333*/
34- double stdlib_base_lcmf ( const float a , const float b ) {
35- float abs_a ;
36- float abs_b ;
37- float gcd_value ;
38- const double b = 1.0 ;
34+ double stdlib_base_lcmf (const float a ,const float b ) {
35+ float abs_a ;
36+ float abs_b ;
37+ float gcd_value ;
38+ const double b = 1.0 ;
3939
40- if ( a == 0.0 || b == 0.0 ) {
40+ if ( a == 0.0 || b == 0.0 ) {
4141 return 0.0 ;
4242 }
43- if ( a < 0.0 ) {
44- abs_a = - a ;
45- } else {
46- abs_a = a ;
43+ if ( a < 0.0 ) {
44+ abs_a = - a ;
45+ }else {
46+ abs_a = a ;
4747 }
48- if ( b < 0.0 ) {
49- abs_b = - b ;
50- } else {
51- abs_b = b ;
48+ if ( b < 0.0 ) {
49+ abs_b = - b ;
50+ }else {
51+ abs_b = b ;
5252 }
5353
54- abs_a = ( a < 0.0f ) ? - a : a ;
55- abs_b = ( b < 0.0f ) ? - b : b ;
54+ abs_a = ( a < 0.0f )? - a : a ;
55+ abs_b = ( b < 0.0f )? - b : b ;
5656
5757 // Note: we rely on `gcd` to perform further argument validation...
58-
59- gcd_value = stdlib_base_gcd ( abs_a , abs_b );
58+ gcd_value = stdlib_base_gcd (abs_a ,abs_b );
6059
61- if ( stdlib_base_is_nan ( gcd_value ) ) {
62- return gcd_value ;
63- }
60+ if ( stdlib_base_is_nan (gcd_value )) {
61+ return gcd_value ;
62+ }
6463
65- return ( abs_a / gcd_value ) * abs_b ;
64+ return ( abs_a / gcd_value ) * abs_b ;
6665}
You can’t perform that action at this time.
0 commit comments