the BigDecimal g/G suffix?
OCsite <[email protected]> Tue, 19 Aug 2025 18:11:47 +0200
| Newsgroups | gmane.comp.lang.groovy.user |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_CEE7318E-3F36-4C5E-905E-A6394FF477F6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi there, I've just bumped into = https://groovy-lang.org/syntax.html#_number_type_suffixes, namely, to BigDecimal G or g which seems rather pointless to me. When one enters a decimal number = (e.g., 1.0), it's a BD anyway, suffix or not. On the other hand, there = seems to be no suffix which would allow to write e.g., just 1s (s for = something) creating a 1 BD, which would make some sense, like e.g., 1f = for float does. What do I overlook? What's the point of the BD g/G suffix, and why = there's no suffix which would work without a decimal point (or = exponent)? Thanks, OC --Apple-Mail=_CEE7318E-3F36-4C5E-905E-A6394FF477F6 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii <html><head><meta http-equiv=3D"content-type" content=3D"text/html; = charset=3Dus-ascii"></head><body style=3D"overflow-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;">Hi = there,<div><br></div><div>I've just bumped into <a = href=3D"https://groovy-lang.org/syntax.html#_number_type_suffixes">https:/= /groovy-lang.org/syntax.html#_number_type_suffixes</a>, namely, = to</div><div><br></div><table class=3D"tableblock frame-all grid-all = stretch" style=3D"font-variant-caps: normal; border-spacing: 0px; = border-collapse: collapse; caret-color: rgb(52, 52, 55); color: rgb(52, = 52, 55); font-family: "Noto Sans JP", "Helvetica = Neue", Helvetica, Arial, sans-serif; font-size: 14px;"><tbody = style=3D"box-sizing: border-box;"><tr style=3D"box-sizing: = border-box;"><td class=3D"tableblock halign-left valign-top" = style=3D"box-sizing: border-box; padding: 0px;"><p class=3D"tableblock" = style=3D"box-sizing: border-box; margin: 1em = 0px;">BigDecimal</p></td><td class=3D"tableblock halign-left valign-top" = style=3D"box-sizing: border-box; padding: 0px;"><p class=3D"tableblock" = style=3D"box-sizing: border-box; margin: 1em 0px;"><code = style=3D"box-sizing: border-box; font-family: Block, "Noto Sans = Mono", Consolas, Monaco, "Bitstream Vera Sans Mono", = "Courier New", Courier, monospace; font-size: 12.6px; padding: = 2px 4px; color: rgb(199, 37, 78); background-color: rgb(249, 242, 244); = border-radius: 4px;">G</code> or <code style=3D"box-sizing: = border-box; font-family: Block, "Noto Sans Mono", Consolas, = Monaco, "Bitstream Vera Sans Mono", "Courier New", = Courier, monospace; font-size: 12.6px; padding: 2px 4px; color: rgb(199, = 37, 78); background-color: rgb(249, 242, 244); border-radius: = 4px;">g</code></p></td></tr></tbody></table><div><br></div><div>which = seems rather pointless to me. When one enters a decimal number (e.g., = 1.0), it's a BD anyway, suffix or not. On the other hand, there seems to = be no suffix which would allow to write e.g., just 1s (s for = <i>something</i>) creating a 1 BD, which would make some sense, like = e.g., 1f for float does.</div><div><br></div><div>What do I overlook? = What's the point of the BD g/G suffix, and why there's no suffix which = would work without a decimal point (or = exponent)?</div><div><br></div><div>Thanks,</div><div>OC</div><div><br></d= iv></body></html>= --Apple-Mail=_CEE7318E-3F36-4C5E-905E-A6394FF477F6--