”…weird lesson to take. You'll have "problems near 2**53" in those languages too!”

I'm not so sure about that. Or at least I don't see the problems:

use anyhow::{Context, Result}; use num::BigUint; fn frob(n: u64) -> Result<BigUint> { Ok((1..=n) .into_iter() .map(|i| BigUint::from(i)) .reduce(|a, b| a * b) .context("fuba")?) } fn main() -> Result<()> { println!("i8 {}", i8::MAX); println!("i16 {}", i16::MAX); println!("i32 {}", i32::MAX); println!("i64 {}", i64::MAX); println!("i128 {}", i128::MAX); println!("u8 {}", u8::MAX); println!("u16 {}", u16::MAX); println!("u32 {}", u32::MAX); println!("u64 {}", u64::MAX); println!("u128 {}", u128::MAX); println!("f32 {}", f32::MAX); println!("f64 {}", f64::MAX); println!("{}", frob(1000)?); Ok(()) }
i8 127 i16 32767 i32 2147483647 i64 9223372036854775807 i128 170141183460469231731687303715884105727 u8 255 u16 65535 u32 4294967295 u64 18446744073709551615 u128 340282366920938463463374607431768211455 f32 340282350000000000000000000000000000000 f64 179769313486231570000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000\ 0000000000000000000000000000000000000 4023872600770937735437024339230039857193748642107146325437999104299385 +123986290205920442084869694048004799886101971960586316668729948085589 +013238296699445909974245040870737599188236277271887325197795059509952 +76120874975462497043601418278094646496291056393887437886487337119181\ 0458257836478499770124766328898359557354325131853239584630755574091142 +624174743493475534286465766116677973966688202912073791438537195882498 +081268678383745597317461360853795345242215865932019280908782973084313 +92844403281231558611036976801357304216168747609675871348312025478589\ 3207671691324484262361314125087802080002616831510273418279777047846358 +681701643650241536913982812648102130927612448963599287051149649754199 +093422215668325720808213331861168115536158365469840467089756029009505 +37616475847728421889679646244945160765353408198901385442487984959953\ 3191017233555566021394503997362807501378376153071277619268490343526252 +000158885351473316117021039681759215109077880193931781141945452572238 +655414610628921879602238389714760885062768629671466746975629112340824 +39208160153780889893964518263243671616762179168909779911903754031274\ 6222899880051954444142820121873617459926429565817466283029555702990243 +241531816172104658320367869061172601587835207515162842255402651704833 +042261439742869330616908979684825901254583271682264580665267699586526 +82272807075781391858178889652208164348344825993266043367660176999612\ 8318607883861502794659551311565520360939881806121385586003014356945272 +242063446317974605946825731037900840244324384656572450144028218852524 +709351906209290231364932734975655139587205596542287497740114133469627 +15422845862377387538230483865688976461927383814900140767310446640259\ 8994902222217659043399018860185665264850617997023561938970178600408118 +897299183110211712298459016419210688843871218556461249607987229085192 +968193723886426148396573822911231250241866493531439701374285319266498 +75337218940694281434118520158014123344828015051399694290153483077644\ 5690990731524332782882698646027898643211390835062170950025973898635542 +771967428222487575867657523442202075736305694988250879689281627538488 +633969099598262809561214509948717012445164612603790293091208890869420 +28510640182154399457156805941872748998094254742173582401063677404595\ 7417851608292301353580818400969963725242305608559037006242712434169090 +041536901059339838357779394109700277534720000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000\ 0000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000

In any case, this seems to be a clearly defined matter in this case.


In reply to Re^3: Largest integer in 64-bit perl by karlgoethebier
in thread Largest integer in 64-bit perl by harangzsolt33

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.