![]() |
![]() |
#1 |
Mar 2018
17 Posts |
![]()
An example on Windows 7:-
Code:
C:\Users\Christopher\Downloads\yafu-1.34>yafu-x64 "nextprime(723391033893233, 0)" ans = 723391033893197 Code:
C:\Users\Christopher\Downloads\yafu-1.34>yafu-x64 "nextprime(0723391033893233, 0)" ans = 2 |
![]() |
![]() |
![]() |
#2 |
"William"
May 2003
New Haven
2,371 Posts |
![]()
Is it the "leading zero means the number is octal" issue? And the number isn't a valid octal number, so "string to integer" returns zero?
|
![]() |
![]() |
![]() |
#3 | |
Mar 2018
17 Posts |
![]()
@wblipp
Good point, but in the docfile.txt of YAHU 1.34 it says Quote:
|
|
![]() |
![]() |
![]() |
#4 | |
"Ben"
Feb 2007
361710 Posts |
![]() Quote:
![]() Chances are it will be an easy fix, but also likely is that the fix will only appear in source revision, not a new released version. Can you build from source? |
|
![]() |
![]() |
![]() |
#5 |
Mar 2018
17 Posts |
![]()
Thanks @bsquared. I can't build from source, but this is not an urgent fix for me as I have amended that "other program" to remove the leading zero.
|
![]() |
![]() |
![]() |
#6 |
"Ben"
Feb 2007
E2116 Posts |
![]()
I looked at the code and here is what's happening. Yafu's parser looks at the input and decides that yes, 0723391033893233 is a number (not a variable name or function). Whereupon it hands the number to gmp's mpz_set_str function; I've been using that function with base 0, meaning autodecode the base. Gmp's autodecoder just needs a leading 0 to decide octal, but the number is not octal so the call fails. Wblipp was right.
Yafu's parser correctly decoded decimal (it looks for leading 0o for octal), so I if change anything I could use the base decoder in my parser instead of relying on gmp. However, 0o is not standard notation for octal... a single leading 0 is historically the way to represent them. So Gmp's interpretation is the correct one. I'll leave things as they are except I will add a printed warning if the conversion fails. |
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Religious extremism leading to conflict and slaughter: how to handle this? | Brian-E | Soap Box | 15 | 2014-05-16 03:12 |
nextprime() appears to be limited... | EdH | YAFU | 7 | 2013-03-18 22:09 |
Leading Edge | Primeinator | Information & Answers | 9 | 2010-06-25 07:36 |
Fixed leading bits in RSA modulus, vs NFS | fgrieu | Factoring | 7 | 2009-09-23 11:45 |
Graph of leading edge of LL testing (and double-checking) over time | GP2 | Data | 10 | 2003-11-17 14:55 |