001/* 002 * The MIT License (MIT) 003 * 004 * Copyright (c) 2015-2024 decimal4j (tools4j), Marco Terzer 005 * 006 * Permission is hereby granted, free of charge, to any person obtaining a copy 007 * of this software and associated documentation files (the "Software"), to deal 008 * in the Software without restriction, including without limitation the rights 009 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 010 * copies of the Software, and to permit persons to whom the Software is 011 * furnished to do so, subject to the following conditions: 012 * 013 * The above copyright notice and this permission notice shall be included in all 014 * copies or substantial portions of the Software. 015 * 016 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 017 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 018 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 019 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 020 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 021 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 022 * SOFTWARE. 023 */ 024package org.decimal4j.exact; 025 026import org.decimal4j.immutable.Decimal0f; 027import org.decimal4j.immutable.Decimal1f; 028import org.decimal4j.immutable.Decimal2f; 029import org.decimal4j.immutable.Decimal3f; 030import org.decimal4j.immutable.Decimal4f; 031import org.decimal4j.immutable.Decimal5f; 032import org.decimal4j.immutable.Decimal6f; 033import org.decimal4j.immutable.Decimal7f; 034import org.decimal4j.immutable.Decimal8f; 035import org.decimal4j.immutable.Decimal9f; 036import org.decimal4j.immutable.Decimal10f; 037import org.decimal4j.immutable.Decimal11f; 038import org.decimal4j.immutable.Decimal12f; 039import org.decimal4j.immutable.Decimal13f; 040import org.decimal4j.immutable.Decimal14f; 041import org.decimal4j.immutable.Decimal15f; 042import org.decimal4j.immutable.Decimal16f; 043import org.decimal4j.immutable.Decimal17f; 044import org.decimal4j.immutable.Decimal18f; 045import org.decimal4j.mutable.MutableDecimal0f; 046import org.decimal4j.mutable.MutableDecimal1f; 047import org.decimal4j.mutable.MutableDecimal2f; 048import org.decimal4j.mutable.MutableDecimal3f; 049import org.decimal4j.mutable.MutableDecimal4f; 050import org.decimal4j.mutable.MutableDecimal5f; 051import org.decimal4j.mutable.MutableDecimal6f; 052import org.decimal4j.mutable.MutableDecimal7f; 053import org.decimal4j.mutable.MutableDecimal8f; 054import org.decimal4j.mutable.MutableDecimal9f; 055import org.decimal4j.mutable.MutableDecimal10f; 056import org.decimal4j.mutable.MutableDecimal11f; 057import org.decimal4j.mutable.MutableDecimal12f; 058import org.decimal4j.mutable.MutableDecimal13f; 059import org.decimal4j.mutable.MutableDecimal14f; 060import org.decimal4j.mutable.MutableDecimal15f; 061import org.decimal4j.mutable.MutableDecimal16f; 062import org.decimal4j.mutable.MutableDecimal17f; 063import org.decimal4j.mutable.MutableDecimal18f; 064 065/** 066 * {@code Multiplier} provides static {@code multiplyExact(..)} methods for 067 * {@link org.decimal4j.api.Decimal Decimal} values of different scales. The multipliable 068 * object returned by those methods encapsulates the Decimal argument and facilitates 069 * exact typed multiplication. The multipliable object acts as first factor in the multiplication 070 * and provides a set of overloaded methods for different scales. Each one of those methods 071 * delivers a different result scale which represents the appropriate scale for the product of 072 * an exact multiplication. 073 * <p> 074 * An exact typed multiplication can for instance be written as: 075 * <pre> 076 * Decimal<Scale5f> value = ... //some value 077 * Decimal7f product7 = Multiplier.multiplyExact(value).by(Decimal2f.FIVE); 078 * Decimal9f product9 = Multiplier.multiplyExact(value).by(Decimal4f.NINE); 079 * </pre> 080 */ 081public final class Multiplier { 082 083 /** 084 * Returns the {@code value} argument as a multipliable factor for typed 085 * exact multiplication. The second factor is passed to one of the 086 * {@code by(..)} methods of the returned multiplier. The scale of 087 * the result is the sum of the scales of the {@code value} and the 088 * second factor passed to the {@code by(..)} method. 089 * 090 * @param value the first factor of the multiplication to be wrapped as a 091 * multipliable object 092 * @return a multipliable object encapsulating {@code value} as first factor 093 * of an exact multiplication 094 */ 095 public static Multipliable0f multiplyExact(Decimal0f value) { 096 return new Multipliable0f(value); 097 } 098 099 /** 100 * Returns the {@code value} argument as a multipliable factor for typed 101 * exact multiplication. The second factor is passed to one of the 102 * {@code by(..)} methods of the returned multiplier. The scale of 103 * the result is the sum of the scales of the {@code value} and the 104 * second factor passed to the {@code by(..)} method. 105 * 106 * @param value the first factor of the multiplication to be wrapped as a 107 * multipliable object 108 * @return a multipliable object encapsulating {@code value} as first factor 109 * of an exact multiplication 110 */ 111 public static Multipliable0f multiplyExact(MutableDecimal0f value) { 112 return new Multipliable0f(value); 113 } 114 115 /** 116 * Returns the {@code value} argument as a multipliable factor for typed 117 * exact multiplication. The second factor is passed to one of the 118 * {@code by(..)} methods of the returned multiplier. The scale of 119 * the result is the sum of the scales of the {@code value} and the 120 * second factor passed to the {@code by(..)} method. 121 * 122 * @param value the first factor of the multiplication to be wrapped as a 123 * multipliable object 124 * @return a multipliable object encapsulating {@code value} as first factor 125 * of an exact multiplication 126 */ 127 public static Multipliable1f multiplyExact(Decimal1f value) { 128 return new Multipliable1f(value); 129 } 130 131 /** 132 * Returns the {@code value} argument as a multipliable factor for typed 133 * exact multiplication. The second factor is passed to one of the 134 * {@code by(..)} methods of the returned multiplier. The scale of 135 * the result is the sum of the scales of the {@code value} and the 136 * second factor passed to the {@code by(..)} method. 137 * 138 * @param value the first factor of the multiplication to be wrapped as a 139 * multipliable object 140 * @return a multipliable object encapsulating {@code value} as first factor 141 * of an exact multiplication 142 */ 143 public static Multipliable1f multiplyExact(MutableDecimal1f value) { 144 return new Multipliable1f(value); 145 } 146 147 /** 148 * Returns the {@code value} argument as a multipliable factor for typed 149 * exact multiplication. The second factor is passed to one of the 150 * {@code by(..)} methods of the returned multiplier. The scale of 151 * the result is the sum of the scales of the {@code value} and the 152 * second factor passed to the {@code by(..)} method. 153 * 154 * @param value the first factor of the multiplication to be wrapped as a 155 * multipliable object 156 * @return a multipliable object encapsulating {@code value} as first factor 157 * of an exact multiplication 158 */ 159 public static Multipliable2f multiplyExact(Decimal2f value) { 160 return new Multipliable2f(value); 161 } 162 163 /** 164 * Returns the {@code value} argument as a multipliable factor for typed 165 * exact multiplication. The second factor is passed to one of the 166 * {@code by(..)} methods of the returned multiplier. The scale of 167 * the result is the sum of the scales of the {@code value} and the 168 * second factor passed to the {@code by(..)} method. 169 * 170 * @param value the first factor of the multiplication to be wrapped as a 171 * multipliable object 172 * @return a multipliable object encapsulating {@code value} as first factor 173 * of an exact multiplication 174 */ 175 public static Multipliable2f multiplyExact(MutableDecimal2f value) { 176 return new Multipliable2f(value); 177 } 178 179 /** 180 * Returns the {@code value} argument as a multipliable factor for typed 181 * exact multiplication. The second factor is passed to one of the 182 * {@code by(..)} methods of the returned multiplier. The scale of 183 * the result is the sum of the scales of the {@code value} and the 184 * second factor passed to the {@code by(..)} method. 185 * 186 * @param value the first factor of the multiplication to be wrapped as a 187 * multipliable object 188 * @return a multipliable object encapsulating {@code value} as first factor 189 * of an exact multiplication 190 */ 191 public static Multipliable3f multiplyExact(Decimal3f value) { 192 return new Multipliable3f(value); 193 } 194 195 /** 196 * Returns the {@code value} argument as a multipliable factor for typed 197 * exact multiplication. The second factor is passed to one of the 198 * {@code by(..)} methods of the returned multiplier. The scale of 199 * the result is the sum of the scales of the {@code value} and the 200 * second factor passed to the {@code by(..)} method. 201 * 202 * @param value the first factor of the multiplication to be wrapped as a 203 * multipliable object 204 * @return a multipliable object encapsulating {@code value} as first factor 205 * of an exact multiplication 206 */ 207 public static Multipliable3f multiplyExact(MutableDecimal3f value) { 208 return new Multipliable3f(value); 209 } 210 211 /** 212 * Returns the {@code value} argument as a multipliable factor for typed 213 * exact multiplication. The second factor is passed to one of the 214 * {@code by(..)} methods of the returned multiplier. The scale of 215 * the result is the sum of the scales of the {@code value} and the 216 * second factor passed to the {@code by(..)} method. 217 * 218 * @param value the first factor of the multiplication to be wrapped as a 219 * multipliable object 220 * @return a multipliable object encapsulating {@code value} as first factor 221 * of an exact multiplication 222 */ 223 public static Multipliable4f multiplyExact(Decimal4f value) { 224 return new Multipliable4f(value); 225 } 226 227 /** 228 * Returns the {@code value} argument as a multipliable factor for typed 229 * exact multiplication. The second factor is passed to one of the 230 * {@code by(..)} methods of the returned multiplier. The scale of 231 * the result is the sum of the scales of the {@code value} and the 232 * second factor passed to the {@code by(..)} method. 233 * 234 * @param value the first factor of the multiplication to be wrapped as a 235 * multipliable object 236 * @return a multipliable object encapsulating {@code value} as first factor 237 * of an exact multiplication 238 */ 239 public static Multipliable4f multiplyExact(MutableDecimal4f value) { 240 return new Multipliable4f(value); 241 } 242 243 /** 244 * Returns the {@code value} argument as a multipliable factor for typed 245 * exact multiplication. The second factor is passed to one of the 246 * {@code by(..)} methods of the returned multiplier. The scale of 247 * the result is the sum of the scales of the {@code value} and the 248 * second factor passed to the {@code by(..)} method. 249 * 250 * @param value the first factor of the multiplication to be wrapped as a 251 * multipliable object 252 * @return a multipliable object encapsulating {@code value} as first factor 253 * of an exact multiplication 254 */ 255 public static Multipliable5f multiplyExact(Decimal5f value) { 256 return new Multipliable5f(value); 257 } 258 259 /** 260 * Returns the {@code value} argument as a multipliable factor for typed 261 * exact multiplication. The second factor is passed to one of the 262 * {@code by(..)} methods of the returned multiplier. The scale of 263 * the result is the sum of the scales of the {@code value} and the 264 * second factor passed to the {@code by(..)} method. 265 * 266 * @param value the first factor of the multiplication to be wrapped as a 267 * multipliable object 268 * @return a multipliable object encapsulating {@code value} as first factor 269 * of an exact multiplication 270 */ 271 public static Multipliable5f multiplyExact(MutableDecimal5f value) { 272 return new Multipliable5f(value); 273 } 274 275 /** 276 * Returns the {@code value} argument as a multipliable factor for typed 277 * exact multiplication. The second factor is passed to one of the 278 * {@code by(..)} methods of the returned multiplier. The scale of 279 * the result is the sum of the scales of the {@code value} and the 280 * second factor passed to the {@code by(..)} method. 281 * 282 * @param value the first factor of the multiplication to be wrapped as a 283 * multipliable object 284 * @return a multipliable object encapsulating {@code value} as first factor 285 * of an exact multiplication 286 */ 287 public static Multipliable6f multiplyExact(Decimal6f value) { 288 return new Multipliable6f(value); 289 } 290 291 /** 292 * Returns the {@code value} argument as a multipliable factor for typed 293 * exact multiplication. The second factor is passed to one of the 294 * {@code by(..)} methods of the returned multiplier. The scale of 295 * the result is the sum of the scales of the {@code value} and the 296 * second factor passed to the {@code by(..)} method. 297 * 298 * @param value the first factor of the multiplication to be wrapped as a 299 * multipliable object 300 * @return a multipliable object encapsulating {@code value} as first factor 301 * of an exact multiplication 302 */ 303 public static Multipliable6f multiplyExact(MutableDecimal6f value) { 304 return new Multipliable6f(value); 305 } 306 307 /** 308 * Returns the {@code value} argument as a multipliable factor for typed 309 * exact multiplication. The second factor is passed to one of the 310 * {@code by(..)} methods of the returned multiplier. The scale of 311 * the result is the sum of the scales of the {@code value} and the 312 * second factor passed to the {@code by(..)} method. 313 * 314 * @param value the first factor of the multiplication to be wrapped as a 315 * multipliable object 316 * @return a multipliable object encapsulating {@code value} as first factor 317 * of an exact multiplication 318 */ 319 public static Multipliable7f multiplyExact(Decimal7f value) { 320 return new Multipliable7f(value); 321 } 322 323 /** 324 * Returns the {@code value} argument as a multipliable factor for typed 325 * exact multiplication. The second factor is passed to one of the 326 * {@code by(..)} methods of the returned multiplier. The scale of 327 * the result is the sum of the scales of the {@code value} and the 328 * second factor passed to the {@code by(..)} method. 329 * 330 * @param value the first factor of the multiplication to be wrapped as a 331 * multipliable object 332 * @return a multipliable object encapsulating {@code value} as first factor 333 * of an exact multiplication 334 */ 335 public static Multipliable7f multiplyExact(MutableDecimal7f value) { 336 return new Multipliable7f(value); 337 } 338 339 /** 340 * Returns the {@code value} argument as a multipliable factor for typed 341 * exact multiplication. The second factor is passed to one of the 342 * {@code by(..)} methods of the returned multiplier. The scale of 343 * the result is the sum of the scales of the {@code value} and the 344 * second factor passed to the {@code by(..)} method. 345 * 346 * @param value the first factor of the multiplication to be wrapped as a 347 * multipliable object 348 * @return a multipliable object encapsulating {@code value} as first factor 349 * of an exact multiplication 350 */ 351 public static Multipliable8f multiplyExact(Decimal8f value) { 352 return new Multipliable8f(value); 353 } 354 355 /** 356 * Returns the {@code value} argument as a multipliable factor for typed 357 * exact multiplication. The second factor is passed to one of the 358 * {@code by(..)} methods of the returned multiplier. The scale of 359 * the result is the sum of the scales of the {@code value} and the 360 * second factor passed to the {@code by(..)} method. 361 * 362 * @param value the first factor of the multiplication to be wrapped as a 363 * multipliable object 364 * @return a multipliable object encapsulating {@code value} as first factor 365 * of an exact multiplication 366 */ 367 public static Multipliable8f multiplyExact(MutableDecimal8f value) { 368 return new Multipliable8f(value); 369 } 370 371 /** 372 * Returns the {@code value} argument as a multipliable factor for typed 373 * exact multiplication. The second factor is passed to one of the 374 * {@code by(..)} methods of the returned multiplier. The scale of 375 * the result is the sum of the scales of the {@code value} and the 376 * second factor passed to the {@code by(..)} method. 377 * 378 * @param value the first factor of the multiplication to be wrapped as a 379 * multipliable object 380 * @return a multipliable object encapsulating {@code value} as first factor 381 * of an exact multiplication 382 */ 383 public static Multipliable9f multiplyExact(Decimal9f value) { 384 return new Multipliable9f(value); 385 } 386 387 /** 388 * Returns the {@code value} argument as a multipliable factor for typed 389 * exact multiplication. The second factor is passed to one of the 390 * {@code by(..)} methods of the returned multiplier. The scale of 391 * the result is the sum of the scales of the {@code value} and the 392 * second factor passed to the {@code by(..)} method. 393 * 394 * @param value the first factor of the multiplication to be wrapped as a 395 * multipliable object 396 * @return a multipliable object encapsulating {@code value} as first factor 397 * of an exact multiplication 398 */ 399 public static Multipliable9f multiplyExact(MutableDecimal9f value) { 400 return new Multipliable9f(value); 401 } 402 403 /** 404 * Returns the {@code value} argument as a multipliable factor for typed 405 * exact multiplication. The second factor is passed to one of the 406 * {@code by(..)} methods of the returned multiplier. The scale of 407 * the result is the sum of the scales of the {@code value} and the 408 * second factor passed to the {@code by(..)} method. 409 * 410 * @param value the first factor of the multiplication to be wrapped as a 411 * multipliable object 412 * @return a multipliable object encapsulating {@code value} as first factor 413 * of an exact multiplication 414 */ 415 public static Multipliable10f multiplyExact(Decimal10f value) { 416 return new Multipliable10f(value); 417 } 418 419 /** 420 * Returns the {@code value} argument as a multipliable factor for typed 421 * exact multiplication. The second factor is passed to one of the 422 * {@code by(..)} methods of the returned multiplier. The scale of 423 * the result is the sum of the scales of the {@code value} and the 424 * second factor passed to the {@code by(..)} method. 425 * 426 * @param value the first factor of the multiplication to be wrapped as a 427 * multipliable object 428 * @return a multipliable object encapsulating {@code value} as first factor 429 * of an exact multiplication 430 */ 431 public static Multipliable10f multiplyExact(MutableDecimal10f value) { 432 return new Multipliable10f(value); 433 } 434 435 /** 436 * Returns the {@code value} argument as a multipliable factor for typed 437 * exact multiplication. The second factor is passed to one of the 438 * {@code by(..)} methods of the returned multiplier. The scale of 439 * the result is the sum of the scales of the {@code value} and the 440 * second factor passed to the {@code by(..)} method. 441 * 442 * @param value the first factor of the multiplication to be wrapped as a 443 * multipliable object 444 * @return a multipliable object encapsulating {@code value} as first factor 445 * of an exact multiplication 446 */ 447 public static Multipliable11f multiplyExact(Decimal11f value) { 448 return new Multipliable11f(value); 449 } 450 451 /** 452 * Returns the {@code value} argument as a multipliable factor for typed 453 * exact multiplication. The second factor is passed to one of the 454 * {@code by(..)} methods of the returned multiplier. The scale of 455 * the result is the sum of the scales of the {@code value} and the 456 * second factor passed to the {@code by(..)} method. 457 * 458 * @param value the first factor of the multiplication to be wrapped as a 459 * multipliable object 460 * @return a multipliable object encapsulating {@code value} as first factor 461 * of an exact multiplication 462 */ 463 public static Multipliable11f multiplyExact(MutableDecimal11f value) { 464 return new Multipliable11f(value); 465 } 466 467 /** 468 * Returns the {@code value} argument as a multipliable factor for typed 469 * exact multiplication. The second factor is passed to one of the 470 * {@code by(..)} methods of the returned multiplier. The scale of 471 * the result is the sum of the scales of the {@code value} and the 472 * second factor passed to the {@code by(..)} method. 473 * 474 * @param value the first factor of the multiplication to be wrapped as a 475 * multipliable object 476 * @return a multipliable object encapsulating {@code value} as first factor 477 * of an exact multiplication 478 */ 479 public static Multipliable12f multiplyExact(Decimal12f value) { 480 return new Multipliable12f(value); 481 } 482 483 /** 484 * Returns the {@code value} argument as a multipliable factor for typed 485 * exact multiplication. The second factor is passed to one of the 486 * {@code by(..)} methods of the returned multiplier. The scale of 487 * the result is the sum of the scales of the {@code value} and the 488 * second factor passed to the {@code by(..)} method. 489 * 490 * @param value the first factor of the multiplication to be wrapped as a 491 * multipliable object 492 * @return a multipliable object encapsulating {@code value} as first factor 493 * of an exact multiplication 494 */ 495 public static Multipliable12f multiplyExact(MutableDecimal12f value) { 496 return new Multipliable12f(value); 497 } 498 499 /** 500 * Returns the {@code value} argument as a multipliable factor for typed 501 * exact multiplication. The second factor is passed to one of the 502 * {@code by(..)} methods of the returned multiplier. The scale of 503 * the result is the sum of the scales of the {@code value} and the 504 * second factor passed to the {@code by(..)} method. 505 * 506 * @param value the first factor of the multiplication to be wrapped as a 507 * multipliable object 508 * @return a multipliable object encapsulating {@code value} as first factor 509 * of an exact multiplication 510 */ 511 public static Multipliable13f multiplyExact(Decimal13f value) { 512 return new Multipliable13f(value); 513 } 514 515 /** 516 * Returns the {@code value} argument as a multipliable factor for typed 517 * exact multiplication. The second factor is passed to one of the 518 * {@code by(..)} methods of the returned multiplier. The scale of 519 * the result is the sum of the scales of the {@code value} and the 520 * second factor passed to the {@code by(..)} method. 521 * 522 * @param value the first factor of the multiplication to be wrapped as a 523 * multipliable object 524 * @return a multipliable object encapsulating {@code value} as first factor 525 * of an exact multiplication 526 */ 527 public static Multipliable13f multiplyExact(MutableDecimal13f value) { 528 return new Multipliable13f(value); 529 } 530 531 /** 532 * Returns the {@code value} argument as a multipliable factor for typed 533 * exact multiplication. The second factor is passed to one of the 534 * {@code by(..)} methods of the returned multiplier. The scale of 535 * the result is the sum of the scales of the {@code value} and the 536 * second factor passed to the {@code by(..)} method. 537 * 538 * @param value the first factor of the multiplication to be wrapped as a 539 * multipliable object 540 * @return a multipliable object encapsulating {@code value} as first factor 541 * of an exact multiplication 542 */ 543 public static Multipliable14f multiplyExact(Decimal14f value) { 544 return new Multipliable14f(value); 545 } 546 547 /** 548 * Returns the {@code value} argument as a multipliable factor for typed 549 * exact multiplication. The second factor is passed to one of the 550 * {@code by(..)} methods of the returned multiplier. The scale of 551 * the result is the sum of the scales of the {@code value} and the 552 * second factor passed to the {@code by(..)} method. 553 * 554 * @param value the first factor of the multiplication to be wrapped as a 555 * multipliable object 556 * @return a multipliable object encapsulating {@code value} as first factor 557 * of an exact multiplication 558 */ 559 public static Multipliable14f multiplyExact(MutableDecimal14f value) { 560 return new Multipliable14f(value); 561 } 562 563 /** 564 * Returns the {@code value} argument as a multipliable factor for typed 565 * exact multiplication. The second factor is passed to one of the 566 * {@code by(..)} methods of the returned multiplier. The scale of 567 * the result is the sum of the scales of the {@code value} and the 568 * second factor passed to the {@code by(..)} method. 569 * 570 * @param value the first factor of the multiplication to be wrapped as a 571 * multipliable object 572 * @return a multipliable object encapsulating {@code value} as first factor 573 * of an exact multiplication 574 */ 575 public static Multipliable15f multiplyExact(Decimal15f value) { 576 return new Multipliable15f(value); 577 } 578 579 /** 580 * Returns the {@code value} argument as a multipliable factor for typed 581 * exact multiplication. The second factor is passed to one of the 582 * {@code by(..)} methods of the returned multiplier. The scale of 583 * the result is the sum of the scales of the {@code value} and the 584 * second factor passed to the {@code by(..)} method. 585 * 586 * @param value the first factor of the multiplication to be wrapped as a 587 * multipliable object 588 * @return a multipliable object encapsulating {@code value} as first factor 589 * of an exact multiplication 590 */ 591 public static Multipliable15f multiplyExact(MutableDecimal15f value) { 592 return new Multipliable15f(value); 593 } 594 595 /** 596 * Returns the {@code value} argument as a multipliable factor for typed 597 * exact multiplication. The second factor is passed to one of the 598 * {@code by(..)} methods of the returned multiplier. The scale of 599 * the result is the sum of the scales of the {@code value} and the 600 * second factor passed to the {@code by(..)} method. 601 * 602 * @param value the first factor of the multiplication to be wrapped as a 603 * multipliable object 604 * @return a multipliable object encapsulating {@code value} as first factor 605 * of an exact multiplication 606 */ 607 public static Multipliable16f multiplyExact(Decimal16f value) { 608 return new Multipliable16f(value); 609 } 610 611 /** 612 * Returns the {@code value} argument as a multipliable factor for typed 613 * exact multiplication. The second factor is passed to one of the 614 * {@code by(..)} methods of the returned multiplier. The scale of 615 * the result is the sum of the scales of the {@code value} and the 616 * second factor passed to the {@code by(..)} method. 617 * 618 * @param value the first factor of the multiplication to be wrapped as a 619 * multipliable object 620 * @return a multipliable object encapsulating {@code value} as first factor 621 * of an exact multiplication 622 */ 623 public static Multipliable16f multiplyExact(MutableDecimal16f value) { 624 return new Multipliable16f(value); 625 } 626 627 /** 628 * Returns the {@code value} argument as a multipliable factor for typed 629 * exact multiplication. The second factor is passed to one of the 630 * {@code by(..)} methods of the returned multiplier. The scale of 631 * the result is the sum of the scales of the {@code value} and the 632 * second factor passed to the {@code by(..)} method. 633 * 634 * @param value the first factor of the multiplication to be wrapped as a 635 * multipliable object 636 * @return a multipliable object encapsulating {@code value} as first factor 637 * of an exact multiplication 638 */ 639 public static Multipliable17f multiplyExact(Decimal17f value) { 640 return new Multipliable17f(value); 641 } 642 643 /** 644 * Returns the {@code value} argument as a multipliable factor for typed 645 * exact multiplication. The second factor is passed to one of the 646 * {@code by(..)} methods of the returned multiplier. The scale of 647 * the result is the sum of the scales of the {@code value} and the 648 * second factor passed to the {@code by(..)} method. 649 * 650 * @param value the first factor of the multiplication to be wrapped as a 651 * multipliable object 652 * @return a multipliable object encapsulating {@code value} as first factor 653 * of an exact multiplication 654 */ 655 public static Multipliable17f multiplyExact(MutableDecimal17f value) { 656 return new Multipliable17f(value); 657 } 658 659 /** 660 * Returns the {@code value} argument as a multipliable factor for typed 661 * exact multiplication. The second factor is passed to one of the 662 * {@code by(..)} methods of the returned multiplier. The scale of 663 * the result is the sum of the scales of the {@code value} and the 664 * second factor passed to the {@code by(..)} method. 665 * 666 * @param value the first factor of the multiplication to be wrapped as a 667 * multipliable object 668 * @return a multipliable object encapsulating {@code value} as first factor 669 * of an exact multiplication 670 */ 671 public static Multipliable18f multiplyExact(Decimal18f value) { 672 return new Multipliable18f(value); 673 } 674 675 /** 676 * Returns the {@code value} argument as a multipliable factor for typed 677 * exact multiplication. The second factor is passed to one of the 678 * {@code by(..)} methods of the returned multiplier. The scale of 679 * the result is the sum of the scales of the {@code value} and the 680 * second factor passed to the {@code by(..)} method. 681 * 682 * @param value the first factor of the multiplication to be wrapped as a 683 * multipliable object 684 * @return a multipliable object encapsulating {@code value} as first factor 685 * of an exact multiplication 686 */ 687 public static Multipliable18f multiplyExact(MutableDecimal18f value) { 688 return new Multipliable18f(value); 689 } 690 691 //no instances 692 private Multiplier() {} 693}